From c18ba252e7810878942bd5cd99d0ad877bbb8f65 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 5 Jan 2022 07:26:19 +0000 Subject: [PATCH] CodeGen from PR 17000 in Azure/azure-rest-api-specs [Go] Track2 modify readme.go.md 9 (#17000) * [Go] Track2 modify readme.go.md 9 * fix --- sdk/synapse/azure-mgmt-synapse/_meta.json | 10 +- .../azure/mgmt/synapse/__init__.py | 9 +- .../azure/mgmt/synapse/_configuration.py | 19 +- .../azure/mgmt/synapse/_metadata.json | 21 +- .../azure/mgmt/synapse/_patch.py | 31 + .../synapse/_synapse_management_client.py | 557 +- .../azure/mgmt/synapse/_vendor.py | 27 + .../azure/mgmt/synapse/_version.py | 2 +- .../azure/mgmt/synapse/aio/__init__.py | 5 + .../azure/mgmt/synapse/aio/_configuration.py | 6 +- .../azure/mgmt/synapse/aio/_patch.py | 31 + .../synapse/aio/_synapse_management_client.py | 557 +- ...zure_ad_only_authentications_operations.py | 182 +- .../operations/_big_data_pools_operations.py | 286 +- .../_data_masking_policies_operations.py | 90 +- .../_data_masking_rules_operations.py | 155 +- ..._pool_blob_auditing_policies_operations.py | 143 +- ...ntegration_runtime_auth_keys_operations.py | 89 +- ...ion_runtime_connection_infos_operations.py | 43 +- ...egration_runtime_credentials_operations.py | 42 +- ...tion_runtime_monitoring_data_operations.py | 43 +- ...tion_runtime_node_ip_address_operations.py | 45 +- .../_integration_runtime_nodes_operations.py | 129 +- ...tion_runtime_object_metadata_operations.py | 122 +- .../_integration_runtime_status_operations.py | 43 +- .../_integration_runtimes_operations.py | 608 +- .../_ip_firewall_rules_operations.py | 308 +- .../aio/operations/_keys_operations.py | 171 +- .../_kusto_operations_operations.py | 44 +- ...ched_database_configurations_operations.py | 245 +- .../_kusto_pool_child_resource_operations.py | 51 +- ..._kusto_pool_data_connections_operations.py | 458 +- ...tabase_principal_assignments_operations.py | 304 +- .../_kusto_pool_databases_operations.py | 313 +- ...o_pool_principal_assignments_operations.py | 291 +- .../aio/operations/_kusto_pools_operations.py | 880 +- .../aio/operations/_libraries_operations.py | 58 +- .../aio/operations/_library_operations.py | 43 +- .../synapse/aio/operations/_operations.py | 136 +- ...private_endpoint_connections_operations.py | 242 +- ...connections_private_link_hub_operations.py | 100 +- ...k_hub_private_link_resources_operations.py | 99 +- .../_private_link_hubs_operations.py | 280 +- .../_private_link_resources_operations.py | 99 +- ...restorable_dropped_sql_pools_operations.py | 99 +- .../_spark_configuration_operations.py | 43 +- .../_spark_configurations_operations.py | 64 +- ..._pool_blob_auditing_policies_operations.py | 143 +- .../_sql_pool_columns_operations.py | 47 +- ...sql_pool_connection_policies_operations.py | 45 +- ...ta_warehouse_user_activities_operations.py | 46 +- ...sql_pool_geo_backup_policies_operations.py | 149 +- ...l_maintenance_window_options_operations.py | 43 +- ...sql_pool_maintenance_windows_operations.py | 85 +- ...l_pool_metadata_sync_configs_operations.py | 86 +- .../_sql_pool_operation_results_operations.py | 45 +- .../_sql_pool_operations_operations.py | 65 +- ...commended_sensitivity_labels_operations.py | 46 +- .../_sql_pool_replication_links_operations.py | 104 +- .../_sql_pool_restore_points_operations.py | 205 +- .../_sql_pool_schemas_operations.py | 104 +- ...pool_security_alert_policies_operations.py | 143 +- ..._sql_pool_sensitivity_labels_operations.py | 383 +- .../_sql_pool_table_columns_operations.py | 75 +- .../operations/_sql_pool_tables_operations.py | 109 +- ...transparent_data_encryptions_operations.py | 153 +- .../operations/_sql_pool_usages_operations.py | 67 +- ...ty_assessment_rule_baselines_operations.py | 150 +- ...lnerability_assessment_scans_operations.py | 213 +- ...ol_vulnerability_assessments_operations.py | 184 +- ...sql_pool_workload_classifier_operations.py | 241 +- .../_sql_pool_workload_group_operations.py | 230 +- .../aio/operations/_sql_pools_operations.py | 437 +- .../_workspace_aad_admins_operations.py | 167 +- ...dentity_sql_control_settings_operations.py | 118 +- ...erver_blob_auditing_policies_operations.py | 166 +- ..._server_encryption_protector_operations.py | 224 +- ...ended_blob_auditing_policies_operations.py | 169 +- ...server_recoverable_sql_pools_operations.py | 95 +- ...server_security_alert_policy_operations.py | 175 +- ...ce_managed_sql_server_usages_operations.py | 62 +- ...er_vulnerability_assessments_operations.py | 175 +- .../_workspace_sql_aad_admins_operations.py | 167 +- .../aio/operations/_workspaces_operations.py | 343 +- .../azure/mgmt/synapse/models/__init__.py | 750 +- .../azure/mgmt/synapse/models/_models.py | 10629 ---------------- .../azure/mgmt/synapse/models/_models_py3.py | 5035 ++++++-- .../_synapse_management_client_enums.py | 181 +- ...zure_ad_only_authentications_operations.py | 355 +- .../operations/_big_data_pools_operations.py | 587 +- .../_data_masking_policies_operations.py | 214 +- .../_data_masking_rules_operations.py | 333 +- ..._pool_blob_auditing_policies_operations.py | 314 +- ...ntegration_runtime_auth_keys_operations.py | 205 +- ...ion_runtime_connection_infos_operations.py | 103 +- ...egration_runtime_credentials_operations.py | 102 +- ...tion_runtime_monitoring_data_operations.py | 103 +- ...tion_runtime_node_ip_address_operations.py | 109 +- .../_integration_runtime_nodes_operations.py | 309 +- ...tion_runtime_object_metadata_operations.py | 253 +- .../_integration_runtime_status_operations.py | 103 +- .../_integration_runtimes_operations.py | 1241 +- .../_ip_firewall_rules_operations.py | 606 +- .../synapse/operations/_keys_operations.py | 382 +- .../_kusto_operations_operations.py | 85 +- ...ched_database_configurations_operations.py | 497 +- .../_kusto_pool_child_resource_operations.py | 123 +- ..._kusto_pool_data_connections_operations.py | 955 +- ...tabase_principal_assignments_operations.py | 639 +- .../_kusto_pool_databases_operations.py | 640 +- ...o_pool_principal_assignments_operations.py | 602 +- .../operations/_kusto_pools_operations.py | 1758 ++- .../operations/_libraries_operations.py | 113 +- .../synapse/operations/_library_operations.py | 103 +- .../mgmt/synapse/operations/_operations.py | 316 +- ...private_endpoint_connections_operations.py | 471 +- ...connections_private_link_hub_operations.py | 203 +- ...k_hub_private_link_resources_operations.py | 199 +- .../_private_link_hubs_operations.py | 569 +- .../_private_link_resources_operations.py | 199 +- ...restorable_dropped_sql_pools_operations.py | 202 +- .../_spark_configuration_operations.py | 103 +- .../_spark_configurations_operations.py | 116 +- ..._pool_blob_auditing_policies_operations.py | 314 +- .../_sql_pool_columns_operations.py | 119 +- ...sql_pool_connection_policies_operations.py | 109 +- ...ta_warehouse_user_activities_operations.py | 110 +- ...sql_pool_geo_backup_policies_operations.py | 321 +- ...l_maintenance_window_options_operations.py | 108 +- ...sql_pool_maintenance_windows_operations.py | 208 +- ...l_pool_metadata_sync_configs_operations.py | 202 +- .../_sql_pool_operation_results_operations.py | 109 +- .../_sql_pool_operations_operations.py | 124 +- ...commended_sensitivity_labels_operations.py | 116 +- .../_sql_pool_replication_links_operations.py | 212 +- .../_sql_pool_restore_points_operations.py | 432 +- .../_sql_pool_schemas_operations.py | 214 +- ...pool_security_alert_policies_operations.py | 318 +- ..._sql_pool_sensitivity_labels_operations.py | 869 +- .../_sql_pool_table_columns_operations.py | 145 +- .../operations/_sql_pool_tables_operations.py | 227 +- ...transparent_data_encryptions_operations.py | 328 +- .../operations/_sql_pool_usages_operations.py | 123 +- ...ty_assessment_rule_baselines_operations.py | 348 +- ...lnerability_assessment_scans_operations.py | 453 +- ...ol_vulnerability_assessments_operations.py | 405 +- ...sql_pool_workload_classifier_operations.py | 507 +- .../_sql_pool_workload_group_operations.py | 476 +- .../operations/_sql_pools_operations.py | 900 +- .../_workspace_aad_admins_operations.py | 343 +- ...dentity_sql_control_settings_operations.py | 241 +- ...erver_blob_auditing_policies_operations.py | 342 +- ..._server_encryption_protector_operations.py | 450 +- ...ended_blob_auditing_policies_operations.py | 345 +- ...server_recoverable_sql_pools_operations.py | 195 +- ...server_security_alert_policy_operations.py | 348 +- ...ce_managed_sql_server_usages_operations.py | 114 +- ...er_vulnerability_assessments_operations.py | 380 +- .../_workspace_sql_aad_admins_operations.py | 343 +- .../operations/_workspaces_operations.py | 648 +- 160 files changed, 26067 insertions(+), 28368 deletions(-) create mode 100644 sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_patch.py create mode 100644 sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_vendor.py create mode 100644 sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/_patch.py delete mode 100644 sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_models.py diff --git a/sdk/synapse/azure-mgmt-synapse/_meta.json b/sdk/synapse/azure-mgmt-synapse/_meta.json index 4e05c5bd974c7..1f74258ee6b53 100644 --- a/sdk/synapse/azure-mgmt-synapse/_meta.json +++ b/sdk/synapse/azure-mgmt-synapse/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "64b91c09704b103f1a98719300b47c413c75bbe3", + "commit": "2ab4371edba33c23e8d680ed2bf6f98705b5cadb", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/synapse/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "autorest_command": "autorest specification/synapse/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/synapse/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/__init__.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/__init__.py index 0c0d8cc91c768..fd66306bc5da7 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/__init__.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['SynapseManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_configuration.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_configuration.py index 98a3b72b75d81..6eba9d5a566bb 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_configuration.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class SynapseManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(SynapseManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(SynapseManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -67,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_metadata.json b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_metadata.json index 6e44ec221b949..1c66f72fa98cf 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_metadata.json +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_metadata.json @@ -5,13 +5,13 @@ "name": "SynapseManagementClient", "filename": "_synapse_management_client", "description": "Azure Synapse Analytics Management Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"SynapseManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"SynapseManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"SynapseManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"SynapseManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"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\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "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": { "azure_ad_only_authentications": "AzureADOnlyAuthenticationsOperations", diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_patch.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_synapse_management_client.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_synapse_management_client.py index caf430b509b71..850e2c2c5ff15 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_synapse_management_client.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_synapse_management_client.py @@ -6,99 +6,27 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import SynapseManagementClientConfiguration +from .operations import AzureADOnlyAuthenticationsOperations, BigDataPoolsOperations, DataMaskingPoliciesOperations, DataMaskingRulesOperations, ExtendedSqlPoolBlobAuditingPoliciesOperations, IntegrationRuntimeAuthKeysOperations, IntegrationRuntimeConnectionInfosOperations, IntegrationRuntimeCredentialsOperations, IntegrationRuntimeMonitoringDataOperations, IntegrationRuntimeNodeIpAddressOperations, IntegrationRuntimeNodesOperations, IntegrationRuntimeObjectMetadataOperations, IntegrationRuntimeStatusOperations, IntegrationRuntimesOperations, IpFirewallRulesOperations, KeysOperations, KustoOperationsOperations, KustoPoolAttachedDatabaseConfigurationsOperations, KustoPoolChildResourceOperations, KustoPoolDataConnectionsOperations, KustoPoolDatabasePrincipalAssignmentsOperations, KustoPoolDatabasesOperations, KustoPoolPrincipalAssignmentsOperations, KustoPoolsOperations, LibrariesOperations, LibraryOperations, Operations, PrivateEndpointConnectionsOperations, PrivateEndpointConnectionsPrivateLinkHubOperations, PrivateLinkHubPrivateLinkResourcesOperations, PrivateLinkHubsOperations, PrivateLinkResourcesOperations, RestorableDroppedSqlPoolsOperations, SparkConfigurationOperations, SparkConfigurationsOperations, SqlPoolBlobAuditingPoliciesOperations, SqlPoolColumnsOperations, SqlPoolConnectionPoliciesOperations, SqlPoolDataWarehouseUserActivitiesOperations, SqlPoolGeoBackupPoliciesOperations, SqlPoolMaintenanceWindowOptionsOperations, SqlPoolMaintenanceWindowsOperations, SqlPoolMetadataSyncConfigsOperations, SqlPoolOperationResultsOperations, SqlPoolOperationsOperations, SqlPoolRecommendedSensitivityLabelsOperations, SqlPoolReplicationLinksOperations, SqlPoolRestorePointsOperations, SqlPoolSchemasOperations, SqlPoolSecurityAlertPoliciesOperations, SqlPoolSensitivityLabelsOperations, SqlPoolTableColumnsOperations, SqlPoolTablesOperations, SqlPoolTransparentDataEncryptionsOperations, SqlPoolUsagesOperations, SqlPoolVulnerabilityAssessmentRuleBaselinesOperations, SqlPoolVulnerabilityAssessmentScansOperations, SqlPoolVulnerabilityAssessmentsOperations, SqlPoolWorkloadClassifierOperations, SqlPoolWorkloadGroupOperations, SqlPoolsOperations, WorkspaceAadAdminsOperations, WorkspaceManagedIdentitySqlControlSettingsOperations, WorkspaceManagedSqlServerBlobAuditingPoliciesOperations, WorkspaceManagedSqlServerEncryptionProtectorOperations, WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations, WorkspaceManagedSqlServerRecoverableSqlPoolsOperations, WorkspaceManagedSqlServerSecurityAlertPolicyOperations, WorkspaceManagedSqlServerUsagesOperations, WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations, WorkspaceSqlAadAdminsOperations, WorkspacesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import SynapseManagementClientConfiguration -from .operations import AzureADOnlyAuthenticationsOperations -from .operations import Operations -from .operations import IpFirewallRulesOperations -from .operations import KeysOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import PrivateLinkHubPrivateLinkResourcesOperations -from .operations import PrivateLinkHubsOperations -from .operations import PrivateEndpointConnectionsPrivateLinkHubOperations -from .operations import SqlPoolsOperations -from .operations import SqlPoolMetadataSyncConfigsOperations -from .operations import SqlPoolOperationResultsOperations -from .operations import SqlPoolGeoBackupPoliciesOperations -from .operations import SqlPoolDataWarehouseUserActivitiesOperations -from .operations import SqlPoolRestorePointsOperations -from .operations import SqlPoolReplicationLinksOperations -from .operations import SqlPoolMaintenanceWindowsOperations -from .operations import SqlPoolMaintenanceWindowOptionsOperations -from .operations import SqlPoolTransparentDataEncryptionsOperations -from .operations import SqlPoolBlobAuditingPoliciesOperations -from .operations import SqlPoolOperationsOperations -from .operations import SqlPoolUsagesOperations -from .operations import SqlPoolSensitivityLabelsOperations -from .operations import SqlPoolRecommendedSensitivityLabelsOperations -from .operations import SqlPoolSchemasOperations -from .operations import SqlPoolTablesOperations -from .operations import SqlPoolTableColumnsOperations -from .operations import SqlPoolConnectionPoliciesOperations -from .operations import SqlPoolVulnerabilityAssessmentsOperations -from .operations import SqlPoolVulnerabilityAssessmentScansOperations -from .operations import SqlPoolSecurityAlertPoliciesOperations -from .operations import SqlPoolVulnerabilityAssessmentRuleBaselinesOperations -from .operations import ExtendedSqlPoolBlobAuditingPoliciesOperations -from .operations import DataMaskingPoliciesOperations -from .operations import DataMaskingRulesOperations -from .operations import SqlPoolColumnsOperations -from .operations import SqlPoolWorkloadGroupOperations -from .operations import SqlPoolWorkloadClassifierOperations -from .operations import WorkspaceManagedSqlServerBlobAuditingPoliciesOperations -from .operations import WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations -from .operations import WorkspaceManagedSqlServerSecurityAlertPolicyOperations -from .operations import WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations -from .operations import WorkspaceManagedSqlServerEncryptionProtectorOperations -from .operations import WorkspaceManagedSqlServerUsagesOperations -from .operations import WorkspaceManagedSqlServerRecoverableSqlPoolsOperations -from .operations import WorkspacesOperations -from .operations import WorkspaceAadAdminsOperations -from .operations import WorkspaceSqlAadAdminsOperations -from .operations import WorkspaceManagedIdentitySqlControlSettingsOperations -from .operations import RestorableDroppedSqlPoolsOperations -from .operations import BigDataPoolsOperations -from .operations import LibraryOperations -from .operations import LibrariesOperations -from .operations import IntegrationRuntimesOperations -from .operations import IntegrationRuntimeNodeIpAddressOperations -from .operations import IntegrationRuntimeObjectMetadataOperations -from .operations import IntegrationRuntimeNodesOperations -from .operations import IntegrationRuntimeCredentialsOperations -from .operations import IntegrationRuntimeConnectionInfosOperations -from .operations import IntegrationRuntimeAuthKeysOperations -from .operations import IntegrationRuntimeMonitoringDataOperations -from .operations import IntegrationRuntimeStatusOperations -from .operations import SparkConfigurationOperations -from .operations import SparkConfigurationsOperations -from .operations import KustoOperationsOperations -from .operations import KustoPoolsOperations -from .operations import KustoPoolChildResourceOperations -from .operations import KustoPoolAttachedDatabaseConfigurationsOperations -from .operations import KustoPoolDatabasesOperations -from .operations import KustoPoolDataConnectionsOperations -from .operations import KustoPoolPrincipalAssignmentsOperations -from .operations import KustoPoolDatabasePrincipalAssignmentsOperations -from . import models - -class SynapseManagementClient(object): +class SynapseManagementClient: """Azure Synapse Analytics Management Client. :ivar azure_ad_only_authentications: AzureADOnlyAuthenticationsOperations operations - :vartype azure_ad_only_authentications: azure.mgmt.synapse.operations.AzureADOnlyAuthenticationsOperations + :vartype azure_ad_only_authentications: + azure.mgmt.synapse.operations.AzureADOnlyAuthenticationsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.synapse.operations.Operations :ivar ip_firewall_rules: IpFirewallRulesOperations operations @@ -106,45 +34,64 @@ class SynapseManagementClient(object): :ivar keys: KeysOperations operations :vartype keys: azure.mgmt.synapse.operations.KeysOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.synapse.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.synapse.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.synapse.operations.PrivateLinkResourcesOperations - :ivar private_link_hub_private_link_resources: PrivateLinkHubPrivateLinkResourcesOperations operations - :vartype private_link_hub_private_link_resources: azure.mgmt.synapse.operations.PrivateLinkHubPrivateLinkResourcesOperations + :ivar private_link_hub_private_link_resources: PrivateLinkHubPrivateLinkResourcesOperations + operations + :vartype private_link_hub_private_link_resources: + azure.mgmt.synapse.operations.PrivateLinkHubPrivateLinkResourcesOperations :ivar private_link_hubs: PrivateLinkHubsOperations operations :vartype private_link_hubs: azure.mgmt.synapse.operations.PrivateLinkHubsOperations - :ivar private_endpoint_connections_private_link_hub: PrivateEndpointConnectionsPrivateLinkHubOperations operations - :vartype private_endpoint_connections_private_link_hub: azure.mgmt.synapse.operations.PrivateEndpointConnectionsPrivateLinkHubOperations + :ivar private_endpoint_connections_private_link_hub: + PrivateEndpointConnectionsPrivateLinkHubOperations operations + :vartype private_endpoint_connections_private_link_hub: + azure.mgmt.synapse.operations.PrivateEndpointConnectionsPrivateLinkHubOperations :ivar sql_pools: SqlPoolsOperations operations :vartype sql_pools: azure.mgmt.synapse.operations.SqlPoolsOperations :ivar sql_pool_metadata_sync_configs: SqlPoolMetadataSyncConfigsOperations operations - :vartype sql_pool_metadata_sync_configs: azure.mgmt.synapse.operations.SqlPoolMetadataSyncConfigsOperations + :vartype sql_pool_metadata_sync_configs: + azure.mgmt.synapse.operations.SqlPoolMetadataSyncConfigsOperations :ivar sql_pool_operation_results: SqlPoolOperationResultsOperations operations - :vartype sql_pool_operation_results: azure.mgmt.synapse.operations.SqlPoolOperationResultsOperations + :vartype sql_pool_operation_results: + azure.mgmt.synapse.operations.SqlPoolOperationResultsOperations :ivar sql_pool_geo_backup_policies: SqlPoolGeoBackupPoliciesOperations operations - :vartype sql_pool_geo_backup_policies: azure.mgmt.synapse.operations.SqlPoolGeoBackupPoliciesOperations - :ivar sql_pool_data_warehouse_user_activities: SqlPoolDataWarehouseUserActivitiesOperations operations - :vartype sql_pool_data_warehouse_user_activities: azure.mgmt.synapse.operations.SqlPoolDataWarehouseUserActivitiesOperations + :vartype sql_pool_geo_backup_policies: + azure.mgmt.synapse.operations.SqlPoolGeoBackupPoliciesOperations + :ivar sql_pool_data_warehouse_user_activities: SqlPoolDataWarehouseUserActivitiesOperations + operations + :vartype sql_pool_data_warehouse_user_activities: + azure.mgmt.synapse.operations.SqlPoolDataWarehouseUserActivitiesOperations :ivar sql_pool_restore_points: SqlPoolRestorePointsOperations operations :vartype sql_pool_restore_points: azure.mgmt.synapse.operations.SqlPoolRestorePointsOperations :ivar sql_pool_replication_links: SqlPoolReplicationLinksOperations operations - :vartype sql_pool_replication_links: azure.mgmt.synapse.operations.SqlPoolReplicationLinksOperations + :vartype sql_pool_replication_links: + azure.mgmt.synapse.operations.SqlPoolReplicationLinksOperations :ivar sql_pool_maintenance_windows: SqlPoolMaintenanceWindowsOperations operations - :vartype sql_pool_maintenance_windows: azure.mgmt.synapse.operations.SqlPoolMaintenanceWindowsOperations + :vartype sql_pool_maintenance_windows: + azure.mgmt.synapse.operations.SqlPoolMaintenanceWindowsOperations :ivar sql_pool_maintenance_window_options: SqlPoolMaintenanceWindowOptionsOperations operations - :vartype sql_pool_maintenance_window_options: azure.mgmt.synapse.operations.SqlPoolMaintenanceWindowOptionsOperations - :ivar sql_pool_transparent_data_encryptions: SqlPoolTransparentDataEncryptionsOperations operations - :vartype sql_pool_transparent_data_encryptions: azure.mgmt.synapse.operations.SqlPoolTransparentDataEncryptionsOperations + :vartype sql_pool_maintenance_window_options: + azure.mgmt.synapse.operations.SqlPoolMaintenanceWindowOptionsOperations + :ivar sql_pool_transparent_data_encryptions: SqlPoolTransparentDataEncryptionsOperations + operations + :vartype sql_pool_transparent_data_encryptions: + azure.mgmt.synapse.operations.SqlPoolTransparentDataEncryptionsOperations :ivar sql_pool_blob_auditing_policies: SqlPoolBlobAuditingPoliciesOperations operations - :vartype sql_pool_blob_auditing_policies: azure.mgmt.synapse.operations.SqlPoolBlobAuditingPoliciesOperations + :vartype sql_pool_blob_auditing_policies: + azure.mgmt.synapse.operations.SqlPoolBlobAuditingPoliciesOperations :ivar sql_pool_operations: SqlPoolOperationsOperations operations :vartype sql_pool_operations: azure.mgmt.synapse.operations.SqlPoolOperationsOperations :ivar sql_pool_usages: SqlPoolUsagesOperations operations :vartype sql_pool_usages: azure.mgmt.synapse.operations.SqlPoolUsagesOperations :ivar sql_pool_sensitivity_labels: SqlPoolSensitivityLabelsOperations operations - :vartype sql_pool_sensitivity_labels: azure.mgmt.synapse.operations.SqlPoolSensitivityLabelsOperations - :ivar sql_pool_recommended_sensitivity_labels: SqlPoolRecommendedSensitivityLabelsOperations operations - :vartype sql_pool_recommended_sensitivity_labels: azure.mgmt.synapse.operations.SqlPoolRecommendedSensitivityLabelsOperations + :vartype sql_pool_sensitivity_labels: + azure.mgmt.synapse.operations.SqlPoolSensitivityLabelsOperations + :ivar sql_pool_recommended_sensitivity_labels: SqlPoolRecommendedSensitivityLabelsOperations + operations + :vartype sql_pool_recommended_sensitivity_labels: + azure.mgmt.synapse.operations.SqlPoolRecommendedSensitivityLabelsOperations :ivar sql_pool_schemas: SqlPoolSchemasOperations operations :vartype sql_pool_schemas: azure.mgmt.synapse.operations.SqlPoolSchemasOperations :ivar sql_pool_tables: SqlPoolTablesOperations operations @@ -152,17 +99,26 @@ class SynapseManagementClient(object): :ivar sql_pool_table_columns: SqlPoolTableColumnsOperations operations :vartype sql_pool_table_columns: azure.mgmt.synapse.operations.SqlPoolTableColumnsOperations :ivar sql_pool_connection_policies: SqlPoolConnectionPoliciesOperations operations - :vartype sql_pool_connection_policies: azure.mgmt.synapse.operations.SqlPoolConnectionPoliciesOperations + :vartype sql_pool_connection_policies: + azure.mgmt.synapse.operations.SqlPoolConnectionPoliciesOperations :ivar sql_pool_vulnerability_assessments: SqlPoolVulnerabilityAssessmentsOperations operations - :vartype sql_pool_vulnerability_assessments: azure.mgmt.synapse.operations.SqlPoolVulnerabilityAssessmentsOperations - :ivar sql_pool_vulnerability_assessment_scans: SqlPoolVulnerabilityAssessmentScansOperations operations - :vartype sql_pool_vulnerability_assessment_scans: azure.mgmt.synapse.operations.SqlPoolVulnerabilityAssessmentScansOperations + :vartype sql_pool_vulnerability_assessments: + azure.mgmt.synapse.operations.SqlPoolVulnerabilityAssessmentsOperations + :ivar sql_pool_vulnerability_assessment_scans: SqlPoolVulnerabilityAssessmentScansOperations + operations + :vartype sql_pool_vulnerability_assessment_scans: + azure.mgmt.synapse.operations.SqlPoolVulnerabilityAssessmentScansOperations :ivar sql_pool_security_alert_policies: SqlPoolSecurityAlertPoliciesOperations operations - :vartype sql_pool_security_alert_policies: azure.mgmt.synapse.operations.SqlPoolSecurityAlertPoliciesOperations - :ivar sql_pool_vulnerability_assessment_rule_baselines: SqlPoolVulnerabilityAssessmentRuleBaselinesOperations operations - :vartype sql_pool_vulnerability_assessment_rule_baselines: azure.mgmt.synapse.operations.SqlPoolVulnerabilityAssessmentRuleBaselinesOperations - :ivar extended_sql_pool_blob_auditing_policies: ExtendedSqlPoolBlobAuditingPoliciesOperations operations - :vartype extended_sql_pool_blob_auditing_policies: azure.mgmt.synapse.operations.ExtendedSqlPoolBlobAuditingPoliciesOperations + :vartype sql_pool_security_alert_policies: + azure.mgmt.synapse.operations.SqlPoolSecurityAlertPoliciesOperations + :ivar sql_pool_vulnerability_assessment_rule_baselines: + SqlPoolVulnerabilityAssessmentRuleBaselinesOperations operations + :vartype sql_pool_vulnerability_assessment_rule_baselines: + azure.mgmt.synapse.operations.SqlPoolVulnerabilityAssessmentRuleBaselinesOperations + :ivar extended_sql_pool_blob_auditing_policies: ExtendedSqlPoolBlobAuditingPoliciesOperations + operations + :vartype extended_sql_pool_blob_auditing_policies: + azure.mgmt.synapse.operations.ExtendedSqlPoolBlobAuditingPoliciesOperations :ivar data_masking_policies: DataMaskingPoliciesOperations operations :vartype data_masking_policies: azure.mgmt.synapse.operations.DataMaskingPoliciesOperations :ivar data_masking_rules: DataMaskingRulesOperations operations @@ -172,31 +128,49 @@ class SynapseManagementClient(object): :ivar sql_pool_workload_group: SqlPoolWorkloadGroupOperations operations :vartype sql_pool_workload_group: azure.mgmt.synapse.operations.SqlPoolWorkloadGroupOperations :ivar sql_pool_workload_classifier: SqlPoolWorkloadClassifierOperations operations - :vartype sql_pool_workload_classifier: azure.mgmt.synapse.operations.SqlPoolWorkloadClassifierOperations - :ivar workspace_managed_sql_server_blob_auditing_policies: WorkspaceManagedSqlServerBlobAuditingPoliciesOperations operations - :vartype workspace_managed_sql_server_blob_auditing_policies: azure.mgmt.synapse.operations.WorkspaceManagedSqlServerBlobAuditingPoliciesOperations - :ivar workspace_managed_sql_server_extended_blob_auditing_policies: WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations operations - :vartype workspace_managed_sql_server_extended_blob_auditing_policies: azure.mgmt.synapse.operations.WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations - :ivar workspace_managed_sql_server_security_alert_policy: WorkspaceManagedSqlServerSecurityAlertPolicyOperations operations - :vartype workspace_managed_sql_server_security_alert_policy: azure.mgmt.synapse.operations.WorkspaceManagedSqlServerSecurityAlertPolicyOperations - :ivar workspace_managed_sql_server_vulnerability_assessments: WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations operations - :vartype workspace_managed_sql_server_vulnerability_assessments: azure.mgmt.synapse.operations.WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations - :ivar workspace_managed_sql_server_encryption_protector: WorkspaceManagedSqlServerEncryptionProtectorOperations operations - :vartype workspace_managed_sql_server_encryption_protector: azure.mgmt.synapse.operations.WorkspaceManagedSqlServerEncryptionProtectorOperations + :vartype sql_pool_workload_classifier: + azure.mgmt.synapse.operations.SqlPoolWorkloadClassifierOperations + :ivar workspace_managed_sql_server_blob_auditing_policies: + WorkspaceManagedSqlServerBlobAuditingPoliciesOperations operations + :vartype workspace_managed_sql_server_blob_auditing_policies: + azure.mgmt.synapse.operations.WorkspaceManagedSqlServerBlobAuditingPoliciesOperations + :ivar workspace_managed_sql_server_extended_blob_auditing_policies: + WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations operations + :vartype workspace_managed_sql_server_extended_blob_auditing_policies: + azure.mgmt.synapse.operations.WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations + :ivar workspace_managed_sql_server_security_alert_policy: + WorkspaceManagedSqlServerSecurityAlertPolicyOperations operations + :vartype workspace_managed_sql_server_security_alert_policy: + azure.mgmt.synapse.operations.WorkspaceManagedSqlServerSecurityAlertPolicyOperations + :ivar workspace_managed_sql_server_vulnerability_assessments: + WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations operations + :vartype workspace_managed_sql_server_vulnerability_assessments: + azure.mgmt.synapse.operations.WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations + :ivar workspace_managed_sql_server_encryption_protector: + WorkspaceManagedSqlServerEncryptionProtectorOperations operations + :vartype workspace_managed_sql_server_encryption_protector: + azure.mgmt.synapse.operations.WorkspaceManagedSqlServerEncryptionProtectorOperations :ivar workspace_managed_sql_server_usages: WorkspaceManagedSqlServerUsagesOperations operations - :vartype workspace_managed_sql_server_usages: azure.mgmt.synapse.operations.WorkspaceManagedSqlServerUsagesOperations - :ivar workspace_managed_sql_server_recoverable_sql_pools: WorkspaceManagedSqlServerRecoverableSqlPoolsOperations operations - :vartype workspace_managed_sql_server_recoverable_sql_pools: azure.mgmt.synapse.operations.WorkspaceManagedSqlServerRecoverableSqlPoolsOperations + :vartype workspace_managed_sql_server_usages: + azure.mgmt.synapse.operations.WorkspaceManagedSqlServerUsagesOperations + :ivar workspace_managed_sql_server_recoverable_sql_pools: + WorkspaceManagedSqlServerRecoverableSqlPoolsOperations operations + :vartype workspace_managed_sql_server_recoverable_sql_pools: + azure.mgmt.synapse.operations.WorkspaceManagedSqlServerRecoverableSqlPoolsOperations :ivar workspaces: WorkspacesOperations operations :vartype workspaces: azure.mgmt.synapse.operations.WorkspacesOperations :ivar workspace_aad_admins: WorkspaceAadAdminsOperations operations :vartype workspace_aad_admins: azure.mgmt.synapse.operations.WorkspaceAadAdminsOperations :ivar workspace_sql_aad_admins: WorkspaceSqlAadAdminsOperations operations - :vartype workspace_sql_aad_admins: azure.mgmt.synapse.operations.WorkspaceSqlAadAdminsOperations - :ivar workspace_managed_identity_sql_control_settings: WorkspaceManagedIdentitySqlControlSettingsOperations operations - :vartype workspace_managed_identity_sql_control_settings: azure.mgmt.synapse.operations.WorkspaceManagedIdentitySqlControlSettingsOperations + :vartype workspace_sql_aad_admins: + azure.mgmt.synapse.operations.WorkspaceSqlAadAdminsOperations + :ivar workspace_managed_identity_sql_control_settings: + WorkspaceManagedIdentitySqlControlSettingsOperations operations + :vartype workspace_managed_identity_sql_control_settings: + azure.mgmt.synapse.operations.WorkspaceManagedIdentitySqlControlSettingsOperations :ivar restorable_dropped_sql_pools: RestorableDroppedSqlPoolsOperations operations - :vartype restorable_dropped_sql_pools: azure.mgmt.synapse.operations.RestorableDroppedSqlPoolsOperations + :vartype restorable_dropped_sql_pools: + azure.mgmt.synapse.operations.RestorableDroppedSqlPoolsOperations :ivar big_data_pools: BigDataPoolsOperations operations :vartype big_data_pools: azure.mgmt.synapse.operations.BigDataPoolsOperations :ivar library: LibraryOperations operations @@ -206,21 +180,32 @@ class SynapseManagementClient(object): :ivar integration_runtimes: IntegrationRuntimesOperations operations :vartype integration_runtimes: azure.mgmt.synapse.operations.IntegrationRuntimesOperations :ivar integration_runtime_node_ip_address: IntegrationRuntimeNodeIpAddressOperations operations - :vartype integration_runtime_node_ip_address: azure.mgmt.synapse.operations.IntegrationRuntimeNodeIpAddressOperations - :ivar integration_runtime_object_metadata: IntegrationRuntimeObjectMetadataOperations operations - :vartype integration_runtime_object_metadata: azure.mgmt.synapse.operations.IntegrationRuntimeObjectMetadataOperations + :vartype integration_runtime_node_ip_address: + azure.mgmt.synapse.operations.IntegrationRuntimeNodeIpAddressOperations + :ivar integration_runtime_object_metadata: IntegrationRuntimeObjectMetadataOperations + operations + :vartype integration_runtime_object_metadata: + azure.mgmt.synapse.operations.IntegrationRuntimeObjectMetadataOperations :ivar integration_runtime_nodes: IntegrationRuntimeNodesOperations operations - :vartype integration_runtime_nodes: azure.mgmt.synapse.operations.IntegrationRuntimeNodesOperations + :vartype integration_runtime_nodes: + azure.mgmt.synapse.operations.IntegrationRuntimeNodesOperations :ivar integration_runtime_credentials: IntegrationRuntimeCredentialsOperations operations - :vartype integration_runtime_credentials: azure.mgmt.synapse.operations.IntegrationRuntimeCredentialsOperations - :ivar integration_runtime_connection_infos: IntegrationRuntimeConnectionInfosOperations operations - :vartype integration_runtime_connection_infos: azure.mgmt.synapse.operations.IntegrationRuntimeConnectionInfosOperations + :vartype integration_runtime_credentials: + azure.mgmt.synapse.operations.IntegrationRuntimeCredentialsOperations + :ivar integration_runtime_connection_infos: IntegrationRuntimeConnectionInfosOperations + operations + :vartype integration_runtime_connection_infos: + azure.mgmt.synapse.operations.IntegrationRuntimeConnectionInfosOperations :ivar integration_runtime_auth_keys: IntegrationRuntimeAuthKeysOperations operations - :vartype integration_runtime_auth_keys: azure.mgmt.synapse.operations.IntegrationRuntimeAuthKeysOperations - :ivar integration_runtime_monitoring_data: IntegrationRuntimeMonitoringDataOperations operations - :vartype integration_runtime_monitoring_data: azure.mgmt.synapse.operations.IntegrationRuntimeMonitoringDataOperations + :vartype integration_runtime_auth_keys: + azure.mgmt.synapse.operations.IntegrationRuntimeAuthKeysOperations + :ivar integration_runtime_monitoring_data: IntegrationRuntimeMonitoringDataOperations + operations + :vartype integration_runtime_monitoring_data: + azure.mgmt.synapse.operations.IntegrationRuntimeMonitoringDataOperations :ivar integration_runtime_status: IntegrationRuntimeStatusOperations operations - :vartype integration_runtime_status: azure.mgmt.synapse.operations.IntegrationRuntimeStatusOperations + :vartype integration_runtime_status: + azure.mgmt.synapse.operations.IntegrationRuntimeStatusOperations :ivar spark_configuration: SparkConfigurationOperations operations :vartype spark_configuration: azure.mgmt.synapse.operations.SparkConfigurationOperations :ivar spark_configurations: SparkConfigurationsOperations operations @@ -230,205 +215,147 @@ class SynapseManagementClient(object): :ivar kusto_pools: KustoPoolsOperations operations :vartype kusto_pools: azure.mgmt.synapse.operations.KustoPoolsOperations :ivar kusto_pool_child_resource: KustoPoolChildResourceOperations operations - :vartype kusto_pool_child_resource: azure.mgmt.synapse.operations.KustoPoolChildResourceOperations - :ivar kusto_pool_attached_database_configurations: KustoPoolAttachedDatabaseConfigurationsOperations operations - :vartype kusto_pool_attached_database_configurations: azure.mgmt.synapse.operations.KustoPoolAttachedDatabaseConfigurationsOperations + :vartype kusto_pool_child_resource: + azure.mgmt.synapse.operations.KustoPoolChildResourceOperations + :ivar kusto_pool_attached_database_configurations: + KustoPoolAttachedDatabaseConfigurationsOperations operations + :vartype kusto_pool_attached_database_configurations: + azure.mgmt.synapse.operations.KustoPoolAttachedDatabaseConfigurationsOperations :ivar kusto_pool_databases: KustoPoolDatabasesOperations operations :vartype kusto_pool_databases: azure.mgmt.synapse.operations.KustoPoolDatabasesOperations :ivar kusto_pool_data_connections: KustoPoolDataConnectionsOperations operations - :vartype kusto_pool_data_connections: azure.mgmt.synapse.operations.KustoPoolDataConnectionsOperations + :vartype kusto_pool_data_connections: + azure.mgmt.synapse.operations.KustoPoolDataConnectionsOperations :ivar kusto_pool_principal_assignments: KustoPoolPrincipalAssignmentsOperations operations - :vartype kusto_pool_principal_assignments: azure.mgmt.synapse.operations.KustoPoolPrincipalAssignmentsOperations - :ivar kusto_pool_database_principal_assignments: KustoPoolDatabasePrincipalAssignmentsOperations operations - :vartype kusto_pool_database_principal_assignments: azure.mgmt.synapse.operations.KustoPoolDatabasePrincipalAssignmentsOperations + :vartype kusto_pool_principal_assignments: + azure.mgmt.synapse.operations.KustoPoolPrincipalAssignmentsOperations + :ivar kusto_pool_database_principal_assignments: + KustoPoolDatabasePrincipalAssignmentsOperations operations + :vartype kusto_pool_database_principal_assignments: + azure.mgmt.synapse.operations.KustoPoolDatabasePrincipalAssignmentsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = SynapseManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SynapseManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.azure_ad_only_authentications = AzureADOnlyAuthenticationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.ip_firewall_rules = IpFirewallRulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.keys = KeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_hub_private_link_resources = PrivateLinkHubPrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_hubs = PrivateLinkHubsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections_private_link_hub = PrivateEndpointConnectionsPrivateLinkHubOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pools = SqlPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_metadata_sync_configs = SqlPoolMetadataSyncConfigsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_operation_results = SqlPoolOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_geo_backup_policies = SqlPoolGeoBackupPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_data_warehouse_user_activities = SqlPoolDataWarehouseUserActivitiesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_restore_points = SqlPoolRestorePointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_replication_links = SqlPoolReplicationLinksOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_maintenance_windows = SqlPoolMaintenanceWindowsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_maintenance_window_options = SqlPoolMaintenanceWindowOptionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_transparent_data_encryptions = SqlPoolTransparentDataEncryptionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_blob_auditing_policies = SqlPoolBlobAuditingPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_operations = SqlPoolOperationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_usages = SqlPoolUsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_sensitivity_labels = SqlPoolSensitivityLabelsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_recommended_sensitivity_labels = SqlPoolRecommendedSensitivityLabelsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_schemas = SqlPoolSchemasOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_tables = SqlPoolTablesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_table_columns = SqlPoolTableColumnsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_connection_policies = SqlPoolConnectionPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_vulnerability_assessments = SqlPoolVulnerabilityAssessmentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_vulnerability_assessment_scans = SqlPoolVulnerabilityAssessmentScansOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_security_alert_policies = SqlPoolSecurityAlertPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_vulnerability_assessment_rule_baselines = SqlPoolVulnerabilityAssessmentRuleBaselinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.extended_sql_pool_blob_auditing_policies = ExtendedSqlPoolBlobAuditingPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.data_masking_policies = DataMaskingPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.data_masking_rules = DataMaskingRulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_columns = SqlPoolColumnsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_workload_group = SqlPoolWorkloadGroupOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_workload_classifier = SqlPoolWorkloadClassifierOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_managed_sql_server_blob_auditing_policies = WorkspaceManagedSqlServerBlobAuditingPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_managed_sql_server_extended_blob_auditing_policies = WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_managed_sql_server_security_alert_policy = WorkspaceManagedSqlServerSecurityAlertPolicyOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_managed_sql_server_vulnerability_assessments = WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_managed_sql_server_encryption_protector = WorkspaceManagedSqlServerEncryptionProtectorOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_managed_sql_server_usages = WorkspaceManagedSqlServerUsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_managed_sql_server_recoverable_sql_pools = WorkspaceManagedSqlServerRecoverableSqlPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_aad_admins = WorkspaceAadAdminsOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_sql_aad_admins = WorkspaceSqlAadAdminsOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_managed_identity_sql_control_settings = WorkspaceManagedIdentitySqlControlSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.restorable_dropped_sql_pools = RestorableDroppedSqlPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.big_data_pools = BigDataPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.library = LibraryOperations(self._client, self._config, self._serialize, self._deserialize) + self.libraries = LibrariesOperations(self._client, self._config, self._serialize, self._deserialize) + self.integration_runtimes = IntegrationRuntimesOperations(self._client, self._config, self._serialize, self._deserialize) + self.integration_runtime_node_ip_address = IntegrationRuntimeNodeIpAddressOperations(self._client, self._config, self._serialize, self._deserialize) + self.integration_runtime_object_metadata = IntegrationRuntimeObjectMetadataOperations(self._client, self._config, self._serialize, self._deserialize) + self.integration_runtime_nodes = IntegrationRuntimeNodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.integration_runtime_credentials = IntegrationRuntimeCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.integration_runtime_connection_infos = IntegrationRuntimeConnectionInfosOperations(self._client, self._config, self._serialize, self._deserialize) + self.integration_runtime_auth_keys = IntegrationRuntimeAuthKeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.integration_runtime_monitoring_data = IntegrationRuntimeMonitoringDataOperations(self._client, self._config, self._serialize, self._deserialize) + self.integration_runtime_status = IntegrationRuntimeStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.spark_configuration = SparkConfigurationOperations(self._client, self._config, self._serialize, self._deserialize) + self.spark_configurations = SparkConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.kusto_operations = KustoOperationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.kusto_pools = KustoPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_child_resource = KustoPoolChildResourceOperations(self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_attached_database_configurations = KustoPoolAttachedDatabaseConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_databases = KustoPoolDatabasesOperations(self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_data_connections = KustoPoolDataConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_principal_assignments = KustoPoolPrincipalAssignmentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_database_principal_assignments = KustoPoolDatabasePrincipalAssignmentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.azure_ad_only_authentications = AzureADOnlyAuthenticationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.ip_firewall_rules = IpFirewallRulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.keys = KeysOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_hub_private_link_resources = PrivateLinkHubPrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_hubs = PrivateLinkHubsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections_private_link_hub = PrivateEndpointConnectionsPrivateLinkHubOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pools = SqlPoolsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_metadata_sync_configs = SqlPoolMetadataSyncConfigsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_operation_results = SqlPoolOperationResultsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_geo_backup_policies = SqlPoolGeoBackupPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_data_warehouse_user_activities = SqlPoolDataWarehouseUserActivitiesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_restore_points = SqlPoolRestorePointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_replication_links = SqlPoolReplicationLinksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_maintenance_windows = SqlPoolMaintenanceWindowsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_maintenance_window_options = SqlPoolMaintenanceWindowOptionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_transparent_data_encryptions = SqlPoolTransparentDataEncryptionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_blob_auditing_policies = SqlPoolBlobAuditingPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_operations = SqlPoolOperationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_usages = SqlPoolUsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_sensitivity_labels = SqlPoolSensitivityLabelsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_recommended_sensitivity_labels = SqlPoolRecommendedSensitivityLabelsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_schemas = SqlPoolSchemasOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_tables = SqlPoolTablesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_table_columns = SqlPoolTableColumnsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_connection_policies = SqlPoolConnectionPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_vulnerability_assessments = SqlPoolVulnerabilityAssessmentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_vulnerability_assessment_scans = SqlPoolVulnerabilityAssessmentScansOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_security_alert_policies = SqlPoolSecurityAlertPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_vulnerability_assessment_rule_baselines = SqlPoolVulnerabilityAssessmentRuleBaselinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.extended_sql_pool_blob_auditing_policies = ExtendedSqlPoolBlobAuditingPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.data_masking_policies = DataMaskingPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.data_masking_rules = DataMaskingRulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_columns = SqlPoolColumnsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_workload_group = SqlPoolWorkloadGroupOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_workload_classifier = SqlPoolWorkloadClassifierOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspace_managed_sql_server_blob_auditing_policies = WorkspaceManagedSqlServerBlobAuditingPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspace_managed_sql_server_extended_blob_auditing_policies = WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspace_managed_sql_server_security_alert_policy = WorkspaceManagedSqlServerSecurityAlertPolicyOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspace_managed_sql_server_vulnerability_assessments = WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspace_managed_sql_server_encryption_protector = WorkspaceManagedSqlServerEncryptionProtectorOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspace_managed_sql_server_usages = WorkspaceManagedSqlServerUsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspace_managed_sql_server_recoverable_sql_pools = WorkspaceManagedSqlServerRecoverableSqlPoolsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspaces = WorkspacesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspace_aad_admins = WorkspaceAadAdminsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspace_sql_aad_admins = WorkspaceSqlAadAdminsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspace_managed_identity_sql_control_settings = WorkspaceManagedIdentitySqlControlSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.restorable_dropped_sql_pools = RestorableDroppedSqlPoolsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.big_data_pools = BigDataPoolsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.library = LibraryOperations( - self._client, self._config, self._serialize, self._deserialize) - self.libraries = LibrariesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.integration_runtimes = IntegrationRuntimesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.integration_runtime_node_ip_address = IntegrationRuntimeNodeIpAddressOperations( - self._client, self._config, self._serialize, self._deserialize) - self.integration_runtime_object_metadata = IntegrationRuntimeObjectMetadataOperations( - self._client, self._config, self._serialize, self._deserialize) - self.integration_runtime_nodes = IntegrationRuntimeNodesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.integration_runtime_credentials = IntegrationRuntimeCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.integration_runtime_connection_infos = IntegrationRuntimeConnectionInfosOperations( - self._client, self._config, self._serialize, self._deserialize) - self.integration_runtime_auth_keys = IntegrationRuntimeAuthKeysOperations( - self._client, self._config, self._serialize, self._deserialize) - self.integration_runtime_monitoring_data = IntegrationRuntimeMonitoringDataOperations( - self._client, self._config, self._serialize, self._deserialize) - self.integration_runtime_status = IntegrationRuntimeStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.spark_configuration = SparkConfigurationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.spark_configurations = SparkConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.kusto_operations = KustoOperationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.kusto_pools = KustoPoolsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.kusto_pool_child_resource = KustoPoolChildResourceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.kusto_pool_attached_database_configurations = KustoPoolAttachedDatabaseConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.kusto_pool_databases = KustoPoolDatabasesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.kusto_pool_data_connections = KustoPoolDataConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.kusto_pool_principal_assignments = KustoPoolPrincipalAssignmentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.kusto_pool_database_principal_assignments = KustoPoolDatabasePrincipalAssignmentsOperations( - self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_vendor.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_vendor.py new file mode 100644 index 0000000000000..138f663c53a4e --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_version.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_version.py index fdff35f9fc38b..e5754a47ce68f 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_version.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.1.0b3" +VERSION = "1.0.0b1" diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/__init__.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/__init__.py index 85258db367afa..e7037d2468dad 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/__init__.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/__init__.py @@ -8,3 +8,8 @@ from ._synapse_management_client import SynapseManagementClient __all__ = ['SynapseManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/_configuration.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/_configuration.py index 9fbd91145d212..0d065271b91ac 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/_configuration.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(SynapseManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(SynapseManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -63,4 +63,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/_patch.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/_synapse_management_client.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/_synapse_management_client.py index 6bf1df182f5ac..491aa6fa1b915 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/_synapse_management_client.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/_synapse_management_client.py @@ -6,97 +6,27 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import SynapseManagementClientConfiguration +from .operations import AzureADOnlyAuthenticationsOperations, BigDataPoolsOperations, DataMaskingPoliciesOperations, DataMaskingRulesOperations, ExtendedSqlPoolBlobAuditingPoliciesOperations, IntegrationRuntimeAuthKeysOperations, IntegrationRuntimeConnectionInfosOperations, IntegrationRuntimeCredentialsOperations, IntegrationRuntimeMonitoringDataOperations, IntegrationRuntimeNodeIpAddressOperations, IntegrationRuntimeNodesOperations, IntegrationRuntimeObjectMetadataOperations, IntegrationRuntimeStatusOperations, IntegrationRuntimesOperations, IpFirewallRulesOperations, KeysOperations, KustoOperationsOperations, KustoPoolAttachedDatabaseConfigurationsOperations, KustoPoolChildResourceOperations, KustoPoolDataConnectionsOperations, KustoPoolDatabasePrincipalAssignmentsOperations, KustoPoolDatabasesOperations, KustoPoolPrincipalAssignmentsOperations, KustoPoolsOperations, LibrariesOperations, LibraryOperations, Operations, PrivateEndpointConnectionsOperations, PrivateEndpointConnectionsPrivateLinkHubOperations, PrivateLinkHubPrivateLinkResourcesOperations, PrivateLinkHubsOperations, PrivateLinkResourcesOperations, RestorableDroppedSqlPoolsOperations, SparkConfigurationOperations, SparkConfigurationsOperations, SqlPoolBlobAuditingPoliciesOperations, SqlPoolColumnsOperations, SqlPoolConnectionPoliciesOperations, SqlPoolDataWarehouseUserActivitiesOperations, SqlPoolGeoBackupPoliciesOperations, SqlPoolMaintenanceWindowOptionsOperations, SqlPoolMaintenanceWindowsOperations, SqlPoolMetadataSyncConfigsOperations, SqlPoolOperationResultsOperations, SqlPoolOperationsOperations, SqlPoolRecommendedSensitivityLabelsOperations, SqlPoolReplicationLinksOperations, SqlPoolRestorePointsOperations, SqlPoolSchemasOperations, SqlPoolSecurityAlertPoliciesOperations, SqlPoolSensitivityLabelsOperations, SqlPoolTableColumnsOperations, SqlPoolTablesOperations, SqlPoolTransparentDataEncryptionsOperations, SqlPoolUsagesOperations, SqlPoolVulnerabilityAssessmentRuleBaselinesOperations, SqlPoolVulnerabilityAssessmentScansOperations, SqlPoolVulnerabilityAssessmentsOperations, SqlPoolWorkloadClassifierOperations, SqlPoolWorkloadGroupOperations, SqlPoolsOperations, WorkspaceAadAdminsOperations, WorkspaceManagedIdentitySqlControlSettingsOperations, WorkspaceManagedSqlServerBlobAuditingPoliciesOperations, WorkspaceManagedSqlServerEncryptionProtectorOperations, WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations, WorkspaceManagedSqlServerRecoverableSqlPoolsOperations, WorkspaceManagedSqlServerSecurityAlertPolicyOperations, WorkspaceManagedSqlServerUsagesOperations, WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations, WorkspaceSqlAadAdminsOperations, WorkspacesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import SynapseManagementClientConfiguration -from .operations import AzureADOnlyAuthenticationsOperations -from .operations import Operations -from .operations import IpFirewallRulesOperations -from .operations import KeysOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import PrivateLinkHubPrivateLinkResourcesOperations -from .operations import PrivateLinkHubsOperations -from .operations import PrivateEndpointConnectionsPrivateLinkHubOperations -from .operations import SqlPoolsOperations -from .operations import SqlPoolMetadataSyncConfigsOperations -from .operations import SqlPoolOperationResultsOperations -from .operations import SqlPoolGeoBackupPoliciesOperations -from .operations import SqlPoolDataWarehouseUserActivitiesOperations -from .operations import SqlPoolRestorePointsOperations -from .operations import SqlPoolReplicationLinksOperations -from .operations import SqlPoolMaintenanceWindowsOperations -from .operations import SqlPoolMaintenanceWindowOptionsOperations -from .operations import SqlPoolTransparentDataEncryptionsOperations -from .operations import SqlPoolBlobAuditingPoliciesOperations -from .operations import SqlPoolOperationsOperations -from .operations import SqlPoolUsagesOperations -from .operations import SqlPoolSensitivityLabelsOperations -from .operations import SqlPoolRecommendedSensitivityLabelsOperations -from .operations import SqlPoolSchemasOperations -from .operations import SqlPoolTablesOperations -from .operations import SqlPoolTableColumnsOperations -from .operations import SqlPoolConnectionPoliciesOperations -from .operations import SqlPoolVulnerabilityAssessmentsOperations -from .operations import SqlPoolVulnerabilityAssessmentScansOperations -from .operations import SqlPoolSecurityAlertPoliciesOperations -from .operations import SqlPoolVulnerabilityAssessmentRuleBaselinesOperations -from .operations import ExtendedSqlPoolBlobAuditingPoliciesOperations -from .operations import DataMaskingPoliciesOperations -from .operations import DataMaskingRulesOperations -from .operations import SqlPoolColumnsOperations -from .operations import SqlPoolWorkloadGroupOperations -from .operations import SqlPoolWorkloadClassifierOperations -from .operations import WorkspaceManagedSqlServerBlobAuditingPoliciesOperations -from .operations import WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations -from .operations import WorkspaceManagedSqlServerSecurityAlertPolicyOperations -from .operations import WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations -from .operations import WorkspaceManagedSqlServerEncryptionProtectorOperations -from .operations import WorkspaceManagedSqlServerUsagesOperations -from .operations import WorkspaceManagedSqlServerRecoverableSqlPoolsOperations -from .operations import WorkspacesOperations -from .operations import WorkspaceAadAdminsOperations -from .operations import WorkspaceSqlAadAdminsOperations -from .operations import WorkspaceManagedIdentitySqlControlSettingsOperations -from .operations import RestorableDroppedSqlPoolsOperations -from .operations import BigDataPoolsOperations -from .operations import LibraryOperations -from .operations import LibrariesOperations -from .operations import IntegrationRuntimesOperations -from .operations import IntegrationRuntimeNodeIpAddressOperations -from .operations import IntegrationRuntimeObjectMetadataOperations -from .operations import IntegrationRuntimeNodesOperations -from .operations import IntegrationRuntimeCredentialsOperations -from .operations import IntegrationRuntimeConnectionInfosOperations -from .operations import IntegrationRuntimeAuthKeysOperations -from .operations import IntegrationRuntimeMonitoringDataOperations -from .operations import IntegrationRuntimeStatusOperations -from .operations import SparkConfigurationOperations -from .operations import SparkConfigurationsOperations -from .operations import KustoOperationsOperations -from .operations import KustoPoolsOperations -from .operations import KustoPoolChildResourceOperations -from .operations import KustoPoolAttachedDatabaseConfigurationsOperations -from .operations import KustoPoolDatabasesOperations -from .operations import KustoPoolDataConnectionsOperations -from .operations import KustoPoolPrincipalAssignmentsOperations -from .operations import KustoPoolDatabasePrincipalAssignmentsOperations -from .. import models - - -class SynapseManagementClient(object): +class SynapseManagementClient: """Azure Synapse Analytics Management Client. :ivar azure_ad_only_authentications: AzureADOnlyAuthenticationsOperations operations - :vartype azure_ad_only_authentications: azure.mgmt.synapse.aio.operations.AzureADOnlyAuthenticationsOperations + :vartype azure_ad_only_authentications: + azure.mgmt.synapse.aio.operations.AzureADOnlyAuthenticationsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.synapse.aio.operations.Operations :ivar ip_firewall_rules: IpFirewallRulesOperations operations @@ -104,63 +34,94 @@ class SynapseManagementClient(object): :ivar keys: KeysOperations operations :vartype keys: azure.mgmt.synapse.aio.operations.KeysOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.synapse.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.synapse.aio.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.synapse.aio.operations.PrivateLinkResourcesOperations - :ivar private_link_hub_private_link_resources: PrivateLinkHubPrivateLinkResourcesOperations operations - :vartype private_link_hub_private_link_resources: azure.mgmt.synapse.aio.operations.PrivateLinkHubPrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.synapse.aio.operations.PrivateLinkResourcesOperations + :ivar private_link_hub_private_link_resources: PrivateLinkHubPrivateLinkResourcesOperations + operations + :vartype private_link_hub_private_link_resources: + azure.mgmt.synapse.aio.operations.PrivateLinkHubPrivateLinkResourcesOperations :ivar private_link_hubs: PrivateLinkHubsOperations operations :vartype private_link_hubs: azure.mgmt.synapse.aio.operations.PrivateLinkHubsOperations - :ivar private_endpoint_connections_private_link_hub: PrivateEndpointConnectionsPrivateLinkHubOperations operations - :vartype private_endpoint_connections_private_link_hub: azure.mgmt.synapse.aio.operations.PrivateEndpointConnectionsPrivateLinkHubOperations + :ivar private_endpoint_connections_private_link_hub: + PrivateEndpointConnectionsPrivateLinkHubOperations operations + :vartype private_endpoint_connections_private_link_hub: + azure.mgmt.synapse.aio.operations.PrivateEndpointConnectionsPrivateLinkHubOperations :ivar sql_pools: SqlPoolsOperations operations :vartype sql_pools: azure.mgmt.synapse.aio.operations.SqlPoolsOperations :ivar sql_pool_metadata_sync_configs: SqlPoolMetadataSyncConfigsOperations operations - :vartype sql_pool_metadata_sync_configs: azure.mgmt.synapse.aio.operations.SqlPoolMetadataSyncConfigsOperations + :vartype sql_pool_metadata_sync_configs: + azure.mgmt.synapse.aio.operations.SqlPoolMetadataSyncConfigsOperations :ivar sql_pool_operation_results: SqlPoolOperationResultsOperations operations - :vartype sql_pool_operation_results: azure.mgmt.synapse.aio.operations.SqlPoolOperationResultsOperations + :vartype sql_pool_operation_results: + azure.mgmt.synapse.aio.operations.SqlPoolOperationResultsOperations :ivar sql_pool_geo_backup_policies: SqlPoolGeoBackupPoliciesOperations operations - :vartype sql_pool_geo_backup_policies: azure.mgmt.synapse.aio.operations.SqlPoolGeoBackupPoliciesOperations - :ivar sql_pool_data_warehouse_user_activities: SqlPoolDataWarehouseUserActivitiesOperations operations - :vartype sql_pool_data_warehouse_user_activities: azure.mgmt.synapse.aio.operations.SqlPoolDataWarehouseUserActivitiesOperations + :vartype sql_pool_geo_backup_policies: + azure.mgmt.synapse.aio.operations.SqlPoolGeoBackupPoliciesOperations + :ivar sql_pool_data_warehouse_user_activities: SqlPoolDataWarehouseUserActivitiesOperations + operations + :vartype sql_pool_data_warehouse_user_activities: + azure.mgmt.synapse.aio.operations.SqlPoolDataWarehouseUserActivitiesOperations :ivar sql_pool_restore_points: SqlPoolRestorePointsOperations operations - :vartype sql_pool_restore_points: azure.mgmt.synapse.aio.operations.SqlPoolRestorePointsOperations + :vartype sql_pool_restore_points: + azure.mgmt.synapse.aio.operations.SqlPoolRestorePointsOperations :ivar sql_pool_replication_links: SqlPoolReplicationLinksOperations operations - :vartype sql_pool_replication_links: azure.mgmt.synapse.aio.operations.SqlPoolReplicationLinksOperations + :vartype sql_pool_replication_links: + azure.mgmt.synapse.aio.operations.SqlPoolReplicationLinksOperations :ivar sql_pool_maintenance_windows: SqlPoolMaintenanceWindowsOperations operations - :vartype sql_pool_maintenance_windows: azure.mgmt.synapse.aio.operations.SqlPoolMaintenanceWindowsOperations + :vartype sql_pool_maintenance_windows: + azure.mgmt.synapse.aio.operations.SqlPoolMaintenanceWindowsOperations :ivar sql_pool_maintenance_window_options: SqlPoolMaintenanceWindowOptionsOperations operations - :vartype sql_pool_maintenance_window_options: azure.mgmt.synapse.aio.operations.SqlPoolMaintenanceWindowOptionsOperations - :ivar sql_pool_transparent_data_encryptions: SqlPoolTransparentDataEncryptionsOperations operations - :vartype sql_pool_transparent_data_encryptions: azure.mgmt.synapse.aio.operations.SqlPoolTransparentDataEncryptionsOperations + :vartype sql_pool_maintenance_window_options: + azure.mgmt.synapse.aio.operations.SqlPoolMaintenanceWindowOptionsOperations + :ivar sql_pool_transparent_data_encryptions: SqlPoolTransparentDataEncryptionsOperations + operations + :vartype sql_pool_transparent_data_encryptions: + azure.mgmt.synapse.aio.operations.SqlPoolTransparentDataEncryptionsOperations :ivar sql_pool_blob_auditing_policies: SqlPoolBlobAuditingPoliciesOperations operations - :vartype sql_pool_blob_auditing_policies: azure.mgmt.synapse.aio.operations.SqlPoolBlobAuditingPoliciesOperations + :vartype sql_pool_blob_auditing_policies: + azure.mgmt.synapse.aio.operations.SqlPoolBlobAuditingPoliciesOperations :ivar sql_pool_operations: SqlPoolOperationsOperations operations :vartype sql_pool_operations: azure.mgmt.synapse.aio.operations.SqlPoolOperationsOperations :ivar sql_pool_usages: SqlPoolUsagesOperations operations :vartype sql_pool_usages: azure.mgmt.synapse.aio.operations.SqlPoolUsagesOperations :ivar sql_pool_sensitivity_labels: SqlPoolSensitivityLabelsOperations operations - :vartype sql_pool_sensitivity_labels: azure.mgmt.synapse.aio.operations.SqlPoolSensitivityLabelsOperations - :ivar sql_pool_recommended_sensitivity_labels: SqlPoolRecommendedSensitivityLabelsOperations operations - :vartype sql_pool_recommended_sensitivity_labels: azure.mgmt.synapse.aio.operations.SqlPoolRecommendedSensitivityLabelsOperations + :vartype sql_pool_sensitivity_labels: + azure.mgmt.synapse.aio.operations.SqlPoolSensitivityLabelsOperations + :ivar sql_pool_recommended_sensitivity_labels: SqlPoolRecommendedSensitivityLabelsOperations + operations + :vartype sql_pool_recommended_sensitivity_labels: + azure.mgmt.synapse.aio.operations.SqlPoolRecommendedSensitivityLabelsOperations :ivar sql_pool_schemas: SqlPoolSchemasOperations operations :vartype sql_pool_schemas: azure.mgmt.synapse.aio.operations.SqlPoolSchemasOperations :ivar sql_pool_tables: SqlPoolTablesOperations operations :vartype sql_pool_tables: azure.mgmt.synapse.aio.operations.SqlPoolTablesOperations :ivar sql_pool_table_columns: SqlPoolTableColumnsOperations operations - :vartype sql_pool_table_columns: azure.mgmt.synapse.aio.operations.SqlPoolTableColumnsOperations + :vartype sql_pool_table_columns: + azure.mgmt.synapse.aio.operations.SqlPoolTableColumnsOperations :ivar sql_pool_connection_policies: SqlPoolConnectionPoliciesOperations operations - :vartype sql_pool_connection_policies: azure.mgmt.synapse.aio.operations.SqlPoolConnectionPoliciesOperations + :vartype sql_pool_connection_policies: + azure.mgmt.synapse.aio.operations.SqlPoolConnectionPoliciesOperations :ivar sql_pool_vulnerability_assessments: SqlPoolVulnerabilityAssessmentsOperations operations - :vartype sql_pool_vulnerability_assessments: azure.mgmt.synapse.aio.operations.SqlPoolVulnerabilityAssessmentsOperations - :ivar sql_pool_vulnerability_assessment_scans: SqlPoolVulnerabilityAssessmentScansOperations operations - :vartype sql_pool_vulnerability_assessment_scans: azure.mgmt.synapse.aio.operations.SqlPoolVulnerabilityAssessmentScansOperations + :vartype sql_pool_vulnerability_assessments: + azure.mgmt.synapse.aio.operations.SqlPoolVulnerabilityAssessmentsOperations + :ivar sql_pool_vulnerability_assessment_scans: SqlPoolVulnerabilityAssessmentScansOperations + operations + :vartype sql_pool_vulnerability_assessment_scans: + azure.mgmt.synapse.aio.operations.SqlPoolVulnerabilityAssessmentScansOperations :ivar sql_pool_security_alert_policies: SqlPoolSecurityAlertPoliciesOperations operations - :vartype sql_pool_security_alert_policies: azure.mgmt.synapse.aio.operations.SqlPoolSecurityAlertPoliciesOperations - :ivar sql_pool_vulnerability_assessment_rule_baselines: SqlPoolVulnerabilityAssessmentRuleBaselinesOperations operations - :vartype sql_pool_vulnerability_assessment_rule_baselines: azure.mgmt.synapse.aio.operations.SqlPoolVulnerabilityAssessmentRuleBaselinesOperations - :ivar extended_sql_pool_blob_auditing_policies: ExtendedSqlPoolBlobAuditingPoliciesOperations operations - :vartype extended_sql_pool_blob_auditing_policies: azure.mgmt.synapse.aio.operations.ExtendedSqlPoolBlobAuditingPoliciesOperations + :vartype sql_pool_security_alert_policies: + azure.mgmt.synapse.aio.operations.SqlPoolSecurityAlertPoliciesOperations + :ivar sql_pool_vulnerability_assessment_rule_baselines: + SqlPoolVulnerabilityAssessmentRuleBaselinesOperations operations + :vartype sql_pool_vulnerability_assessment_rule_baselines: + azure.mgmt.synapse.aio.operations.SqlPoolVulnerabilityAssessmentRuleBaselinesOperations + :ivar extended_sql_pool_blob_auditing_policies: ExtendedSqlPoolBlobAuditingPoliciesOperations + operations + :vartype extended_sql_pool_blob_auditing_policies: + azure.mgmt.synapse.aio.operations.ExtendedSqlPoolBlobAuditingPoliciesOperations :ivar data_masking_policies: DataMaskingPoliciesOperations operations :vartype data_masking_policies: azure.mgmt.synapse.aio.operations.DataMaskingPoliciesOperations :ivar data_masking_rules: DataMaskingRulesOperations operations @@ -168,33 +129,52 @@ class SynapseManagementClient(object): :ivar sql_pool_columns: SqlPoolColumnsOperations operations :vartype sql_pool_columns: azure.mgmt.synapse.aio.operations.SqlPoolColumnsOperations :ivar sql_pool_workload_group: SqlPoolWorkloadGroupOperations operations - :vartype sql_pool_workload_group: azure.mgmt.synapse.aio.operations.SqlPoolWorkloadGroupOperations + :vartype sql_pool_workload_group: + azure.mgmt.synapse.aio.operations.SqlPoolWorkloadGroupOperations :ivar sql_pool_workload_classifier: SqlPoolWorkloadClassifierOperations operations - :vartype sql_pool_workload_classifier: azure.mgmt.synapse.aio.operations.SqlPoolWorkloadClassifierOperations - :ivar workspace_managed_sql_server_blob_auditing_policies: WorkspaceManagedSqlServerBlobAuditingPoliciesOperations operations - :vartype workspace_managed_sql_server_blob_auditing_policies: azure.mgmt.synapse.aio.operations.WorkspaceManagedSqlServerBlobAuditingPoliciesOperations - :ivar workspace_managed_sql_server_extended_blob_auditing_policies: WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations operations - :vartype workspace_managed_sql_server_extended_blob_auditing_policies: azure.mgmt.synapse.aio.operations.WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations - :ivar workspace_managed_sql_server_security_alert_policy: WorkspaceManagedSqlServerSecurityAlertPolicyOperations operations - :vartype workspace_managed_sql_server_security_alert_policy: azure.mgmt.synapse.aio.operations.WorkspaceManagedSqlServerSecurityAlertPolicyOperations - :ivar workspace_managed_sql_server_vulnerability_assessments: WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations operations - :vartype workspace_managed_sql_server_vulnerability_assessments: azure.mgmt.synapse.aio.operations.WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations - :ivar workspace_managed_sql_server_encryption_protector: WorkspaceManagedSqlServerEncryptionProtectorOperations operations - :vartype workspace_managed_sql_server_encryption_protector: azure.mgmt.synapse.aio.operations.WorkspaceManagedSqlServerEncryptionProtectorOperations + :vartype sql_pool_workload_classifier: + azure.mgmt.synapse.aio.operations.SqlPoolWorkloadClassifierOperations + :ivar workspace_managed_sql_server_blob_auditing_policies: + WorkspaceManagedSqlServerBlobAuditingPoliciesOperations operations + :vartype workspace_managed_sql_server_blob_auditing_policies: + azure.mgmt.synapse.aio.operations.WorkspaceManagedSqlServerBlobAuditingPoliciesOperations + :ivar workspace_managed_sql_server_extended_blob_auditing_policies: + WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations operations + :vartype workspace_managed_sql_server_extended_blob_auditing_policies: + azure.mgmt.synapse.aio.operations.WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations + :ivar workspace_managed_sql_server_security_alert_policy: + WorkspaceManagedSqlServerSecurityAlertPolicyOperations operations + :vartype workspace_managed_sql_server_security_alert_policy: + azure.mgmt.synapse.aio.operations.WorkspaceManagedSqlServerSecurityAlertPolicyOperations + :ivar workspace_managed_sql_server_vulnerability_assessments: + WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations operations + :vartype workspace_managed_sql_server_vulnerability_assessments: + azure.mgmt.synapse.aio.operations.WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations + :ivar workspace_managed_sql_server_encryption_protector: + WorkspaceManagedSqlServerEncryptionProtectorOperations operations + :vartype workspace_managed_sql_server_encryption_protector: + azure.mgmt.synapse.aio.operations.WorkspaceManagedSqlServerEncryptionProtectorOperations :ivar workspace_managed_sql_server_usages: WorkspaceManagedSqlServerUsagesOperations operations - :vartype workspace_managed_sql_server_usages: azure.mgmt.synapse.aio.operations.WorkspaceManagedSqlServerUsagesOperations - :ivar workspace_managed_sql_server_recoverable_sql_pools: WorkspaceManagedSqlServerRecoverableSqlPoolsOperations operations - :vartype workspace_managed_sql_server_recoverable_sql_pools: azure.mgmt.synapse.aio.operations.WorkspaceManagedSqlServerRecoverableSqlPoolsOperations + :vartype workspace_managed_sql_server_usages: + azure.mgmt.synapse.aio.operations.WorkspaceManagedSqlServerUsagesOperations + :ivar workspace_managed_sql_server_recoverable_sql_pools: + WorkspaceManagedSqlServerRecoverableSqlPoolsOperations operations + :vartype workspace_managed_sql_server_recoverable_sql_pools: + azure.mgmt.synapse.aio.operations.WorkspaceManagedSqlServerRecoverableSqlPoolsOperations :ivar workspaces: WorkspacesOperations operations :vartype workspaces: azure.mgmt.synapse.aio.operations.WorkspacesOperations :ivar workspace_aad_admins: WorkspaceAadAdminsOperations operations :vartype workspace_aad_admins: azure.mgmt.synapse.aio.operations.WorkspaceAadAdminsOperations :ivar workspace_sql_aad_admins: WorkspaceSqlAadAdminsOperations operations - :vartype workspace_sql_aad_admins: azure.mgmt.synapse.aio.operations.WorkspaceSqlAadAdminsOperations - :ivar workspace_managed_identity_sql_control_settings: WorkspaceManagedIdentitySqlControlSettingsOperations operations - :vartype workspace_managed_identity_sql_control_settings: azure.mgmt.synapse.aio.operations.WorkspaceManagedIdentitySqlControlSettingsOperations + :vartype workspace_sql_aad_admins: + azure.mgmt.synapse.aio.operations.WorkspaceSqlAadAdminsOperations + :ivar workspace_managed_identity_sql_control_settings: + WorkspaceManagedIdentitySqlControlSettingsOperations operations + :vartype workspace_managed_identity_sql_control_settings: + azure.mgmt.synapse.aio.operations.WorkspaceManagedIdentitySqlControlSettingsOperations :ivar restorable_dropped_sql_pools: RestorableDroppedSqlPoolsOperations operations - :vartype restorable_dropped_sql_pools: azure.mgmt.synapse.aio.operations.RestorableDroppedSqlPoolsOperations + :vartype restorable_dropped_sql_pools: + azure.mgmt.synapse.aio.operations.RestorableDroppedSqlPoolsOperations :ivar big_data_pools: BigDataPoolsOperations operations :vartype big_data_pools: azure.mgmt.synapse.aio.operations.BigDataPoolsOperations :ivar library: LibraryOperations operations @@ -204,21 +184,32 @@ class SynapseManagementClient(object): :ivar integration_runtimes: IntegrationRuntimesOperations operations :vartype integration_runtimes: azure.mgmt.synapse.aio.operations.IntegrationRuntimesOperations :ivar integration_runtime_node_ip_address: IntegrationRuntimeNodeIpAddressOperations operations - :vartype integration_runtime_node_ip_address: azure.mgmt.synapse.aio.operations.IntegrationRuntimeNodeIpAddressOperations - :ivar integration_runtime_object_metadata: IntegrationRuntimeObjectMetadataOperations operations - :vartype integration_runtime_object_metadata: azure.mgmt.synapse.aio.operations.IntegrationRuntimeObjectMetadataOperations + :vartype integration_runtime_node_ip_address: + azure.mgmt.synapse.aio.operations.IntegrationRuntimeNodeIpAddressOperations + :ivar integration_runtime_object_metadata: IntegrationRuntimeObjectMetadataOperations + operations + :vartype integration_runtime_object_metadata: + azure.mgmt.synapse.aio.operations.IntegrationRuntimeObjectMetadataOperations :ivar integration_runtime_nodes: IntegrationRuntimeNodesOperations operations - :vartype integration_runtime_nodes: azure.mgmt.synapse.aio.operations.IntegrationRuntimeNodesOperations + :vartype integration_runtime_nodes: + azure.mgmt.synapse.aio.operations.IntegrationRuntimeNodesOperations :ivar integration_runtime_credentials: IntegrationRuntimeCredentialsOperations operations - :vartype integration_runtime_credentials: azure.mgmt.synapse.aio.operations.IntegrationRuntimeCredentialsOperations - :ivar integration_runtime_connection_infos: IntegrationRuntimeConnectionInfosOperations operations - :vartype integration_runtime_connection_infos: azure.mgmt.synapse.aio.operations.IntegrationRuntimeConnectionInfosOperations + :vartype integration_runtime_credentials: + azure.mgmt.synapse.aio.operations.IntegrationRuntimeCredentialsOperations + :ivar integration_runtime_connection_infos: IntegrationRuntimeConnectionInfosOperations + operations + :vartype integration_runtime_connection_infos: + azure.mgmt.synapse.aio.operations.IntegrationRuntimeConnectionInfosOperations :ivar integration_runtime_auth_keys: IntegrationRuntimeAuthKeysOperations operations - :vartype integration_runtime_auth_keys: azure.mgmt.synapse.aio.operations.IntegrationRuntimeAuthKeysOperations - :ivar integration_runtime_monitoring_data: IntegrationRuntimeMonitoringDataOperations operations - :vartype integration_runtime_monitoring_data: azure.mgmt.synapse.aio.operations.IntegrationRuntimeMonitoringDataOperations + :vartype integration_runtime_auth_keys: + azure.mgmt.synapse.aio.operations.IntegrationRuntimeAuthKeysOperations + :ivar integration_runtime_monitoring_data: IntegrationRuntimeMonitoringDataOperations + operations + :vartype integration_runtime_monitoring_data: + azure.mgmt.synapse.aio.operations.IntegrationRuntimeMonitoringDataOperations :ivar integration_runtime_status: IntegrationRuntimeStatusOperations operations - :vartype integration_runtime_status: azure.mgmt.synapse.aio.operations.IntegrationRuntimeStatusOperations + :vartype integration_runtime_status: + azure.mgmt.synapse.aio.operations.IntegrationRuntimeStatusOperations :ivar spark_configuration: SparkConfigurationOperations operations :vartype spark_configuration: azure.mgmt.synapse.aio.operations.SparkConfigurationOperations :ivar spark_configurations: SparkConfigurationsOperations operations @@ -228,203 +219,147 @@ class SynapseManagementClient(object): :ivar kusto_pools: KustoPoolsOperations operations :vartype kusto_pools: azure.mgmt.synapse.aio.operations.KustoPoolsOperations :ivar kusto_pool_child_resource: KustoPoolChildResourceOperations operations - :vartype kusto_pool_child_resource: azure.mgmt.synapse.aio.operations.KustoPoolChildResourceOperations - :ivar kusto_pool_attached_database_configurations: KustoPoolAttachedDatabaseConfigurationsOperations operations - :vartype kusto_pool_attached_database_configurations: azure.mgmt.synapse.aio.operations.KustoPoolAttachedDatabaseConfigurationsOperations + :vartype kusto_pool_child_resource: + azure.mgmt.synapse.aio.operations.KustoPoolChildResourceOperations + :ivar kusto_pool_attached_database_configurations: + KustoPoolAttachedDatabaseConfigurationsOperations operations + :vartype kusto_pool_attached_database_configurations: + azure.mgmt.synapse.aio.operations.KustoPoolAttachedDatabaseConfigurationsOperations :ivar kusto_pool_databases: KustoPoolDatabasesOperations operations :vartype kusto_pool_databases: azure.mgmt.synapse.aio.operations.KustoPoolDatabasesOperations :ivar kusto_pool_data_connections: KustoPoolDataConnectionsOperations operations - :vartype kusto_pool_data_connections: azure.mgmt.synapse.aio.operations.KustoPoolDataConnectionsOperations + :vartype kusto_pool_data_connections: + azure.mgmt.synapse.aio.operations.KustoPoolDataConnectionsOperations :ivar kusto_pool_principal_assignments: KustoPoolPrincipalAssignmentsOperations operations - :vartype kusto_pool_principal_assignments: azure.mgmt.synapse.aio.operations.KustoPoolPrincipalAssignmentsOperations - :ivar kusto_pool_database_principal_assignments: KustoPoolDatabasePrincipalAssignmentsOperations operations - :vartype kusto_pool_database_principal_assignments: azure.mgmt.synapse.aio.operations.KustoPoolDatabasePrincipalAssignmentsOperations + :vartype kusto_pool_principal_assignments: + azure.mgmt.synapse.aio.operations.KustoPoolPrincipalAssignmentsOperations + :ivar kusto_pool_database_principal_assignments: + KustoPoolDatabasePrincipalAssignmentsOperations operations + :vartype kusto_pool_database_principal_assignments: + azure.mgmt.synapse.aio.operations.KustoPoolDatabasePrincipalAssignmentsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = SynapseManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = SynapseManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.azure_ad_only_authentications = AzureADOnlyAuthenticationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.ip_firewall_rules = IpFirewallRulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.keys = KeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_hub_private_link_resources = PrivateLinkHubPrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_hubs = PrivateLinkHubsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections_private_link_hub = PrivateEndpointConnectionsPrivateLinkHubOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pools = SqlPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_metadata_sync_configs = SqlPoolMetadataSyncConfigsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_operation_results = SqlPoolOperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_geo_backup_policies = SqlPoolGeoBackupPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_data_warehouse_user_activities = SqlPoolDataWarehouseUserActivitiesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_restore_points = SqlPoolRestorePointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_replication_links = SqlPoolReplicationLinksOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_maintenance_windows = SqlPoolMaintenanceWindowsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_maintenance_window_options = SqlPoolMaintenanceWindowOptionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_transparent_data_encryptions = SqlPoolTransparentDataEncryptionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_blob_auditing_policies = SqlPoolBlobAuditingPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_operations = SqlPoolOperationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_usages = SqlPoolUsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_sensitivity_labels = SqlPoolSensitivityLabelsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_recommended_sensitivity_labels = SqlPoolRecommendedSensitivityLabelsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_schemas = SqlPoolSchemasOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_tables = SqlPoolTablesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_table_columns = SqlPoolTableColumnsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_connection_policies = SqlPoolConnectionPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_vulnerability_assessments = SqlPoolVulnerabilityAssessmentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_vulnerability_assessment_scans = SqlPoolVulnerabilityAssessmentScansOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_security_alert_policies = SqlPoolSecurityAlertPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_vulnerability_assessment_rule_baselines = SqlPoolVulnerabilityAssessmentRuleBaselinesOperations(self._client, self._config, self._serialize, self._deserialize) + self.extended_sql_pool_blob_auditing_policies = ExtendedSqlPoolBlobAuditingPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.data_masking_policies = DataMaskingPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.data_masking_rules = DataMaskingRulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_columns = SqlPoolColumnsOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_workload_group = SqlPoolWorkloadGroupOperations(self._client, self._config, self._serialize, self._deserialize) + self.sql_pool_workload_classifier = SqlPoolWorkloadClassifierOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_managed_sql_server_blob_auditing_policies = WorkspaceManagedSqlServerBlobAuditingPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_managed_sql_server_extended_blob_auditing_policies = WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_managed_sql_server_security_alert_policy = WorkspaceManagedSqlServerSecurityAlertPolicyOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_managed_sql_server_vulnerability_assessments = WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_managed_sql_server_encryption_protector = WorkspaceManagedSqlServerEncryptionProtectorOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_managed_sql_server_usages = WorkspaceManagedSqlServerUsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_managed_sql_server_recoverable_sql_pools = WorkspaceManagedSqlServerRecoverableSqlPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_aad_admins = WorkspaceAadAdminsOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_sql_aad_admins = WorkspaceSqlAadAdminsOperations(self._client, self._config, self._serialize, self._deserialize) + self.workspace_managed_identity_sql_control_settings = WorkspaceManagedIdentitySqlControlSettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.restorable_dropped_sql_pools = RestorableDroppedSqlPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.big_data_pools = BigDataPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.library = LibraryOperations(self._client, self._config, self._serialize, self._deserialize) + self.libraries = LibrariesOperations(self._client, self._config, self._serialize, self._deserialize) + self.integration_runtimes = IntegrationRuntimesOperations(self._client, self._config, self._serialize, self._deserialize) + self.integration_runtime_node_ip_address = IntegrationRuntimeNodeIpAddressOperations(self._client, self._config, self._serialize, self._deserialize) + self.integration_runtime_object_metadata = IntegrationRuntimeObjectMetadataOperations(self._client, self._config, self._serialize, self._deserialize) + self.integration_runtime_nodes = IntegrationRuntimeNodesOperations(self._client, self._config, self._serialize, self._deserialize) + self.integration_runtime_credentials = IntegrationRuntimeCredentialsOperations(self._client, self._config, self._serialize, self._deserialize) + self.integration_runtime_connection_infos = IntegrationRuntimeConnectionInfosOperations(self._client, self._config, self._serialize, self._deserialize) + self.integration_runtime_auth_keys = IntegrationRuntimeAuthKeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.integration_runtime_monitoring_data = IntegrationRuntimeMonitoringDataOperations(self._client, self._config, self._serialize, self._deserialize) + self.integration_runtime_status = IntegrationRuntimeStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.spark_configuration = SparkConfigurationOperations(self._client, self._config, self._serialize, self._deserialize) + self.spark_configurations = SparkConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.kusto_operations = KustoOperationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.kusto_pools = KustoPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_child_resource = KustoPoolChildResourceOperations(self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_attached_database_configurations = KustoPoolAttachedDatabaseConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_databases = KustoPoolDatabasesOperations(self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_data_connections = KustoPoolDataConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_principal_assignments = KustoPoolPrincipalAssignmentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_database_principal_assignments = KustoPoolDatabasePrincipalAssignmentsOperations(self._client, self._config, self._serialize, self._deserialize) - self.azure_ad_only_authentications = AzureADOnlyAuthenticationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.ip_firewall_rules = IpFirewallRulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.keys = KeysOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_hub_private_link_resources = PrivateLinkHubPrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_hubs = PrivateLinkHubsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections_private_link_hub = PrivateEndpointConnectionsPrivateLinkHubOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pools = SqlPoolsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_metadata_sync_configs = SqlPoolMetadataSyncConfigsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_operation_results = SqlPoolOperationResultsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_geo_backup_policies = SqlPoolGeoBackupPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_data_warehouse_user_activities = SqlPoolDataWarehouseUserActivitiesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_restore_points = SqlPoolRestorePointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_replication_links = SqlPoolReplicationLinksOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_maintenance_windows = SqlPoolMaintenanceWindowsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_maintenance_window_options = SqlPoolMaintenanceWindowOptionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_transparent_data_encryptions = SqlPoolTransparentDataEncryptionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_blob_auditing_policies = SqlPoolBlobAuditingPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_operations = SqlPoolOperationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_usages = SqlPoolUsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_sensitivity_labels = SqlPoolSensitivityLabelsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_recommended_sensitivity_labels = SqlPoolRecommendedSensitivityLabelsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_schemas = SqlPoolSchemasOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_tables = SqlPoolTablesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_table_columns = SqlPoolTableColumnsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_connection_policies = SqlPoolConnectionPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_vulnerability_assessments = SqlPoolVulnerabilityAssessmentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_vulnerability_assessment_scans = SqlPoolVulnerabilityAssessmentScansOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_security_alert_policies = SqlPoolSecurityAlertPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_vulnerability_assessment_rule_baselines = SqlPoolVulnerabilityAssessmentRuleBaselinesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.extended_sql_pool_blob_auditing_policies = ExtendedSqlPoolBlobAuditingPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.data_masking_policies = DataMaskingPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.data_masking_rules = DataMaskingRulesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_columns = SqlPoolColumnsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_workload_group = SqlPoolWorkloadGroupOperations( - self._client, self._config, self._serialize, self._deserialize) - self.sql_pool_workload_classifier = SqlPoolWorkloadClassifierOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspace_managed_sql_server_blob_auditing_policies = WorkspaceManagedSqlServerBlobAuditingPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspace_managed_sql_server_extended_blob_auditing_policies = WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspace_managed_sql_server_security_alert_policy = WorkspaceManagedSqlServerSecurityAlertPolicyOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspace_managed_sql_server_vulnerability_assessments = WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspace_managed_sql_server_encryption_protector = WorkspaceManagedSqlServerEncryptionProtectorOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspace_managed_sql_server_usages = WorkspaceManagedSqlServerUsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspace_managed_sql_server_recoverable_sql_pools = WorkspaceManagedSqlServerRecoverableSqlPoolsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspaces = WorkspacesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspace_aad_admins = WorkspaceAadAdminsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspace_sql_aad_admins = WorkspaceSqlAadAdminsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.workspace_managed_identity_sql_control_settings = WorkspaceManagedIdentitySqlControlSettingsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.restorable_dropped_sql_pools = RestorableDroppedSqlPoolsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.big_data_pools = BigDataPoolsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.library = LibraryOperations( - self._client, self._config, self._serialize, self._deserialize) - self.libraries = LibrariesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.integration_runtimes = IntegrationRuntimesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.integration_runtime_node_ip_address = IntegrationRuntimeNodeIpAddressOperations( - self._client, self._config, self._serialize, self._deserialize) - self.integration_runtime_object_metadata = IntegrationRuntimeObjectMetadataOperations( - self._client, self._config, self._serialize, self._deserialize) - self.integration_runtime_nodes = IntegrationRuntimeNodesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.integration_runtime_credentials = IntegrationRuntimeCredentialsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.integration_runtime_connection_infos = IntegrationRuntimeConnectionInfosOperations( - self._client, self._config, self._serialize, self._deserialize) - self.integration_runtime_auth_keys = IntegrationRuntimeAuthKeysOperations( - self._client, self._config, self._serialize, self._deserialize) - self.integration_runtime_monitoring_data = IntegrationRuntimeMonitoringDataOperations( - self._client, self._config, self._serialize, self._deserialize) - self.integration_runtime_status = IntegrationRuntimeStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.spark_configuration = SparkConfigurationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.spark_configurations = SparkConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.kusto_operations = KustoOperationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.kusto_pools = KustoPoolsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.kusto_pool_child_resource = KustoPoolChildResourceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.kusto_pool_attached_database_configurations = KustoPoolAttachedDatabaseConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.kusto_pool_databases = KustoPoolDatabasesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.kusto_pool_data_connections = KustoPoolDataConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.kusto_pool_principal_assignments = KustoPoolPrincipalAssignmentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.kusto_pool_database_principal_assignments = KustoPoolDatabasePrincipalAssignmentsOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_azure_ad_only_authentications_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_azure_ad_only_authentications_operations.py index 7decc6c096b2b..0d7bbbbe07fba 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_azure_ad_only_authentications_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_azure_ad_only_authentications_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._azure_ad_only_authentications_operations import build_create_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -59,7 +65,8 @@ async def get( :param workspace_name: The name of the workspace. :type workspace_name: str :param azure_ad_only_authentication_name: name of the property. - :type azure_ad_only_authentication_name: str or ~azure.mgmt.synapse.models.AzureADOnlyAuthenticationName + :type azure_ad_only_authentication_name: str or + ~azure.mgmt.synapse.models.AzureADOnlyAuthenticationName :keyword callable cls: A custom type or function that will be passed the direct response :return: AzureADOnlyAuthentication, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.AzureADOnlyAuthentication @@ -70,34 +77,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'azureADOnlyAuthenticationName': self._serialize.url("azure_ad_only_authentication_name", azure_ad_only_authentication_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + azure_ad_only_authentication_name=azure_ad_only_authentication_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AzureADOnlyAuthentication', pipeline_response) @@ -106,8 +103,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/azureADOnlyAuthentications/{azureADOnlyAuthenticationName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -121,40 +120,29 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'azureADOnlyAuthenticationName': self._serialize.url("azure_ad_only_authentication_name", azure_ad_only_authentication_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(azure_ad_only_authentication_info, 'AzureADOnlyAuthentication') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + azure_ad_only_authentication_name=azure_ad_only_authentication_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(azure_ad_only_authentication_info, 'AzureADOnlyAuthentication') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -167,8 +155,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/azureADOnlyAuthentications/{azureADOnlyAuthenticationName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -186,20 +177,26 @@ async def begin_create( :param workspace_name: The name of the workspace. :type workspace_name: str :param azure_ad_only_authentication_name: name of the property. - :type azure_ad_only_authentication_name: str or ~azure.mgmt.synapse.models.AzureADOnlyAuthenticationName + :type azure_ad_only_authentication_name: str or + ~azure.mgmt.synapse.models.AzureADOnlyAuthenticationName :param azure_ad_only_authentication_info: Azure Active Directory Property. :type azure_ad_only_authentication_info: ~azure.mgmt.synapse.models.AzureADOnlyAuthentication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AzureADOnlyAuthentication or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.AzureADOnlyAuthentication] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AzureADOnlyAuthentication or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.AzureADOnlyAuthentication] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureADOnlyAuthentication"] lro_delay = kwargs.pop( 'polling_interval', @@ -212,28 +209,21 @@ async def begin_create( workspace_name=workspace_name, azure_ad_only_authentication_name=azure_ad_only_authentication_name, azure_ad_only_authentication_info=azure_ad_only_authentication_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AzureADOnlyAuthentication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'azureADOnlyAuthenticationName': self._serialize.url("azure_ad_only_authentication_name", azure_ad_only_authentication_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -245,8 +235,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/azureADOnlyAuthentications/{azureADOnlyAuthenticationName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -262,8 +254,10 @@ def list( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AzureADOnlyAuthenticationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.AzureADOnlyAuthenticationListResult] + :return: An iterator like instance of either AzureADOnlyAuthenticationListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.AzureADOnlyAuthenticationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureADOnlyAuthenticationListResult"] @@ -271,36 +265,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AzureADOnlyAuthenticationListResult', pipeline_response) + deserialized = self._deserialize("AzureADOnlyAuthenticationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -313,12 +304,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_big_data_pools_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_big_data_pools_operations.py index c9681dd93ffd6..ee0483e79d1d4 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_big_data_pools_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_big_data_pools_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._big_data_pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_workspace_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -70,34 +76,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'bigDataPoolName': self._serialize.url("big_data_pool_name", big_data_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + big_data_pool_name=big_data_pool_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BigDataPoolResourceInfo', pipeline_response) @@ -106,8 +102,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -138,39 +137,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'bigDataPoolName': self._serialize.url("big_data_pool_name", big_data_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(big_data_pool_patch_info, 'BigDataPoolPatchInfo') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + big_data_pool_name=big_data_pool_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(big_data_pool_patch_info, 'BigDataPoolPatchInfo') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BigDataPoolResourceInfo', pipeline_response) @@ -179,8 +168,10 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -195,42 +186,30 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'bigDataPoolName': self._serialize.url("big_data_pool_name", big_data_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force is not None: - query_parameters['force'] = self._serialize.query("force", force, 'bool') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(big_data_pool_info, 'BigDataPoolResourceInfo') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(big_data_pool_info, 'BigDataPoolResourceInfo') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + big_data_pool_name=big_data_pool_name, + content_type=content_type, + json=_json, + force=force, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('BigDataPoolResourceInfo', pipeline_response) @@ -242,8 +221,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -269,15 +251,19 @@ async def begin_create_or_update( :type force: bool :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BigDataPoolResourceInfo or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BigDataPoolResourceInfo or the + result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.BigDataPoolResourceInfo] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BigDataPoolResourceInfo"] lro_delay = kwargs.pop( 'polling_interval', @@ -291,28 +277,21 @@ async def begin_create_or_update( big_data_pool_name=big_data_pool_name, big_data_pool_info=big_data_pool_info, force=force, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BigDataPoolResourceInfo', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'bigDataPoolName': self._serialize.url("big_data_pool_name", big_data_pool_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -324,6 +303,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} # type: ignore async def _delete_initial( @@ -338,35 +318,24 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'bigDataPoolName': self._serialize.url("big_data_pool_name", big_data_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + big_data_pool_name=big_data_pool_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -379,8 +348,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -400,15 +372,17 @@ async def begin_delete( :type big_data_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either any or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[any] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[Any] lro_delay = kwargs.pop( 'polling_interval', @@ -423,25 +397,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('object', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'bigDataPoolName': self._serialize.url("big_data_pool_name", big_data_pool_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -453,8 +419,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} # type: ignore + @distributed_trace def list_by_workspace( self, resource_group_name: str, @@ -470,8 +438,10 @@ def list_by_workspace( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BigDataPoolResourceInfoListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.BigDataPoolResourceInfoListResult] + :return: An iterator like instance of either BigDataPoolResourceInfoListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.BigDataPoolResourceInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BigDataPoolResourceInfoListResult"] @@ -479,36 +449,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BigDataPoolResourceInfoListResult', pipeline_response) + deserialized = self._deserialize("BigDataPoolResourceInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -521,12 +488,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_data_masking_policies_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_data_masking_policies_operations.py index f537c0dac4f2a..5733e2aad9625 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_data_masking_policies_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_data_masking_policies_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._data_masking_policies_operations import build_create_or_update_request, build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -68,41 +73,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - data_masking_policy_name = "Default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'dataMaskingPolicyName': self._serialize.url("data_masking_policy_name", data_masking_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DataMaskingPolicy') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataMaskingPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DataMaskingPolicy', pipeline_response) @@ -111,8 +104,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -138,36 +134,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - data_masking_policy_name = "Default" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'dataMaskingPolicyName': self._serialize.url("data_masking_policy_name", data_masking_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DataMaskingPolicy', pipeline_response) @@ -176,4 +160,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_data_masking_rules_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_data_masking_rules_operations.py index 2d31a524f339a..7966805bf8053 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_data_masking_rules_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_data_masking_rules_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._data_masking_rules_operations import build_create_or_update_request, build_get_request, build_list_by_sql_pool_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -72,42 +78,30 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - data_masking_policy_name = "Default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'dataMaskingPolicyName': self._serialize.url("data_masking_policy_name", data_masking_policy_name, 'str'), - 'dataMaskingRuleName': self._serialize.url("data_masking_rule_name", data_masking_rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataMaskingRule') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + data_masking_rule_name=data_masking_rule_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataMaskingRule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -120,8 +114,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -150,37 +147,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - data_masking_policy_name = "Default" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'dataMaskingPolicyName': self._serialize.url("data_masking_policy_name", data_masking_policy_name, 'str'), - 'dataMaskingRuleName': self._serialize.url("data_masking_rule_name", data_masking_rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + data_masking_rule_name=data_masking_rule_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DataMaskingRule', pipeline_response) @@ -189,8 +174,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName}'} # type: ignore + + @distributed_trace def list_by_sql_pool( self, resource_group_name: str, @@ -207,8 +195,10 @@ def list_by_sql_pool( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataMaskingRuleListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.DataMaskingRuleListResult] + :return: An iterator like instance of either DataMaskingRuleListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.DataMaskingRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataMaskingRuleListResult"] @@ -216,39 +206,35 @@ def list_by_sql_pool( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - data_masking_policy_name = "Default" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_sql_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'dataMaskingPolicyName': self._serialize.url("data_masking_policy_name", data_masking_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_sql_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list_by_sql_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_sql_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataMaskingRuleListResult', pipeline_response) + deserialized = self._deserialize("DataMaskingRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -261,12 +247,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_extended_sql_pool_blob_auditing_policies_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_extended_sql_pool_blob_auditing_policies_operations.py index 9ebdb35c9ee34..3996880913168 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_extended_sql_pool_blob_auditing_policies_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_extended_sql_pool_blob_auditing_policies_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._extended_sql_pool_blob_auditing_policies_operations import build_create_or_update_request, build_get_request, build_list_by_sql_pool_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -66,30 +72,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - blob_auditing_policy_name = "default" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -103,8 +97,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/extendedAuditingSettings/{blobAuditingPolicyName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -133,35 +130,23 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - blob_auditing_policy_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ExtendedSqlPoolBlobAuditingPolicy') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ExtendedSqlPoolBlobAuditingPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,8 +164,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/extendedAuditingSettings/{blobAuditingPolicyName}'} # type: ignore + + @distributed_trace def list_by_sql_pool( self, resource_group_name: str, @@ -197,8 +185,10 @@ def list_by_sql_pool( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtendedSqlPoolBlobAuditingPolicyListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.ExtendedSqlPoolBlobAuditingPolicyListResult] + :return: An iterator like instance of either ExtendedSqlPoolBlobAuditingPolicyListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.ExtendedSqlPoolBlobAuditingPolicyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtendedSqlPoolBlobAuditingPolicyListResult"] @@ -206,37 +196,35 @@ def list_by_sql_pool( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_sql_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_sql_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list_by_sql_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_sql_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExtendedSqlPoolBlobAuditingPolicyListResult', pipeline_response) + deserialized = self._deserialize("ExtendedSqlPoolBlobAuditingPolicyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -254,6 +242,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_auth_keys_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_auth_keys_operations.py index 591bbf0d2c757..d57ff7d97acd5 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_auth_keys_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_auth_keys_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._integration_runtime_auth_keys_operations import build_list_request, build_regenerate_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def regenerate( self, resource_group_name: str, @@ -60,7 +65,8 @@ async def regenerate( :type integration_runtime_name: str :param regenerate_key_parameters: The parameters for regenerating integration runtime authentication key. - :type regenerate_key_parameters: ~azure.mgmt.synapse.models.IntegrationRuntimeRegenerateKeyParameters + :type regenerate_key_parameters: + ~azure.mgmt.synapse.models.IntegrationRuntimeRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: IntegrationRuntimeAuthKeys, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeAuthKeys @@ -71,39 +77,29 @@ async def regenerate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key_parameters, 'IntegrationRuntimeRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + content_type=content_type, + json=_json, + template_url=self.regenerate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key_parameters, 'IntegrationRuntimeRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IntegrationRuntimeAuthKeys', pipeline_response) @@ -112,8 +108,11 @@ async def regenerate( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/regenerateAuthKey'} # type: ignore + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -141,34 +140,24 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IntegrationRuntimeAuthKeys', pipeline_response) @@ -177,4 +166,6 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/listAuthKeys'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_connection_infos_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_connection_infos_operations.py index 3d050daffb91d..17a3ad2c18b90 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_connection_infos_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_connection_infos_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._integration_runtime_connection_infos_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -67,34 +72,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IntegrationRuntimeConnectionInfo', pipeline_response) @@ -103,4 +98,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/getConnectionInfo'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_credentials_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_credentials_operations.py index e72c416991e28..40dc3718b92c0 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_credentials_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_credentials_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._integration_runtime_credentials_operations import build_sync_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def sync( self, resource_group_name: str, @@ -70,37 +75,28 @@ async def sync( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.sync.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_sync_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self.sync.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) sync.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/syncCredentials'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_monitoring_data_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_monitoring_data_operations.py index 1e7d8f13aefb3..916b5e4bbad0d 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_monitoring_data_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_monitoring_data_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._integration_runtime_monitoring_data_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -67,34 +72,24 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IntegrationRuntimeMonitoringData', pipeline_response) @@ -103,4 +98,6 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/monitoringData'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_node_ip_address_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_node_ip_address_operations.py index 0f601af35d46d..1f32af8cc8d1a 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_node_ip_address_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_node_ip_address_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._integration_runtime_node_ip_address_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -70,35 +75,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - 'nodeName': self._serialize.url("node_name", node_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + node_name=node_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IntegrationRuntimeNodeIpAddress', pipeline_response) @@ -107,4 +102,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}/ipAddress'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_nodes_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_nodes_operations.py index a5d1366772abc..44385215545f4 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_nodes_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_nodes_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._integration_runtime_nodes_operations import build_delete_request, build_get_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -70,35 +75,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - 'nodeName': self._serialize.url("node_name", node_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + node_name=node_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SelfHostedIntegrationRuntimeNode', pipeline_response) @@ -107,8 +102,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -132,7 +130,8 @@ async def update( :type node_name: str :param update_integration_runtime_node_request: The parameters for updating an integration runtime node. - :type update_integration_runtime_node_request: ~azure.mgmt.synapse.models.UpdateIntegrationRuntimeNodeRequest + :type update_integration_runtime_node_request: + ~azure.mgmt.synapse.models.UpdateIntegrationRuntimeNodeRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: SelfHostedIntegrationRuntimeNode, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.SelfHostedIntegrationRuntimeNode @@ -143,40 +142,30 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - 'nodeName': self._serialize.url("node_name", node_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(update_integration_runtime_node_request, 'UpdateIntegrationRuntimeNodeRequest') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + node_name=node_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(update_integration_runtime_node_request, 'UpdateIntegrationRuntimeNodeRequest') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SelfHostedIntegrationRuntimeNode', pipeline_response) @@ -185,8 +174,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -217,38 +209,29 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - 'nodeName': self._serialize.url("node_name", node_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + node_name=node_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_object_metadata_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_object_metadata_operations.py index 45eea51195b05..3e1d206f901b9 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_object_metadata_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_object_metadata_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._integration_runtime_object_metadata_operations import build_list_request, build_refresh_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, resource_group_name: str, @@ -72,42 +77,32 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if get_metadata_request is not None: - body_content = self._serialize.body(get_metadata_request, 'GetSsisObjectMetadataRequest') + _json = self._serialize.body(get_metadata_request, 'GetSsisObjectMetadataRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + content_type=content_type, + json=_json, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SsisObjectMetadataListResponse', pipeline_response) @@ -116,8 +111,10 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/getObjectMetadata'} # type: ignore + async def _refresh_initial( self, resource_group_name: str, @@ -130,35 +127,24 @@ async def _refresh_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -168,8 +154,11 @@ async def _refresh_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/refreshObjectMetadata'} # type: ignore + + @distributed_trace_async async def begin_refresh( self, resource_group_name: str, @@ -189,15 +178,19 @@ async def begin_refresh( :type integration_runtime_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SsisObjectMetadataStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.SsisObjectMetadataStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SsisObjectMetadataStatusResponse or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.SsisObjectMetadataStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SsisObjectMetadataStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -212,25 +205,17 @@ async def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('SsisObjectMetadataStatusResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -242,4 +227,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/refreshObjectMetadata'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_status_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_status_operations.py index d28fd3931d731..eaa27317362b6 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_status_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_status_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._integration_runtime_status_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -67,34 +72,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IntegrationRuntimeStatusResponse', pipeline_response) @@ -103,4 +98,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/getStatus'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtimes_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtimes_operations.py index 1972f3f5b8319..9bb6e77593070 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtimes_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtimes_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._integration_runtimes_operations import build_create_request_initial, build_delete_request_initial, build_disable_interactive_query_request_initial, build_enable_interactive_query_request_initial, build_get_request, build_list_by_workspace_request, build_list_outbound_network_dependencies_endpoints_request, build_start_request_initial, build_stop_request_initial, build_update_request, build_upgrade_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def update( self, resource_group_name: str, @@ -62,7 +68,8 @@ async def update( :param integration_runtime_name: Integration runtime name. :type integration_runtime_name: str :param update_integration_runtime_request: The parameters for updating an integration runtime. - :type update_integration_runtime_request: ~azure.mgmt.synapse.models.UpdateIntegrationRuntimeRequest + :type update_integration_runtime_request: + ~azure.mgmt.synapse.models.UpdateIntegrationRuntimeRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: IntegrationRuntimeResource, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeResource @@ -73,39 +80,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(update_integration_runtime_request, 'UpdateIntegrationRuntimeRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(update_integration_runtime_request, 'UpdateIntegrationRuntimeRequest') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IntegrationRuntimeResource', pipeline_response) @@ -114,8 +111,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -148,36 +148,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + if_none_match=if_none_match, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 304]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -188,8 +177,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -204,42 +195,30 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(integration_runtime, 'IntegrationRuntimeResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(integration_runtime, 'IntegrationRuntimeResource') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -249,8 +228,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -277,15 +259,20 @@ async def begin_create( :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either IntegrationRuntimeResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.IntegrationRuntimeResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IntegrationRuntimeResource or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.IntegrationRuntimeResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -299,28 +286,21 @@ async def begin_create( integration_runtime_name=integration_runtime_name, integration_runtime=integration_runtime, if_match=if_match, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('IntegrationRuntimeResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -332,6 +312,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} # type: ignore async def _delete_initial( @@ -346,41 +327,32 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -400,15 +372,17 @@ async def begin_delete( :type integration_runtime_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -423,22 +397,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -450,8 +416,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} # type: ignore + @distributed_trace_async async def upgrade( self, resource_group_name: str, @@ -479,34 +447,24 @@ async def upgrade( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.upgrade.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_upgrade_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self.upgrade.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -514,6 +472,8 @@ async def upgrade( upgrade.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/upgrade'} # type: ignore + + @distributed_trace def list_by_workspace( self, resource_group_name: str, @@ -529,8 +489,10 @@ def list_by_workspace( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either IntegrationRuntimeListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.IntegrationRuntimeListResponse] + :return: An iterator like instance of either IntegrationRuntimeListResponse or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.IntegrationRuntimeListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeListResponse"] @@ -538,36 +500,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('IntegrationRuntimeListResponse', pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -580,12 +539,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -603,35 +563,24 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -641,8 +590,11 @@ async def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -662,15 +614,19 @@ async def begin_start( :type integration_runtime_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either IntegrationRuntimeStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.IntegrationRuntimeStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IntegrationRuntimeStatusResponse or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.IntegrationRuntimeStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -685,25 +641,17 @@ async def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('IntegrationRuntimeStatusResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -715,6 +663,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/start'} # type: ignore async def _stop_initial( @@ -729,41 +678,32 @@ async def _stop_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/stop'} # type: ignore + + @distributed_trace_async async def begin_stop( self, resource_group_name: str, @@ -783,15 +723,17 @@ async def begin_stop( :type integration_runtime_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -806,22 +748,14 @@ async def begin_stop( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -833,8 +767,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/stop'} # type: ignore + @distributed_trace_async async def list_outbound_network_dependencies_endpoints( self, resource_group_name: str, @@ -853,8 +789,10 @@ async def list_outbound_network_dependencies_endpoints( :param integration_runtime_name: Integration runtime name. :type integration_runtime_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse, or the result of cls(response) - :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse + :return: IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse, or the result of + cls(response) + :rtype: + ~azure.mgmt.synapse.models.IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse"] @@ -862,34 +800,24 @@ async def list_outbound_network_dependencies_endpoints( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_outbound_network_dependencies_endpoints.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_outbound_network_dependencies_endpoints_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse', pipeline_response) @@ -898,8 +826,10 @@ async def list_outbound_network_dependencies_endpoints( return cls(pipeline_response, deserialized, {}) return deserialized + list_outbound_network_dependencies_endpoints.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/outboundNetworkDependenciesEndpoints'} # type: ignore + async def _enable_interactive_query_initial( self, resource_group_name: str, @@ -912,41 +842,32 @@ async def _enable_interactive_query_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._enable_interactive_query_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_enable_interactive_query_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self._enable_interactive_query_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _enable_interactive_query_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/enableInteractiveQuery'} # type: ignore + + @distributed_trace_async async def begin_enable_interactive_query( self, resource_group_name: str, @@ -964,15 +885,17 @@ async def begin_enable_interactive_query( :type integration_runtime_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -987,22 +910,14 @@ async def begin_enable_interactive_query( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1014,6 +929,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_enable_interactive_query.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/enableInteractiveQuery'} # type: ignore async def _disable_interactive_query_initial( @@ -1028,41 +944,32 @@ async def _disable_interactive_query_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._disable_interactive_query_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_disable_interactive_query_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self._disable_interactive_query_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _disable_interactive_query_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/disableInteractiveQuery'} # type: ignore + + @distributed_trace_async async def begin_disable_interactive_query( self, resource_group_name: str, @@ -1080,15 +987,17 @@ async def begin_disable_interactive_query( :type integration_runtime_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1103,22 +1012,14 @@ async def begin_disable_interactive_query( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1130,4 +1031,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_disable_interactive_query.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/disableInteractiveQuery'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_ip_firewall_rules_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_ip_firewall_rules_operations.py index 78802885780ea..0ca8d088a9cf2 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_ip_firewall_rules_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_ip_firewall_rules_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._ip_firewall_rules_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_workspace_request, build_replace_all_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_workspace( self, resource_group_name: str, @@ -56,8 +62,10 @@ def list_by_workspace( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either IpFirewallRuleInfoListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.IpFirewallRuleInfoListResult] + :return: An iterator like instance of either IpFirewallRuleInfoListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.IpFirewallRuleInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IpFirewallRuleInfoListResult"] @@ -65,36 +73,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('IpFirewallRuleInfoListResult', pipeline_response) + deserialized = self._deserialize("IpFirewallRuleInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,12 +112,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -131,40 +137,29 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(ip_firewall_rule_info, 'IpFirewallRuleInfo') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(ip_firewall_rule_info, 'IpFirewallRuleInfo') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('IpFirewallRuleInfo', pipeline_response) @@ -176,8 +171,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,15 +196,19 @@ async def begin_create_or_update( :type ip_firewall_rule_info: ~azure.mgmt.synapse.models.IpFirewallRuleInfo :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either IpFirewallRuleInfo or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IpFirewallRuleInfo or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.IpFirewallRuleInfo] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.IpFirewallRuleInfo"] lro_delay = kwargs.pop( 'polling_interval', @@ -219,28 +221,21 @@ async def begin_create_or_update( workspace_name=workspace_name, rule_name=rule_name, ip_firewall_rule_info=ip_firewall_rule_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('IpFirewallRuleInfo', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -252,6 +247,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}'} # type: ignore async def _delete_initial( @@ -266,35 +262,24 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -304,8 +289,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -323,15 +311,17 @@ async def begin_delete( :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either any or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[any] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[Any] lro_delay = kwargs.pop( 'polling_interval', @@ -346,25 +336,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('object', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -376,8 +358,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -403,34 +387,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IpFirewallRuleInfo', pipeline_response) @@ -439,8 +413,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}'} # type: ignore + async def _replace_all_initial( self, resource_group_name: str, @@ -453,39 +429,28 @@ async def _replace_all_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._replace_all_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(request, 'ReplaceAllIpFirewallRulesRequest') + + request = build_replace_all_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self._replace_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(request, 'ReplaceAllIpFirewallRulesRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -495,8 +460,11 @@ async def _replace_all_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _replace_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/replaceAllIpFirewallRules'} # type: ignore + + @distributed_trace_async async def begin_replace_all( self, resource_group_name: str, @@ -514,15 +482,20 @@ async def begin_replace_all( :type request: ~azure.mgmt.synapse.models.ReplaceAllIpFirewallRulesRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ReplaceAllFirewallRulesOperationResponse or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.ReplaceAllFirewallRulesOperationResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + ReplaceAllFirewallRulesOperationResponse or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.ReplaceAllFirewallRulesOperationResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplaceAllFirewallRulesOperationResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -534,27 +507,21 @@ async def begin_replace_all( resource_group_name=resource_group_name, workspace_name=workspace_name, request=request, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ReplaceAllFirewallRulesOperationResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -566,4 +533,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_replace_all.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/replaceAllIpFirewallRules'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_keys_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_keys_operations.py index 2210b5b5568db..2a8bf88e7aab3 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_keys_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_keys_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._keys_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_workspace_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_workspace( self, resource_group_name: str, @@ -63,36 +69,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('KeyInfoListResult', pipeline_response) + deserialized = self._deserialize("KeyInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,17 +108,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/keys'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -141,34 +146,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'keyName': self._serialize.url("key_name", key_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + key_name=key_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Key', pipeline_response) @@ -177,8 +172,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/keys/{keyName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -207,39 +205,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'keyName': self._serialize.url("key_name", key_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(key_properties, 'Key') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + key_name=key_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(key_properties, 'Key') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Key', pipeline_response) @@ -248,8 +236,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/keys/{keyName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -275,34 +266,24 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'keyName': self._serialize.url("key_name", key_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + key_name=key_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -313,4 +294,6 @@ async def delete( return cls(pipeline_response, deserialized, {}) return deserialized + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/keys/{keyName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_operations_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_operations_operations.py index a1ee25ef58164..07734d56090a3 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_operations_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_operations_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._kusto_operations_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -57,30 +63,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +96,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_attached_database_configurations_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_attached_database_configurations_operations.py index a3eef6564ef30..b1b65bc16268c 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_attached_database_configurations_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_attached_database_configurations_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._kusto_pool_attached_database_configurations_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_kusto_pool_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_kusto_pool( self, workspace_name: str, @@ -59,8 +65,10 @@ def list_by_kusto_pool( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AttachedDatabaseConfigurationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.AttachedDatabaseConfigurationListResult] + :return: An iterator like instance of either AttachedDatabaseConfigurationListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.AttachedDatabaseConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AttachedDatabaseConfigurationListResult"] @@ -68,37 +76,35 @@ def list_by_kusto_pool( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_kusto_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_kusto_pool_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_kusto_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_kusto_pool_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AttachedDatabaseConfigurationListResult', pipeline_response) + deserialized = self._deserialize("AttachedDatabaseConfigurationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,17 +117,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_kusto_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations'} # type: ignore + @distributed_trace_async async def get( self, workspace_name: str, @@ -150,35 +158,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + attached_database_configuration_name=attached_database_configuration_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) @@ -187,8 +185,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore + async def _create_or_update_initial( self, workspace_name: str, @@ -203,41 +203,30 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AttachedDatabaseConfiguration') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + attached_database_configuration_name=attached_database_configuration_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AttachedDatabaseConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) @@ -252,8 +241,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, workspace_name: str, @@ -277,15 +269,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.synapse.models.AttachedDatabaseConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either AttachedDatabaseConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.AttachedDatabaseConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AttachedDatabaseConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.AttachedDatabaseConfiguration] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AttachedDatabaseConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -299,29 +296,21 @@ async def begin_create_or_update( attached_database_configuration_name=attached_database_configuration_name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -333,6 +322,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore async def _delete_initial( @@ -348,42 +338,33 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + attached_database_configuration_name=attached_database_configuration_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, workspace_name: str, @@ -404,15 +385,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -428,23 +411,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -456,4 +430,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_child_resource_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_child_resource_operations.py index aa1bc34c2db78..6d96d312f48e7 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_child_resource_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_child_resource_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._kusto_pool_child_resource_operations import build_check_name_availability_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, workspace_name: str, @@ -68,39 +73,29 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource_name, 'DatabaseCheckNameRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_check_name_availability_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource_name, 'DatabaseCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameResult', pipeline_response) @@ -109,4 +104,6 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/checkNameAvailability'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_data_connections_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_data_connections_operations.py index ed010d1e1aedd..f12f77b45231c 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_data_connections_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_data_connections_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._kusto_pool_data_connections_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_data_connection_validation_request_initial, build_delete_request_initial, build_get_request, build_list_by_database_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, resource_group_name: str, @@ -74,40 +80,30 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(data_connection_name, 'DataConnectionCheckNameRequest') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(data_connection_name, 'DataConnectionCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameResult', pipeline_response) @@ -116,8 +112,10 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/checkNameAvailability'} # type: ignore + async def _data_connection_validation_initial( self, resource_group_name: str, @@ -132,41 +130,30 @@ async def _data_connection_validation_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._data_connection_validation_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataConnectionValidation') + + request = build_data_connection_validation_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + content_type=content_type, + json=_json, + template_url=self._data_connection_validation_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataConnectionValidation') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -176,8 +163,11 @@ async def _data_connection_validation_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _data_connection_validation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnectionValidation'} # type: ignore + + @distributed_trace_async async def begin_data_connection_validation( self, resource_group_name: str, @@ -201,15 +191,20 @@ async def begin_data_connection_validation( :type parameters: ~azure.mgmt.synapse.models.DataConnectionValidation :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DataConnectionValidationListResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.DataConnectionValidationListResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataConnectionValidationListResult + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.DataConnectionValidationListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnectionValidationListResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -223,29 +218,21 @@ async def begin_data_connection_validation( kusto_pool_name=kusto_pool_name, database_name=database_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DataConnectionValidationListResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -257,8 +244,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_data_connection_validation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnectionValidation'} # type: ignore + @distributed_trace def list_by_database( self, resource_group_name: str, @@ -278,8 +267,10 @@ def list_by_database( :param database_name: The name of the database in the Kusto pool. :type database_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataConnectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.DataConnectionListResult] + :return: An iterator like instance of either DataConnectionListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.DataConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnectionListResult"] @@ -287,38 +278,37 @@ def list_by_database( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_database.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_database_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + template_url=self.list_by_database.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_database_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataConnectionListResult', pipeline_response) + deserialized = self._deserialize("DataConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -331,17 +321,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -373,36 +365,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + data_connection_name=data_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DataConnection', pipeline_response) @@ -411,8 +393,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -428,42 +412,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DataConnection') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + data_connection_name=data_connection_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('DataConnection', pipeline_response) @@ -475,8 +448,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -503,15 +479,19 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.synapse.models.DataConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DataConnection or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataConnection or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.DataConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -526,30 +506,21 @@ async def begin_create_or_update( database_name=database_name, data_connection_name=data_connection_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DataConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -561,6 +532,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore async def _update_initial( @@ -578,42 +550,31 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataConnection') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + data_connection_name=data_connection_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataConnection') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('DataConnection', pipeline_response) @@ -625,8 +586,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -653,15 +617,19 @@ async def begin_update( :type parameters: ~azure.mgmt.synapse.models.DataConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DataConnection or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataConnection or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.DataConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -676,30 +644,21 @@ async def begin_update( database_name=database_name, data_connection_name=data_connection_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DataConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -711,6 +670,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore async def _delete_initial( @@ -727,43 +687,34 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + data_connection_name=data_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -787,15 +738,17 @@ async def begin_delete( :type data_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -812,24 +765,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -841,4 +784,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_database_principal_assignments_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_database_principal_assignments_operations.py index 618513efa2591..8e92434bc41da 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_database_principal_assignments_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_database_principal_assignments_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._kusto_pool_database_principal_assignments_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, workspace_name: str, @@ -63,7 +69,8 @@ async def check_name_availability( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param principal_assignment_name: The name of the resource. - :type principal_assignment_name: ~azure.mgmt.synapse.models.DatabasePrincipalAssignmentCheckNameRequest + :type principal_assignment_name: + ~azure.mgmt.synapse.models.DatabasePrincipalAssignmentCheckNameRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameResult, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.CheckNameResult @@ -74,40 +81,30 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(principal_assignment_name, 'DatabasePrincipalAssignmentCheckNameRequest') + + request = build_check_name_availability_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(principal_assignment_name, 'DatabasePrincipalAssignmentCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameResult', pipeline_response) @@ -116,8 +113,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/checkPrincipalAssignmentNameAvailability'} # type: ignore + + @distributed_trace def list( self, workspace_name: str, @@ -137,8 +137,10 @@ def list( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DatabasePrincipalAssignmentListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.DatabasePrincipalAssignmentListResult] + :return: An iterator like instance of either DatabasePrincipalAssignmentListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.DatabasePrincipalAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabasePrincipalAssignmentListResult"] @@ -146,38 +148,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DatabasePrincipalAssignmentListResult', pipeline_response) + deserialized = self._deserialize("DatabasePrincipalAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -190,17 +191,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments'} # type: ignore + @distributed_trace_async async def get( self, workspace_name: str, @@ -232,36 +235,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + principal_assignment_name=principal_assignment_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DatabasePrincipalAssignment', pipeline_response) @@ -270,8 +263,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore + async def _create_or_update_initial( self, workspace_name: str, @@ -287,42 +282,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DatabasePrincipalAssignment') + + request = build_create_or_update_request_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + principal_assignment_name=principal_assignment_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DatabasePrincipalAssignment') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('DatabasePrincipalAssignment', pipeline_response) @@ -334,8 +318,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, workspace_name: str, @@ -362,15 +349,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.synapse.models.DatabasePrincipalAssignment :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either DatabasePrincipalAssignment or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.DatabasePrincipalAssignment] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DatabasePrincipalAssignment or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.DatabasePrincipalAssignment] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabasePrincipalAssignment"] lro_delay = kwargs.pop( 'polling_interval', @@ -385,30 +377,21 @@ async def begin_create_or_update( principal_assignment_name=principal_assignment_name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DatabasePrincipalAssignment', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -420,6 +403,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore async def _delete_initial( @@ -436,43 +420,34 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + principal_assignment_name=principal_assignment_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, workspace_name: str, @@ -496,15 +471,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -521,24 +498,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -550,4 +517,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_databases_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_databases_operations.py index 6e2ca7ff36993..08fd5a0bf7bee 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_databases_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_databases_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._kusto_pool_databases_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_kusto_pool_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_kusto_pool( self, resource_group_name: str, @@ -68,37 +74,35 @@ def list_by_kusto_pool( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_kusto_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_kusto_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + template_url=self.list_by_kusto_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_kusto_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DatabaseListResult', pipeline_response) + deserialized = self._deserialize("DatabaseListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,17 +115,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_kusto_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -150,35 +156,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Database', pipeline_response) @@ -187,8 +183,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -203,41 +201,30 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'Database') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Database') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Database', pipeline_response) @@ -249,8 +236,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -274,15 +264,19 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.synapse.models.Database :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Database or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Database or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.Database] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Database"] lro_delay = kwargs.pop( 'polling_interval', @@ -296,29 +290,21 @@ async def begin_create_or_update( kusto_pool_name=kusto_pool_name, database_name=database_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Database', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -330,6 +316,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore async def _update_initial( @@ -346,41 +333,30 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Database') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Database') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Database', pipeline_response) @@ -392,8 +368,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -417,15 +396,19 @@ async def begin_update( :type parameters: ~azure.mgmt.synapse.models.Database :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Database or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Database or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.Database] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Database"] lro_delay = kwargs.pop( 'polling_interval', @@ -439,29 +422,21 @@ async def begin_update( kusto_pool_name=kusto_pool_name, database_name=database_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Database', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -473,6 +448,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore async def _delete_initial( @@ -488,42 +464,33 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -544,15 +511,17 @@ async def begin_delete( :type database_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -568,23 +537,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -596,4 +556,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_principal_assignments_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_principal_assignments_operations.py index 4c67c7fa00e65..66998ddf4187c 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_principal_assignments_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_principal_assignments_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._kusto_pool_principal_assignments_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, workspace_name: str, @@ -60,7 +66,8 @@ async def check_name_availability( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param principal_assignment_name: The name of the principal assignment. - :type principal_assignment_name: ~azure.mgmt.synapse.models.ClusterPrincipalAssignmentCheckNameRequest + :type principal_assignment_name: + ~azure.mgmt.synapse.models.ClusterPrincipalAssignmentCheckNameRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameResult, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.CheckNameResult @@ -71,39 +78,29 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(principal_assignment_name, 'ClusterPrincipalAssignmentCheckNameRequest') + + request = build_check_name_availability_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(principal_assignment_name, 'ClusterPrincipalAssignmentCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameResult', pipeline_response) @@ -112,8 +109,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/checkPrincipalAssignmentNameAvailability'} # type: ignore + + @distributed_trace def list( self, workspace_name: str, @@ -130,8 +130,10 @@ def list( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ClusterPrincipalAssignmentListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.ClusterPrincipalAssignmentListResult] + :return: An iterator like instance of either ClusterPrincipalAssignmentListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.ClusterPrincipalAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterPrincipalAssignmentListResult"] @@ -139,37 +141,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterPrincipalAssignmentListResult', pipeline_response) + deserialized = self._deserialize("ClusterPrincipalAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -182,17 +182,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments'} # type: ignore + @distributed_trace_async async def get( self, workspace_name: str, @@ -221,35 +223,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + principal_assignment_name=principal_assignment_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterPrincipalAssignment', pipeline_response) @@ -258,8 +250,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}'} # type: ignore + async def _create_or_update_initial( self, workspace_name: str, @@ -274,41 +268,30 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ClusterPrincipalAssignment') + + request = build_create_or_update_request_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + principal_assignment_name=principal_assignment_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ClusterPrincipalAssignment') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ClusterPrincipalAssignment', pipeline_response) @@ -320,8 +303,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, workspace_name: str, @@ -345,15 +331,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.synapse.models.ClusterPrincipalAssignment :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ClusterPrincipalAssignment or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.ClusterPrincipalAssignment] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ClusterPrincipalAssignment or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.ClusterPrincipalAssignment] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterPrincipalAssignment"] lro_delay = kwargs.pop( 'polling_interval', @@ -367,29 +358,21 @@ async def begin_create_or_update( principal_assignment_name=principal_assignment_name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ClusterPrincipalAssignment', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -401,6 +384,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}'} # type: ignore async def _delete_initial( @@ -416,42 +400,33 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + principal_assignment_name=principal_assignment_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, workspace_name: str, @@ -472,15 +447,17 @@ async def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -496,23 +473,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -524,4 +492,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pools_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pools_operations.py index 0db7264d78644..1a492410f05ef 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pools_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pools_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._kusto_pools_operations import build_add_language_extensions_request_initial, build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_detach_follower_databases_request_initial, build_get_request, build_list_by_workspace_request, build_list_follower_databases_request, build_list_language_extensions_request, build_list_skus_by_resource_request, build_list_skus_request, build_remove_language_extensions_request_initial, build_start_request_initial, build_stop_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_skus( self, **kwargs: Any @@ -59,34 +65,29 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_skus.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SkuDescriptionList', pipeline_response) + deserialized = self._deserialize("SkuDescriptionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -99,17 +100,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/skus'} # type: ignore + @distributed_trace_async async def check_name_availability( self, location: str, @@ -132,37 +135,27 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(kusto_pool_name, 'KustoPoolCheckNameRequest') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(kusto_pool_name, 'KustoPoolCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameResult', pipeline_response) @@ -171,8 +164,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/locations/{location}/kustoPoolCheckNameAvailability'} # type: ignore + + @distributed_trace_async async def list_by_workspace( self, resource_group_name: str, @@ -197,33 +193,23 @@ async def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_workspace_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('KustoPoolListResult', pipeline_response) @@ -232,8 +218,11 @@ async def list_by_workspace( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools'} # type: ignore + + @distributed_trace_async async def get( self, workspace_name: str, @@ -259,34 +248,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('KustoPool', pipeline_response) @@ -295,8 +274,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}'} # type: ignore + async def _create_or_update_initial( self, workspace_name: str, @@ -312,44 +293,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - if if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'KustoPool') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'KustoPool') + + request = build_create_or_update_request_initial( + workspace_name=workspace_name, + resource_group_name=resource_group_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + if_none_match=if_none_match, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('KustoPool', pipeline_response) @@ -361,8 +329,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, workspace_name: str, @@ -393,15 +364,19 @@ async def begin_create_or_update( :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either KustoPool or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either KustoPool or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.KustoPool] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.KustoPool"] lro_delay = kwargs.pop( 'polling_interval', @@ -416,28 +391,21 @@ async def begin_create_or_update( parameters=parameters, if_match=if_match, if_none_match=if_none_match, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('KustoPool', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -449,6 +417,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}'} # type: ignore async def _update_initial( @@ -465,42 +434,30 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'KustoPoolUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'KustoPoolUpdate') + + request = build_update_request_initial( + workspace_name=workspace_name, + resource_group_name=resource_group_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('KustoPool', pipeline_response) @@ -512,8 +469,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, workspace_name: str, @@ -539,15 +499,19 @@ async def begin_update( :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either KustoPool or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either KustoPool or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.KustoPool] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.KustoPool"] lro_delay = kwargs.pop( 'polling_interval', @@ -561,28 +525,21 @@ async def begin_update( kusto_pool_name=kusto_pool_name, parameters=parameters, if_match=if_match, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('KustoPool', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -594,6 +551,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}'} # type: ignore async def _delete_initial( @@ -608,41 +566,32 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + workspace_name=workspace_name, + resource_group_name=resource_group_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, workspace_name: str, @@ -660,15 +609,17 @@ async def begin_delete( :type kusto_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -683,22 +634,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -710,6 +653,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}'} # type: ignore async def _stop_initial( @@ -724,41 +668,32 @@ async def _stop_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_stop_request_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/stop'} # type: ignore + + @distributed_trace_async async def begin_stop( self, workspace_name: str, @@ -776,15 +711,17 @@ async def begin_stop( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -799,22 +736,14 @@ async def begin_stop( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -826,6 +755,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/stop'} # type: ignore async def _start_initial( @@ -840,41 +770,32 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_start_request_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, workspace_name: str, @@ -892,15 +813,17 @@ async def begin_start( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -915,22 +838,14 @@ async def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -942,8 +857,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/start'} # type: ignore + @distributed_trace def list_skus_by_resource( self, workspace_name: str, @@ -960,8 +877,10 @@ def list_skus_by_resource( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListResourceSkusResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.ListResourceSkusResult] + :return: An iterator like instance of either ListResourceSkusResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.ListResourceSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListResourceSkusResult"] @@ -969,37 +888,35 @@ def list_skus_by_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_skus_by_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_by_resource_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_skus_by_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_by_resource_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ListResourceSkusResult', pipeline_response) + deserialized = self._deserialize("ListResourceSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1012,17 +929,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_skus_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/skus'} # type: ignore + @distributed_trace def list_language_extensions( self, workspace_name: str, @@ -1039,8 +958,10 @@ def list_language_extensions( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either LanguageExtensionsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.LanguageExtensionsList] + :return: An iterator like instance of either LanguageExtensionsList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.LanguageExtensionsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.LanguageExtensionsList"] @@ -1048,37 +969,35 @@ def list_language_extensions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_language_extensions.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_language_extensions_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_language_extensions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_language_extensions_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('LanguageExtensionsList', pipeline_response) + deserialized = self._deserialize("LanguageExtensionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1091,12 +1010,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1115,46 +1035,37 @@ async def _add_language_extensions_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._add_language_extensions_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(language_extensions_to_add, 'LanguageExtensionsList') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_add_language_extensions_request_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._add_language_extensions_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(language_extensions_to_add, 'LanguageExtensionsList') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _add_language_extensions_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/addLanguageExtensions'} # type: ignore + + @distributed_trace_async async def begin_add_language_extensions( self, workspace_name: str, @@ -1175,15 +1086,18 @@ async def begin_add_language_extensions( :type language_extensions_to_add: ~azure.mgmt.synapse.models.LanguageExtensionsList :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1196,25 +1110,18 @@ async def begin_add_language_extensions( kusto_pool_name=kusto_pool_name, resource_group_name=resource_group_name, language_extensions_to_add=language_extensions_to_add, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1226,6 +1133,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_add_language_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/addLanguageExtensions'} # type: ignore async def _remove_language_extensions_initial( @@ -1241,46 +1149,37 @@ async def _remove_language_extensions_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._remove_language_extensions_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(language_extensions_to_remove, 'LanguageExtensionsList') + + request = build_remove_language_extensions_request_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._remove_language_extensions_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(language_extensions_to_remove, 'LanguageExtensionsList') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _remove_language_extensions_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/removeLanguageExtensions'} # type: ignore + + @distributed_trace_async async def begin_remove_language_extensions( self, workspace_name: str, @@ -1301,15 +1200,18 @@ async def begin_remove_language_extensions( :type language_extensions_to_remove: ~azure.mgmt.synapse.models.LanguageExtensionsList :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1322,25 +1224,18 @@ async def begin_remove_language_extensions( kusto_pool_name=kusto_pool_name, resource_group_name=resource_group_name, language_extensions_to_remove=language_extensions_to_remove, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1352,8 +1247,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_remove_language_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/removeLanguageExtensions'} # type: ignore + @distributed_trace def list_follower_databases( self, workspace_name: str, @@ -1371,8 +1268,10 @@ def list_follower_databases( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FollowerDatabaseListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.FollowerDatabaseListResult] + :return: An iterator like instance of either FollowerDatabaseListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.FollowerDatabaseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FollowerDatabaseListResult"] @@ -1380,37 +1279,35 @@ def list_follower_databases( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_follower_databases.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_follower_databases_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_follower_databases.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_follower_databases_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('FollowerDatabaseListResult', pipeline_response) + deserialized = self._deserialize("FollowerDatabaseListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1423,12 +1320,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1447,46 +1345,37 @@ async def _detach_follower_databases_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._detach_follower_databases_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(follower_database_to_remove, 'FollowerDatabaseDefinition') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_detach_follower_databases_request_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._detach_follower_databases_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(follower_database_to_remove, 'FollowerDatabaseDefinition') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _detach_follower_databases_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/detachFollowerDatabases'} # type: ignore + + @distributed_trace_async async def begin_detach_follower_databases( self, workspace_name: str, @@ -1507,15 +1396,18 @@ async def begin_detach_follower_databases( :type follower_database_to_remove: ~azure.mgmt.synapse.models.FollowerDatabaseDefinition :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1528,25 +1420,18 @@ async def begin_detach_follower_databases( kusto_pool_name=kusto_pool_name, resource_group_name=resource_group_name, follower_database_to_remove=follower_database_to_remove, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1558,4 +1443,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_detach_follower_databases.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/detachFollowerDatabases'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_libraries_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_libraries_operations.py index a0ec176edc3a1..b16deb728b82a 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_libraries_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_libraries_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._libraries_operations import build_list_by_workspace_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_workspace( self, resource_group_name: str, @@ -65,36 +71,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('LibraryListResponse', pipeline_response) + deserialized = self._deserialize("LibraryListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,12 +110,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_library_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_library_operations.py index bb03b6eff83cc..a252a18c8543a 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_library_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_library_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._library_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -67,34 +72,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'libraryName': self._serialize.url("library_name", library_name, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + library_name=library_name, + workspace_name=workspace_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LibraryResource', pipeline_response) @@ -103,4 +98,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/libraries/{libraryName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_operations.py index b679e5fe82845..ad45f1b07b69e 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_check_name_availability_request, build_get_azure_async_header_result_request, build_get_location_header_result_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, request: "_models.CheckNameAvailabilityRequest", @@ -61,36 +66,26 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(request, 'CheckNameAvailabilityRequest') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(request, 'CheckNameAvailabilityRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameAvailabilityResponse', pipeline_response) @@ -99,8 +94,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/checkNameAvailability'} # type: ignore + + @distributed_trace_async async def list( self, **kwargs: Any @@ -119,25 +117,20 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('[AvailableRpOperation]', pipeline_response) @@ -146,8 +139,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/providers/Microsoft.Synapse/operations'} # type: ignore + + @distributed_trace_async async def get_location_header_result( self, resource_group_name: str, @@ -175,34 +171,24 @@ async def get_location_header_result( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_location_header_result.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_location_header_result_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + operation_id=operation_id, + template_url=self.get_location_header_result.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -210,6 +196,8 @@ async def get_location_header_result( get_location_header_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/operationResults/{operationId}'} # type: ignore + + @distributed_trace_async async def get_azure_async_header_result( self, resource_group_name: str, @@ -237,34 +225,24 @@ async def get_azure_async_header_result( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_azure_async_header_result.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_azure_async_header_result_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + operation_id=operation_id, + template_url=self.get_azure_async_header_result.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -275,4 +253,6 @@ async def get_azure_async_header_result( return cls(pipeline_response, deserialized, {}) return deserialized + get_azure_async_header_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/operationStatuses/{operationId}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_endpoint_connections_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_endpoint_connections_operations.py index ebc4eb17fe6ba..e58ba722630cf 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_endpoint_connections_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_endpoint_connections_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -68,34 +74,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -104,8 +100,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -119,40 +117,29 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(request, 'PrivateEndpointConnection') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(request, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -164,8 +151,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -186,15 +176,20 @@ async def begin_create( :type request: ~azure.mgmt.synapse.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +202,21 @@ async def begin_create( workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, request=request, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,6 +228,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore async def _delete_initial( @@ -254,35 +243,24 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 202: @@ -292,8 +270,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -311,15 +292,18 @@ async def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OperationResource or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.OperationResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -334,25 +318,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -364,8 +340,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -379,8 +357,10 @@ def list( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.PrivateEndpointConnectionList] + :return: An iterator like instance of either PrivateEndpointConnectionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.PrivateEndpointConnectionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionList"] @@ -388,36 +368,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionList', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -430,12 +407,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_endpoint_connections_private_link_hub_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_endpoint_connections_private_link_hub_operations.py index 07700d3371417..9465b5b468346 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_endpoint_connections_private_link_hub_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_endpoint_connections_private_link_hub_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_endpoint_connections_private_link_hub_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -54,8 +60,11 @@ def list( :param private_link_hub_name: Name of the privateLinkHub. :type private_link_hub_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse] + :return: An iterator like instance of either + PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse"] @@ -63,36 +72,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateLinkHubName': self._serialize.url("private_link_hub_name", private_link_hub_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_link_hub_name=private_link_hub_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_link_hub_name=private_link_hub_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,17 +111,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}/privateEndpointConnections'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -141,34 +149,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateLinkHubName': self._serialize.url("private_link_hub_name", private_link_hub_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_link_hub_name=private_link_hub_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnectionForPrivateLinkHub', pipeline_response) @@ -177,4 +175,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_link_hub_private_link_resources_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_link_hub_private_link_resources_operations.py index f0b2e847f4b51..ac8d17bb8e67b 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_link_hub_private_link_resources_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_link_hub_private_link_resources_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_link_hub_private_link_resources_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -56,8 +62,10 @@ def list( :param private_link_hub_name: The name of the private link hub. :type private_link_hub_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.PrivateLinkResourceListResult] + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] @@ -65,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateLinkHubName': self._serialize.url("private_link_hub_name", private_link_hub_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_link_hub_name=private_link_hub_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_link_hub_name=private_link_hub_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,17 +112,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}/privateLinkResources'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -145,34 +152,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateLinkHubName': self._serialize.url("private_link_hub_name", private_link_hub_name, 'str'), - 'privateLinkResourceName': self._serialize.url("private_link_resource_name", private_link_resource_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_link_hub_name=private_link_hub_name, + private_link_resource_name=private_link_resource_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResource', pipeline_response) @@ -181,4 +178,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}/privateLinkResources/{privateLinkResourceName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_link_hubs_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_link_hubs_operations.py index df8a36a0bc197..9a75fbf49da46 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_link_hubs_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_link_hubs_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_link_hubs_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -53,8 +59,10 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkHubInfoListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.PrivateLinkHubInfoListResult] + :return: An iterator like instance of either PrivateLinkHubInfoListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.PrivateLinkHubInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkHubInfoListResult"] @@ -62,35 +70,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkHubInfoListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkHubInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,17 +107,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -136,33 +142,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateLinkHubName': self._serialize.url("private_link_hub_name", private_link_hub_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_link_hub_name=private_link_hub_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkHub', pipeline_response) @@ -171,8 +167,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -198,38 +197,28 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateLinkHubName': self._serialize.url("private_link_hub_name", private_link_hub_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(private_link_hub_patch_info, 'PrivateLinkHubPatchInfo') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_link_hub_name=private_link_hub_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_link_hub_patch_info, 'PrivateLinkHubPatchInfo') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -242,8 +231,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -269,38 +261,28 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateLinkHubName': self._serialize.url("private_link_hub_name", private_link_hub_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(private_link_hub_info, 'PrivateLinkHub') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_link_hub_name=private_link_hub_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_link_hub_info, 'PrivateLinkHub') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -313,8 +295,10 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -326,40 +310,31 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateLinkHubName': self._serialize.url("private_link_hub_name", private_link_hub_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_link_hub_name=private_link_hub_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -374,15 +349,17 @@ async def begin_delete( :type private_link_hub_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -396,21 +373,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateLinkHubName': self._serialize.url("private_link_hub_name", private_link_hub_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -422,8 +392,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -431,8 +403,10 @@ def list( """Returns a list of privateLinkHubs in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkHubInfoListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.PrivateLinkHubInfoListResult] + :return: An iterator like instance of either PrivateLinkHubInfoListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.PrivateLinkHubInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkHubInfoListResult"] @@ -440,34 +414,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkHubInfoListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkHubInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -480,12 +449,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_link_resources_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_link_resources_operations.py index 84333ed116c51..a1d093f0feba9 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_link_resources_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_link_resources_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_link_resources_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -56,8 +62,10 @@ def list( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.PrivateLinkResourceListResult] + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] @@ -65,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,17 +112,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateLinkResources'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -145,34 +152,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'privateLinkResourceName': self._serialize.url("private_link_resource_name", private_link_resource_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + private_link_resource_name=private_link_resource_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResource', pipeline_response) @@ -181,4 +178,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateLinkResources/{privateLinkResourceName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_restorable_dropped_sql_pools_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_restorable_dropped_sql_pools_operations.py index 3906fed2005dc..d9dd5c5c747a5 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_restorable_dropped_sql_pools_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_restorable_dropped_sql_pools_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._restorable_dropped_sql_pools_operations import build_get_request, build_list_by_workspace_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -67,34 +73,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'restorableDroppedSqlPoolId': self._serialize.url("restorable_dropped_sql_pool_id", restorable_dropped_sql_pool_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + restorable_dropped_sql_pool_id=restorable_dropped_sql_pool_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RestorableDroppedSqlPool', pipeline_response) @@ -103,8 +99,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/restorableDroppedSqlPools/{restorableDroppedSqlPoolId}'} # type: ignore + + @distributed_trace def list_by_workspace( self, resource_group_name: str, @@ -118,8 +117,10 @@ def list_by_workspace( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RestorableDroppedSqlPoolListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.RestorableDroppedSqlPoolListResult] + :return: An iterator like instance of either RestorableDroppedSqlPoolListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.RestorableDroppedSqlPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableDroppedSqlPoolListResult"] @@ -127,36 +128,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RestorableDroppedSqlPoolListResult', pipeline_response) + deserialized = self._deserialize("RestorableDroppedSqlPoolListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -169,12 +167,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_spark_configuration_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_spark_configuration_operations.py index 53dbc1e4a973a..edb7e74a3cf72 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_spark_configuration_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_spark_configuration_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._spark_configuration_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -67,34 +72,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'sparkConfigurationName': self._serialize.url("spark_configuration_name", spark_configuration_name, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + spark_configuration_name=spark_configuration_name, + workspace_name=workspace_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SparkConfigurationResource', pipeline_response) @@ -103,4 +98,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sparkconfigurations/{sparkConfigurationName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_spark_configurations_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_spark_configurations_operations.py index 3544d3d13d553..94b3a88e1c60f 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_spark_configurations_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_spark_configurations_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._spark_configurations_operations import build_list_by_workspace_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_workspace( self, resource_group_name: str, @@ -56,8 +62,10 @@ def list_by_workspace( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SparkConfigurationListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.SparkConfigurationListResponse] + :return: An iterator like instance of either SparkConfigurationListResponse or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.SparkConfigurationListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SparkConfigurationListResponse"] @@ -65,36 +73,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SparkConfigurationListResponse', pipeline_response) + deserialized = self._deserialize("SparkConfigurationListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,12 +112,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_blob_auditing_policies_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_blob_auditing_policies_operations.py index 4a799d151de6d..6123921790a7f 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_blob_auditing_policies_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_blob_auditing_policies_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_blob_auditing_policies_operations import build_create_or_update_request, build_get_request, build_list_by_sql_pool_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -68,30 +74,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - blob_auditing_policy_name = "default" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -105,8 +99,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/auditingSettings/{blobAuditingPolicyName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -137,35 +134,23 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - blob_auditing_policy_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'SqlPoolBlobAuditingPolicy') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SqlPoolBlobAuditingPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,8 +168,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/auditingSettings/{blobAuditingPolicyName}'} # type: ignore + + @distributed_trace def list_by_sql_pool( self, resource_group_name: str, @@ -201,8 +189,10 @@ def list_by_sql_pool( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlPoolBlobAuditingPolicyListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.SqlPoolBlobAuditingPolicyListResult] + :return: An iterator like instance of either SqlPoolBlobAuditingPolicyListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.SqlPoolBlobAuditingPolicyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolBlobAuditingPolicyListResult"] @@ -210,37 +200,35 @@ def list_by_sql_pool( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_sql_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_sql_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list_by_sql_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_sql_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SqlPoolBlobAuditingPolicyListResult', pipeline_response) + deserialized = self._deserialize("SqlPoolBlobAuditingPolicyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -258,6 +246,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_columns_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_columns_operations.py index 4560fb2cf8f4d..1df6c7b7acce3 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_columns_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_columns_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_columns_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -74,31 +79,21 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), - 'tableName': self._serialize.url("table_name", table_name, 'str'), - 'columnName': self._serialize.url("column_name", column_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + table_name=table_name, + column_name=column_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -112,4 +107,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_connection_policies_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_connection_policies_operations.py index 23d38b607ef20..6ec4b790f9984 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_connection_policies_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_connection_policies_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_connection_policies_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -70,35 +75,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'connectionPolicyName': self._serialize.url("connection_policy_name", connection_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + connection_policy_name=connection_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SqlPoolConnectionPolicy', pipeline_response) @@ -107,4 +102,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/connectionPolicies/{connectionPolicyName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_data_warehouse_user_activities_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_data_warehouse_user_activities_operations.py index 1e80974ed6365..05d9b17380a9e 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_data_warehouse_user_activities_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_data_warehouse_user_activities_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_data_warehouse_user_activities_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -59,7 +64,8 @@ async def get( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param data_warehouse_user_activity_name: The activity name of the Sql pool. - :type data_warehouse_user_activity_name: str or ~azure.mgmt.synapse.models.DataWarehouseUserActivityName + :type data_warehouse_user_activity_name: str or + ~azure.mgmt.synapse.models.DataWarehouseUserActivityName :keyword callable cls: A custom type or function that will be passed the direct response :return: DataWarehouseUserActivities, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.DataWarehouseUserActivities @@ -70,29 +76,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'dataWarehouseUserActivityName': self._serialize.url("data_warehouse_user_activity_name", data_warehouse_user_activity_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + data_warehouse_user_activity_name=data_warehouse_user_activity_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,4 +102,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataWarehouseUserActivities/{dataWarehouseUserActivityName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_geo_backup_policies_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_geo_backup_policies_operations.py index a38f66948bf73..87aa546d536c0 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_geo_backup_policies_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_geo_backup_policies_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_geo_backup_policies_operations import build_create_or_update_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -59,8 +65,10 @@ def list( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GeoBackupPolicyListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.GeoBackupPolicyListResult] + :return: An iterator like instance of either GeoBackupPolicyListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.GeoBackupPolicyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.GeoBackupPolicyListResult"] @@ -68,37 +76,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('GeoBackupPolicyListResult', pipeline_response) + deserialized = self._deserialize("GeoBackupPolicyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,17 +117,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/geoBackupPolicies'} # type: ignore + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -153,40 +161,30 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'geoBackupPolicyName': self._serialize.url("geo_backup_policy_name", geo_backup_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'GeoBackupPolicy') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + geo_backup_policy_name=geo_backup_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'GeoBackupPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -199,8 +197,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/geoBackupPolicies/{geoBackupPolicyName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -231,35 +232,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'geoBackupPolicyName': self._serialize.url("geo_backup_policy_name", geo_backup_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + geo_backup_policy_name=geo_backup_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GeoBackupPolicy', pipeline_response) @@ -268,4 +259,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/geoBackupPolicies/{geoBackupPolicyName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_maintenance_window_options_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_maintenance_window_options_operations.py index ce4f33e393102..a90f0e3ce1b82 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_maintenance_window_options_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_maintenance_window_options_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_maintenance_window_options_operations import build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -70,29 +75,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['maintenanceWindowOptionsName'] = self._serialize.query("maintenance_window_options_name", maintenance_window_options_name, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + maintenance_window_options_name=maintenance_window_options_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -106,4 +101,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/maintenanceWindowOptions/current'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_maintenance_windows_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_maintenance_windows_operations.py index 891571c8ee667..b94a954838b22 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_maintenance_windows_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_maintenance_windows_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_maintenance_windows_operations import build_create_or_update_request, build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -70,35 +75,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['maintenanceWindowName'] = self._serialize.query("maintenance_window_name", maintenance_window_name, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + maintenance_window_name=maintenance_window_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MaintenanceWindows', pipeline_response) @@ -107,8 +102,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/maintenancewindows/current'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -143,32 +141,24 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['maintenanceWindowName'] = self._serialize.query("maintenance_window_name", maintenance_window_name, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'MaintenanceWindows') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + content_type=content_type, + maintenance_window_name=maintenance_window_name, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'MaintenanceWindows') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -180,3 +170,4 @@ async def create_or_update( return cls(pipeline_response, None, {}) create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/maintenancewindows/current'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_metadata_sync_configs_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_metadata_sync_configs_operations.py index 1376707baa177..b2261f4eb1975 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_metadata_sync_configs_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_metadata_sync_configs_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_metadata_sync_configs_operations import build_create_request, build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -67,34 +72,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -105,8 +100,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/metadataSync/config'} # type: ignore + + @distributed_trace_async async def create( self, resource_group_name: str, @@ -137,39 +135,29 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(metadata_sync_configuration, 'MetadataSyncConfig') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(metadata_sync_configuration, 'MetadataSyncConfig') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -180,4 +168,6 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/metadataSync/config'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_operation_results_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_operation_results_operations.py index dbca65c82866d..abf95aae01867 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_operation_results_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_operation_results_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_operation_results_operations import build_get_location_header_result_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get_location_header_result( self, resource_group_name: str, @@ -70,35 +75,25 @@ async def get_location_header_result( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_location_header_result.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_location_header_result_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + operation_id=operation_id, + template_url=self.get_location_header_result.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -111,4 +106,6 @@ async def get_location_header_result( return cls(pipeline_response, deserialized, {}) return deserialized + get_location_header_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/operationResults/{operationId}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_operations_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_operations_operations.py index 9b3d476d78770..d1f13df13b04e 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_operations_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_operations_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_operations_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -59,8 +65,10 @@ def list( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlPoolBlobAuditingPolicySqlPoolOperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.SqlPoolBlobAuditingPolicySqlPoolOperationListResult] + :return: An iterator like instance of either + SqlPoolBlobAuditingPolicySqlPoolOperationListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.SqlPoolBlobAuditingPolicySqlPoolOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolBlobAuditingPolicySqlPoolOperationListResult"] @@ -68,37 +76,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SqlPoolBlobAuditingPolicySqlPoolOperationListResult', pipeline_response) + deserialized = self._deserialize("SqlPoolBlobAuditingPolicySqlPoolOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,6 +122,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_recommended_sensitivity_labels_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_recommended_sensitivity_labels_operations.py index 91bb5f42d4022..74907088775a3 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_recommended_sensitivity_labels_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_recommended_sensitivity_labels_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_recommended_sensitivity_labels_operations import build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def update( self, resource_group_name: str, @@ -68,31 +73,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'RecommendedSensitivityLabelUpdateList') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RecommendedSensitivityLabelUpdateList') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,3 +101,4 @@ async def update( return cls(pipeline_response, None, {}) update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/recommendedSensitivityLabels'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_replication_links_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_replication_links_operations.py index 738c4d4cb58fe..6a730dbc7fd45 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_replication_links_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_replication_links_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_replication_links_operations import build_get_by_name_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -59,8 +65,10 @@ def list( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationLinkListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.ReplicationLinkListResult] + :return: An iterator like instance of either ReplicationLinkListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.ReplicationLinkListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationLinkListResult"] @@ -68,37 +76,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ReplicationLinkListResult', pipeline_response) + deserialized = self._deserialize("ReplicationLinkListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,17 +117,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/replicationLinks'} # type: ignore + @distributed_trace_async async def get_by_name( self, resource_group_name: str, @@ -152,35 +160,25 @@ async def get_by_name( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_by_name.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'linkId': self._serialize.url("link_id", link_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_by_name_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + link_id=link_id, + template_url=self.get_by_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ReplicationLink', pipeline_response) @@ -189,4 +187,6 @@ async def get_by_name( return cls(pipeline_response, deserialized, {}) return deserialized + get_by_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/replicationLinks/{linkId}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_restore_points_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_restore_points_operations.py index d03f8ebf5b998..c28f577b38cee 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_restore_points_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_restore_points_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_restore_points_operations import build_create_request_initial, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -61,8 +67,10 @@ def list( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RestorePointListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.RestorePointListResult] + :return: An iterator like instance of either RestorePointListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.RestorePointListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointListResult"] @@ -70,37 +78,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RestorePointListResult', pipeline_response) + deserialized = self._deserialize("RestorePointListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,12 +119,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -137,33 +144,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'CreateSqlPoolRestorePointDefinition') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CreateSqlPoolRestorePointDefinition') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -182,8 +179,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -204,15 +204,19 @@ async def begin_create( :type parameters: ~azure.mgmt.synapse.models.CreateSqlPoolRestorePointDefinition :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either RestorePoint or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RestorePoint or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.RestorePoint] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -225,28 +229,21 @@ async def begin_create( workspace_name=workspace_name, sql_pool_name=sql_pool_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('RestorePoint', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -258,8 +255,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -288,29 +287,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + restore_point_name=restore_point_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -324,8 +313,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints/{restorePointName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -354,27 +346,19 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + restore_point_name=restore_point_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -386,3 +370,4 @@ async def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints/{restorePointName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_schemas_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_schemas_operations.py index 42563647c45ca..5128fd727ca7d 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_schemas_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_schemas_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_schemas_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -62,8 +68,10 @@ def list( :param filter: An OData filter expression that filters elements in the collection. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlPoolSchemaListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.SqlPoolSchemaListResult] + :return: An iterator like instance of either SqlPoolSchemaListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.SqlPoolSchemaListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolSchemaListResult"] @@ -71,39 +79,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SqlPoolSchemaListResult', pipeline_response) + deserialized = self._deserialize("SqlPoolSchemaListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -121,11 +127,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -154,29 +162,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -190,4 +188,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_security_alert_policies_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_security_alert_policies_operations.py index ef56587e5159f..56083649ed55a 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_security_alert_policies_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_security_alert_policies_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_security_alert_policies_operations import build_create_or_update_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -59,8 +65,10 @@ def list( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListSqlPoolSecurityAlertPolicies or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.ListSqlPoolSecurityAlertPolicies] + :return: An iterator like instance of either ListSqlPoolSecurityAlertPolicies or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.ListSqlPoolSecurityAlertPolicies] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListSqlPoolSecurityAlertPolicies"] @@ -68,37 +76,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ListSqlPoolSecurityAlertPolicies', pipeline_response) + deserialized = self._deserialize("ListSqlPoolSecurityAlertPolicies", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,11 +122,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -151,29 +159,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'securityAlertPolicyName': self._serialize.url("security_alert_policy_name", security_alert_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + security_alert_policy_name=security_alert_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,8 +185,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies/{securityAlertPolicyName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -222,34 +223,24 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'securityAlertPolicyName': self._serialize.url("security_alert_policy_name", security_alert_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'SqlPoolSecurityAlertPolicy') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + security_alert_policy_name=security_alert_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SqlPoolSecurityAlertPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -267,4 +258,6 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies/{securityAlertPolicyName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_sensitivity_labels_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_sensitivity_labels_operations.py index f109ad916fe7d..a37b848c0be19 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_sensitivity_labels_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_sensitivity_labels_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_sensitivity_labels_operations import build_create_or_update_request, build_delete_request, build_disable_recommendation_request, build_enable_recommendation_request, build_get_request, build_list_current_request, build_list_recommended_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_current( self, resource_group_name: str, @@ -62,8 +68,10 @@ def list_current( :param filter: An OData filter expression that filters elements in the collection. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SensitivityLabelListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.SensitivityLabelListResult] + :return: An iterator like instance of either SensitivityLabelListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.SensitivityLabelListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SensitivityLabelListResult"] @@ -71,39 +79,37 @@ def list_current( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_current.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_current_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + filter=filter, + template_url=self.list_current.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_current_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SensitivityLabelListResult', pipeline_response) + deserialized = self._deserialize("SensitivityLabelListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,17 +122,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_current.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/currentSensitivityLabels'} # type: ignore + @distributed_trace_async async def update( self, resource_group_name: str, @@ -155,31 +163,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SensitivityLabelUpdateList') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SensitivityLabelUpdateList') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -192,6 +192,8 @@ async def update( update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/currentSensitivityLabels'} # type: ignore + + @distributed_trace def list_recommended( self, resource_group_name: str, @@ -221,8 +223,10 @@ def list_recommended( :param filter: An OData filter expression that filters elements in the collection. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SensitivityLabelListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.SensitivityLabelListResult] + :return: An iterator like instance of either SensitivityLabelListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.SensitivityLabelListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SensitivityLabelListResult"] @@ -230,43 +234,41 @@ def list_recommended( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_recommended.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if include_disabled_recommendations is not None: - query_parameters['includeDisabledRecommendations'] = self._serialize.query("include_disabled_recommendations", include_disabled_recommendations, 'bool') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_recommended_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + include_disabled_recommendations=include_disabled_recommendations, + skip_token=skip_token, + filter=filter, + template_url=self.list_recommended.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_recommended_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + include_disabled_recommendations=include_disabled_recommendations, + skip_token=skip_token, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SensitivityLabelListResult', pipeline_response) + deserialized = self._deserialize("SensitivityLabelListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -284,11 +286,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_recommended.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/recommendedSensitivityLabels'} # type: ignore + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -326,38 +330,26 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - sensitivity_label_source = "current" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), - 'tableName': self._serialize.url("table_name", table_name, 'str'), - 'columnName': self._serialize.url("column_name", column_name, 'str'), - 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SensitivityLabel') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + table_name=table_name, + column_name=column_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SensitivityLabel') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -375,8 +367,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -411,31 +406,21 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - sensitivity_label_source = "current" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), - 'tableName': self._serialize.url("table_name", table_name, 'str'), - 'columnName': self._serialize.url("column_name", column_name, 'str'), - 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + table_name=table_name, + column_name=column_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -448,6 +433,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -485,32 +472,22 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), - 'tableName': self._serialize.url("table_name", table_name, 'str'), - 'columnName': self._serialize.url("column_name", column_name, 'str'), - 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + table_name=table_name, + column_name=column_name, + sensitivity_label_source=sensitivity_label_source, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -524,8 +501,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}'} # type: ignore + + @distributed_trace_async async def enable_recommendation( self, resource_group_name: str, @@ -561,31 +541,21 @@ async def enable_recommendation( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - sensitivity_label_source = "recommended" - - # Construct URL - url = self.enable_recommendation.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), - 'tableName': self._serialize.url("table_name", table_name, 'str'), - 'columnName': self._serialize.url("column_name", column_name, 'str'), - 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_enable_recommendation_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + table_name=table_name, + column_name=column_name, + template_url=self.enable_recommendation.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -598,6 +568,8 @@ async def enable_recommendation( enable_recommendation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable'} # type: ignore + + @distributed_trace_async async def disable_recommendation( self, resource_group_name: str, @@ -632,31 +604,21 @@ async def disable_recommendation( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - sensitivity_label_source = "recommended" - - # Construct URL - url = self.disable_recommendation.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), - 'tableName': self._serialize.url("table_name", table_name, 'str'), - 'columnName': self._serialize.url("column_name", column_name, 'str'), - 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_disable_recommendation_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + table_name=table_name, + column_name=column_name, + template_url=self.disable_recommendation.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -668,3 +630,4 @@ async def disable_recommendation( return cls(pipeline_response, None, {}) disable_recommendation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_table_columns_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_table_columns_operations.py index 58c7ad044e8b2..4e16a372344ef 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_table_columns_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_table_columns_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_table_columns_operations import build_list_by_table_name_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_table_name( self, resource_group_name: str, @@ -68,8 +74,10 @@ def list_by_table_name( :param filter: An OData filter expression that filters elements in the collection. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlPoolColumnListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.SqlPoolColumnListResult] + :return: An iterator like instance of either SqlPoolColumnListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.SqlPoolColumnListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolColumnListResult"] @@ -77,41 +85,41 @@ def list_by_table_name( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_table_name.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), - 'tableName': self._serialize.url("table_name", table_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_table_name_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + table_name=table_name, + filter=filter, + template_url=self.list_by_table_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_table_name_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + table_name=table_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SqlPoolColumnListResult', pipeline_response) + deserialized = self._deserialize("SqlPoolColumnListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -129,6 +137,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_tables_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_tables_operations.py index b0746f84f96b5..25f2ae10dd222 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_tables_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_tables_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_tables_operations import build_get_request, build_list_by_schema_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_schema( self, resource_group_name: str, @@ -65,8 +71,10 @@ def list_by_schema( :param filter: An OData filter expression that filters elements in the collection. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlPoolTableListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.SqlPoolTableListResult] + :return: An iterator like instance of either SqlPoolTableListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.SqlPoolTableListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolTableListResult"] @@ -74,40 +82,39 @@ def list_by_schema( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_schema.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_schema_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + filter=filter, + template_url=self.list_by_schema.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_schema_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SqlPoolTableListResult', pipeline_response) + deserialized = self._deserialize("SqlPoolTableListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -125,11 +132,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_schema.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -161,30 +170,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), - 'tableName': self._serialize.url("table_name", table_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + table_name=table_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -198,4 +197,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_transparent_data_encryptions_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_transparent_data_encryptions_operations.py index 8b94f45a79e32..afcda59aef78a 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_transparent_data_encryptions_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_transparent_data_encryptions_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_transparent_data_encryptions_operations import build_create_or_update_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -61,7 +67,8 @@ async def get( :type sql_pool_name: str :param transparent_data_encryption_name: The name of the transparent data encryption configuration. - :type transparent_data_encryption_name: str or ~azure.mgmt.synapse.models.TransparentDataEncryptionName + :type transparent_data_encryption_name: str or + ~azure.mgmt.synapse.models.TransparentDataEncryptionName :keyword callable cls: A custom type or function that will be passed the direct response :return: TransparentDataEncryption, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.TransparentDataEncryption @@ -72,35 +79,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'transparentDataEncryptionName': self._serialize.url("transparent_data_encryption_name", transparent_data_encryption_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + transparent_data_encryption_name=transparent_data_encryption_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TransparentDataEncryption', pipeline_response) @@ -109,8 +106,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption/{transparentDataEncryptionName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -132,7 +132,8 @@ async def create_or_update( :type sql_pool_name: str :param transparent_data_encryption_name: The name of the transparent data encryption configuration. - :type transparent_data_encryption_name: str or ~azure.mgmt.synapse.models.TransparentDataEncryptionName + :type transparent_data_encryption_name: str or + ~azure.mgmt.synapse.models.TransparentDataEncryptionName :param parameters: The required parameters for creating or updating transparent data encryption. :type parameters: ~azure.mgmt.synapse.models.TransparentDataEncryption @@ -146,40 +147,30 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'transparentDataEncryptionName': self._serialize.url("transparent_data_encryption_name", transparent_data_encryption_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'TransparentDataEncryption') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + transparent_data_encryption_name=transparent_data_encryption_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TransparentDataEncryption') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -192,8 +183,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption/{transparentDataEncryptionName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -212,8 +206,10 @@ def list( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TransparentDataEncryptionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.TransparentDataEncryptionListResult] + :return: An iterator like instance of either TransparentDataEncryptionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.TransparentDataEncryptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TransparentDataEncryptionListResult"] @@ -221,37 +217,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TransparentDataEncryptionListResult', pipeline_response) + deserialized = self._deserialize("TransparentDataEncryptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -269,6 +263,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_usages_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_usages_operations.py index ab6534d049efe..d5f0869ebece1 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_usages_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_usages_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_usages_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -59,8 +65,10 @@ def list( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlPoolUsageListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.SqlPoolUsageListResult] + :return: An iterator like instance of either SqlPoolUsageListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.SqlPoolUsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolUsageListResult"] @@ -68,37 +76,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SqlPoolUsageListResult', pipeline_response) + deserialized = self._deserialize("SqlPoolUsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,12 +117,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_vulnerability_assessment_rule_baselines_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_vulnerability_assessment_rule_baselines_operations.py index fbdde7d01d774..21b7b9bba91cc 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_vulnerability_assessment_rule_baselines_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_vulnerability_assessment_rule_baselines_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_vulnerability_assessment_rule_baselines_operations import build_create_or_update_request, build_delete_request, build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -60,12 +65,14 @@ async def create_or_update( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :param rule_id: The vulnerability assessment rule ID. :type rule_id: str :param baseline_name: The name of the vulnerability assessment rule baseline (default implies a baseline on a Sql pool level rule and master for workspace level rule). - :type baseline_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentPolicyBaselineName + :type baseline_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentPolicyBaselineName :param parameters: The requested rule baseline resource. :type parameters: ~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessmentRuleBaseline :keyword callable cls: A custom type or function that will be passed the direct response @@ -78,36 +85,26 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), - 'baselineName': self._serialize.url("baseline_name", baseline_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SqlPoolVulnerabilityAssessmentRuleBaseline') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + vulnerability_assessment_name=vulnerability_assessment_name, + rule_id=rule_id, + baseline_name=baseline_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SqlPoolVulnerabilityAssessmentRuleBaseline') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -121,8 +118,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -142,12 +142,14 @@ async def delete( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :param rule_id: The vulnerability assessment rule ID. :type rule_id: str :param baseline_name: The name of the vulnerability assessment rule baseline (default implies a baseline on a Sql pool level rule and master for workspace level rule). - :type baseline_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentPolicyBaselineName + :type baseline_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentPolicyBaselineName :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -158,29 +160,21 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), - 'baselineName': self._serialize.url("baseline_name", baseline_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + vulnerability_assessment_name=vulnerability_assessment_name, + rule_id=rule_id, + baseline_name=baseline_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -193,6 +187,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -212,12 +208,14 @@ async def get( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :param rule_id: The vulnerability assessment rule ID. :type rule_id: str :param baseline_name: The name of the vulnerability assessment rule baseline (default implies a baseline on a Sql pool level rule and master for server level rule). - :type baseline_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentPolicyBaselineName + :type baseline_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentPolicyBaselineName :keyword callable cls: A custom type or function that will be passed the direct response :return: SqlPoolVulnerabilityAssessmentRuleBaseline, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessmentRuleBaseline @@ -228,31 +226,21 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), - 'baselineName': self._serialize.url("baseline_name", baseline_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + vulnerability_assessment_name=vulnerability_assessment_name, + rule_id=rule_id, + baseline_name=baseline_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -266,4 +254,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_vulnerability_assessment_scans_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_vulnerability_assessment_scans_operations.py index 484a4f4ec3f18..7515a2a15b502 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_vulnerability_assessment_scans_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_vulnerability_assessment_scans_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_vulnerability_assessment_scans_operations import build_export_request, build_get_request, build_initiate_scan_request_initial, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -62,10 +68,13 @@ def list( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VulnerabilityAssessmentScanRecordListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.VulnerabilityAssessmentScanRecordListResult] + :return: An iterator like instance of either VulnerabilityAssessmentScanRecordListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.VulnerabilityAssessmentScanRecordListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VulnerabilityAssessmentScanRecordListResult"] @@ -73,38 +82,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + vulnerability_assessment_name=vulnerability_assessment_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + vulnerability_assessment_name=vulnerability_assessment_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VulnerabilityAssessmentScanRecordListResult', pipeline_response) + deserialized = self._deserialize("VulnerabilityAssessmentScanRecordListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -122,6 +130,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -141,28 +150,20 @@ async def _initiate_scan_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._initiate_scan_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - 'scanId': self._serialize.url("scan_id", scan_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_initiate_scan_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + vulnerability_assessment_name=vulnerability_assessment_name, + scan_id=scan_id, + template_url=self._initiate_scan_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -175,6 +176,8 @@ async def _initiate_scan_initial( _initiate_scan_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan'} # type: ignore + + @distributed_trace_async async def begin_initiate_scan( self, resource_group_name: str, @@ -193,20 +196,23 @@ async def begin_initiate_scan( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :param scan_id: The vulnerability assessment scan Id of the scan to retrieve. :type scan_id: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -223,24 +229,14 @@ async def begin_initiate_scan( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - 'scanId': self._serialize.url("scan_id", scan_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -252,8 +248,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_initiate_scan.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan'} # type: ignore + @distributed_trace_async async def export( self, resource_group_name: str, @@ -272,7 +270,8 @@ async def export( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :param scan_id: The vulnerability assessment scan Id of the scan to retrieve. :type scan_id: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -285,30 +284,20 @@ async def export( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.export.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - 'scanId': self._serialize.url("scan_id", scan_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_export_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + vulnerability_assessment_name=vulnerability_assessment_name, + scan_id=scan_id, + template_url=self.export.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -326,8 +315,11 @@ async def export( return cls(pipeline_response, deserialized, {}) return deserialized + export.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -346,7 +338,8 @@ async def get( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :param scan_id: The vulnerability assessment scan Id of the scan to retrieve. :type scan_id: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -359,30 +352,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - 'scanId': self._serialize.url("scan_id", scan_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + vulnerability_assessment_name=vulnerability_assessment_name, + scan_id=scan_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -396,4 +379,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_vulnerability_assessments_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_vulnerability_assessments_operations.py index 3bfe4a04da15d..1775f3c110a35 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_vulnerability_assessments_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_vulnerability_assessments_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_vulnerability_assessments_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -59,8 +65,10 @@ def list( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlPoolVulnerabilityAssessmentListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessmentListResult] + :return: An iterator like instance of either SqlPoolVulnerabilityAssessmentListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolVulnerabilityAssessmentListResult"] @@ -68,37 +76,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SqlPoolVulnerabilityAssessmentListResult', pipeline_response) + deserialized = self._deserialize("SqlPoolVulnerabilityAssessmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,11 +122,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -140,7 +148,8 @@ async def get( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :keyword callable cls: A custom type or function that will be passed the direct response :return: SqlPoolVulnerabilityAssessment, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessment @@ -151,29 +160,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + vulnerability_assessment_name=vulnerability_assessment_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,8 +186,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -209,7 +211,8 @@ async def create_or_update( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :param parameters: The requested resource. :type parameters: ~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessment :keyword callable cls: A custom type or function that will be passed the direct response @@ -222,34 +225,24 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SqlPoolVulnerabilityAssessment') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + vulnerability_assessment_name=vulnerability_assessment_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SqlPoolVulnerabilityAssessment') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -267,8 +260,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -288,7 +284,8 @@ async def delete( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -299,27 +296,19 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + vulnerability_assessment_name=vulnerability_assessment_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -331,3 +320,4 @@ async def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_workload_classifier_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_workload_classifier_operations.py index b1493ab90a326..0ea19fc5d0714 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_workload_classifier_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_workload_classifier_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_workload_classifier_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -76,30 +82,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'workloadGroupName': self._serialize.url("workload_group_name", workload_group_name, 'str'), - 'workloadClassifierName': self._serialize.url("workload_classifier_name", workload_classifier_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + workload_group_name=workload_group_name, + workload_classifier_name=workload_classifier_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -113,8 +109,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -130,35 +128,25 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'workloadGroupName': self._serialize.url("workload_group_name", workload_group_name, 'str'), - 'workloadClassifierName': self._serialize.url("workload_classifier_name", workload_classifier_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'WorkloadClassifier') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + workload_group_name=workload_group_name, + workload_classifier_name=workload_classifier_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'WorkloadClassifier') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,8 +165,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -207,15 +198,19 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.synapse.models.WorkloadClassifier :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either WorkloadClassifier or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadClassifier or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.WorkloadClassifier] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadClassifier"] lro_delay = kwargs.pop( 'polling_interval', @@ -230,30 +225,21 @@ async def begin_create_or_update( workload_group_name=workload_group_name, workload_classifier_name=workload_classifier_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('WorkloadClassifier', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'workloadGroupName': self._serialize.url("workload_group_name", workload_group_name, 'str'), - 'workloadClassifierName': self._serialize.url("workload_classifier_name", workload_classifier_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -265,6 +251,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}'} # type: ignore async def _delete_initial( @@ -281,28 +268,20 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'workloadGroupName': self._serialize.url("workload_group_name", workload_group_name, 'str'), - 'workloadClassifierName': self._serialize.url("workload_classifier_name", workload_classifier_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + workload_group_name=workload_group_name, + workload_classifier_name=workload_classifier_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -315,6 +294,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -340,15 +321,17 @@ async def begin_delete( :type workload_classifier_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -365,24 +348,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'workloadGroupName': self._serialize.url("workload_group_name", workload_group_name, 'str'), - 'workloadClassifierName': self._serialize.url("workload_classifier_name", workload_classifier_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -394,8 +367,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -417,8 +392,10 @@ def list( :param workload_group_name: The name of the workload group. :type workload_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadClassifierListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.WorkloadClassifierListResult] + :return: An iterator like instance of either WorkloadClassifierListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.WorkloadClassifierListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadClassifierListResult"] @@ -426,38 +403,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'workloadGroupName': self._serialize.url("workload_group_name", workload_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + workload_group_name=workload_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + workload_group_name=workload_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('WorkloadClassifierListResult', pipeline_response) + deserialized = self._deserialize("WorkloadClassifierListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -475,6 +451,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_workload_group_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_workload_group_operations.py index a2408c037d629..49e1e4229887a 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_workload_group_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_workload_group_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pool_workload_group_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -73,29 +79,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'workloadGroupName': self._serialize.url("workload_group_name", workload_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + workload_group_name=workload_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,8 +105,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -125,34 +123,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'workloadGroupName': self._serialize.url("workload_group_name", workload_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'WorkloadGroup') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + workload_group_name=workload_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'WorkloadGroup') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -171,8 +159,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -198,15 +189,19 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.synapse.models.WorkloadGroup :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either WorkloadGroup or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadGroup or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.WorkloadGroup] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadGroup"] lro_delay = kwargs.pop( 'polling_interval', @@ -220,29 +215,21 @@ async def begin_create_or_update( sql_pool_name=sql_pool_name, workload_group_name=workload_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('WorkloadGroup', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'workloadGroupName': self._serialize.url("workload_group_name", workload_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -254,6 +241,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}'} # type: ignore async def _delete_initial( @@ -269,27 +257,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'workloadGroupName': self._serialize.url("workload_group_name", workload_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + workload_group_name=workload_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -302,6 +282,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -324,15 +306,17 @@ async def begin_delete( :type workload_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -348,23 +332,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'workloadGroupName': self._serialize.url("workload_group_name", workload_group_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -376,8 +351,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -396,8 +373,10 @@ def list( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadGroupListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.WorkloadGroupListResult] + :return: An iterator like instance of either WorkloadGroupListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.WorkloadGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadGroupListResult"] @@ -405,37 +384,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('WorkloadGroupListResult', pipeline_response) + deserialized = self._deserialize("WorkloadGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -453,6 +430,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pools_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pools_operations.py index 6299c86dc2c0a..9522d43b8a956 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pools_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pools_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._sql_pools_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_workspace_request, build_pause_request_initial, build_rename_request, build_resume_request_initial, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -70,34 +76,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SqlPool', pipeline_response) @@ -106,8 +102,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -138,39 +137,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(sql_pool_info, 'SqlPoolPatchInfo') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(sql_pool_info, 'SqlPoolPatchInfo') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -181,8 +170,10 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -196,40 +187,29 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(sql_pool_info, 'SqlPool') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(sql_pool_info, 'SqlPool') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -239,8 +219,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -263,15 +246,19 @@ async def begin_create( :type sql_pool_info: ~azure.mgmt.synapse.models.SqlPool :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SqlPool or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SqlPool or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.SqlPool] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPool"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,28 +271,21 @@ async def begin_create( workspace_name=workspace_name, sql_pool_name=sql_pool_name, sql_pool_info=sql_pool_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('SqlPool', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -317,6 +297,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} # type: ignore async def _delete_initial( @@ -331,35 +312,24 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -372,8 +342,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -393,15 +366,17 @@ async def begin_delete( :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either any or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[any] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[Any] lro_delay = kwargs.pop( 'polling_interval', @@ -416,25 +391,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('object', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -446,8 +413,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} # type: ignore + @distributed_trace def list_by_workspace( self, resource_group_name: str, @@ -463,8 +432,10 @@ def list_by_workspace( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlPoolInfoListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.SqlPoolInfoListResult] + :return: An iterator like instance of either SqlPoolInfoListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.SqlPoolInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolInfoListResult"] @@ -472,36 +443,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SqlPoolInfoListResult', pipeline_response) + deserialized = self._deserialize("SqlPoolInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -514,12 +482,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -537,35 +506,24 @@ async def _pause_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._pause_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_pause_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self._pause_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -575,8 +533,11 @@ async def _pause_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _pause_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/pause'} # type: ignore + + @distributed_trace_async async def begin_pause( self, resource_group_name: str, @@ -596,15 +557,17 @@ async def begin_pause( :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either any or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[any] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[Any] lro_delay = kwargs.pop( 'polling_interval', @@ -619,25 +582,17 @@ async def begin_pause( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('object', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -649,6 +604,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_pause.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/pause'} # type: ignore async def _resume_initial( @@ -663,35 +619,24 @@ async def _resume_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._resume_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_resume_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self._resume_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -701,8 +646,11 @@ async def _resume_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _resume_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/resume'} # type: ignore + + @distributed_trace_async async def begin_resume( self, resource_group_name: str, @@ -722,15 +670,17 @@ async def begin_resume( :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either any or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[any] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[Any] lro_delay = kwargs.pop( 'polling_interval', @@ -745,25 +695,17 @@ async def begin_resume( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('object', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -775,8 +717,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_resume.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/resume'} # type: ignore + @distributed_trace_async async def rename( self, resource_group_name: str, @@ -807,31 +751,23 @@ async def rename( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.rename.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ResourceMoveDefinition') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + request = build_rename_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + content_type=content_type, + json=_json, + template_url=self.rename.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ResourceMoveDefinition') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -843,3 +779,4 @@ async def rename( return cls(pipeline_response, None, {}) rename.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/move'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_aad_admins_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_aad_admins_operations.py index 9991b8007291b..b0fec2c775bfe 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_aad_admins_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_aad_admins_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._workspace_aad_admins_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -64,33 +69,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) @@ -99,8 +94,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -113,39 +110,28 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(aad_admin_info, 'WorkspaceAadAdminInfo') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(aad_admin_info, 'WorkspaceAadAdminInfo') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) @@ -157,8 +143,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -176,15 +165,19 @@ async def begin_create_or_update( :type aad_admin_info: ~azure.mgmt.synapse.models.WorkspaceAadAdminInfo :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either WorkspaceAadAdminInfo or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkspaceAadAdminInfo or the result + of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.WorkspaceAadAdminInfo] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceAadAdminInfo"] lro_delay = kwargs.pop( 'polling_interval', @@ -196,27 +189,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, aad_admin_info=aad_admin_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -228,6 +215,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory'} # type: ignore async def _delete_initial( @@ -241,40 +229,31 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -289,15 +268,17 @@ async def begin_delete( :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -311,21 +292,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -337,4 +311,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_identity_sql_control_settings_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_identity_sql_control_settings_operations.py index 6c7b687c22da9..cf0893e5fe915 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_identity_sql_control_settings_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_identity_sql_control_settings_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._workspace_managed_identity_sql_control_settings_operations import build_create_or_update_request_initial, build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -66,33 +71,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ManagedIdentitySqlControlSettingsModel', pipeline_response) @@ -101,8 +96,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/managedIdentitySqlControlSettings/default'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -115,39 +112,28 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(managed_identity_sql_control_settings, 'ManagedIdentitySqlControlSettingsModel') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(managed_identity_sql_control_settings, 'ManagedIdentitySqlControlSettingsModel') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -157,8 +143,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/managedIdentitySqlControlSettings/default'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -175,18 +164,24 @@ async def begin_create_or_update( :param workspace_name: The name of the workspace. :type workspace_name: str :param managed_identity_sql_control_settings: Managed Identity Sql Control Settings. - :type managed_identity_sql_control_settings: ~azure.mgmt.synapse.models.ManagedIdentitySqlControlSettingsModel + :type managed_identity_sql_control_settings: + ~azure.mgmt.synapse.models.ManagedIdentitySqlControlSettingsModel :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ManagedIdentitySqlControlSettingsModel or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.ManagedIdentitySqlControlSettingsModel] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either + ManagedIdentitySqlControlSettingsModel or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.ManagedIdentitySqlControlSettingsModel] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedIdentitySqlControlSettingsModel"] lro_delay = kwargs.pop( 'polling_interval', @@ -198,27 +193,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, managed_identity_sql_control_settings=managed_identity_sql_control_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ManagedIdentitySqlControlSettingsModel', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -230,4 +219,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/managedIdentitySqlControlSettings/default'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_blob_auditing_policies_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_blob_auditing_policies_operations.py index 60373fc6c6fc4..db3758e97c801 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_blob_auditing_policies_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_blob_auditing_policies_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._workspace_managed_sql_server_blob_auditing_policies_operations import build_create_or_update_request_initial, build_get_request, build_list_by_workspace_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -70,28 +76,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + blob_auditing_policy_name=blob_auditing_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -105,8 +101,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/auditingSettings/{blobAuditingPolicyName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -120,33 +118,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ServerBlobAuditingPolicy') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + blob_auditing_policy_name=blob_auditing_policy_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServerBlobAuditingPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,8 +150,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/auditingSettings/{blobAuditingPolicyName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -186,15 +177,19 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.synapse.models.ServerBlobAuditingPolicy :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServerBlobAuditingPolicy or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServerBlobAuditingPolicy or the + result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.ServerBlobAuditingPolicy] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerBlobAuditingPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +202,21 @@ async def begin_create_or_update( workspace_name=workspace_name, blob_auditing_policy_name=blob_auditing_policy_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServerBlobAuditingPolicy', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,8 +228,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/auditingSettings/{blobAuditingPolicyName}'} # type: ignore + @distributed_trace def list_by_workspace( self, resource_group_name: str, @@ -257,8 +247,10 @@ def list_by_workspace( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServerBlobAuditingPolicyListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.ServerBlobAuditingPolicyListResult] + :return: An iterator like instance of either ServerBlobAuditingPolicyListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.ServerBlobAuditingPolicyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerBlobAuditingPolicyListResult"] @@ -266,36 +258,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServerBlobAuditingPolicyListResult', pipeline_response) + deserialized = self._deserialize("ServerBlobAuditingPolicyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -313,6 +302,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_encryption_protector_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_encryption_protector_operations.py index ff75ff4df1d06..b16bfcf9016cb 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_encryption_protector_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_encryption_protector_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._workspace_managed_sql_server_encryption_protector_operations import build_create_or_update_request_initial, build_get_request, build_list_request, build_revalidate_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -70,34 +76,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'encryptionProtectorName': self._serialize.url("encryption_protector_name", encryption_protector_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + encryption_protector_name=encryption_protector_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionProtector', pipeline_response) @@ -106,8 +102,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/encryptionProtector/{encryptionProtectorName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -121,40 +119,29 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'encryptionProtectorName': self._serialize.url("encryption_protector_name", encryption_protector_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'EncryptionProtector') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + encryption_protector_name=encryption_protector_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'EncryptionProtector') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -164,8 +151,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/encryptionProtector/{encryptionProtectorName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -188,15 +178,19 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.synapse.models.EncryptionProtector :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either EncryptionProtector or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either EncryptionProtector or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.EncryptionProtector] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.EncryptionProtector"] lro_delay = kwargs.pop( 'polling_interval', @@ -209,28 +203,21 @@ async def begin_create_or_update( workspace_name=workspace_name, encryption_protector_name=encryption_protector_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('EncryptionProtector', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'encryptionProtectorName': self._serialize.url("encryption_protector_name", encryption_protector_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -242,8 +229,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/encryptionProtector/{encryptionProtectorName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -259,8 +248,10 @@ def list( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EncryptionProtectorListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.EncryptionProtectorListResult] + :return: An iterator like instance of either EncryptionProtectorListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.EncryptionProtectorListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.EncryptionProtectorListResult"] @@ -268,36 +259,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('EncryptionProtectorListResult', pipeline_response) + deserialized = self._deserialize("EncryptionProtectorListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -315,6 +303,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -332,26 +321,18 @@ async def _revalidate_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._revalidate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'encryptionProtectorName': self._serialize.url("encryption_protector_name", encryption_protector_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_revalidate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + encryption_protector_name=encryption_protector_name, + template_url=self._revalidate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -364,6 +345,8 @@ async def _revalidate_initial( _revalidate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/encryptionProtector/{encryptionProtectorName}/revalidate'} # type: ignore + + @distributed_trace_async async def begin_revalidate( self, resource_group_name: str, @@ -383,15 +366,17 @@ async def begin_revalidate( :type encryption_protector_name: str or ~azure.mgmt.synapse.models.EncryptionProtectorName :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -406,22 +391,14 @@ async def begin_revalidate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'encryptionProtectorName': self._serialize.url("encryption_protector_name", encryption_protector_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -433,4 +410,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revalidate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/encryptionProtector/{encryptionProtectorName}/revalidate'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_extended_blob_auditing_policies_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_extended_blob_auditing_policies_operations.py index 1c0777e8223a3..bd3d2b1bfabbe 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_extended_blob_auditing_policies_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_extended_blob_auditing_policies_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._workspace_managed_sql_server_extended_blob_auditing_policies_operations import build_create_or_update_request_initial, build_get_request, build_list_by_workspace_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -70,28 +76,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + blob_auditing_policy_name=blob_auditing_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -105,8 +101,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/extendedAuditingSettings/{blobAuditingPolicyName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -120,33 +118,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ExtendedServerBlobAuditingPolicy') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + blob_auditing_policy_name=blob_auditing_policy_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ExtendedServerBlobAuditingPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,8 +150,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/extendedAuditingSettings/{blobAuditingPolicyName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -186,15 +177,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.synapse.models.ExtendedServerBlobAuditingPolicy :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ExtendedServerBlobAuditingPolicy or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.ExtendedServerBlobAuditingPolicy] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExtendedServerBlobAuditingPolicy or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.ExtendedServerBlobAuditingPolicy] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtendedServerBlobAuditingPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +203,21 @@ async def begin_create_or_update( workspace_name=workspace_name, blob_auditing_policy_name=blob_auditing_policy_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ExtendedServerBlobAuditingPolicy', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,8 +229,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/extendedAuditingSettings/{blobAuditingPolicyName}'} # type: ignore + @distributed_trace def list_by_workspace( self, resource_group_name: str, @@ -257,8 +248,10 @@ def list_by_workspace( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtendedServerBlobAuditingPolicyListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.ExtendedServerBlobAuditingPolicyListResult] + :return: An iterator like instance of either ExtendedServerBlobAuditingPolicyListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.ExtendedServerBlobAuditingPolicyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtendedServerBlobAuditingPolicyListResult"] @@ -266,36 +259,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExtendedServerBlobAuditingPolicyListResult', pipeline_response) + deserialized = self._deserialize("ExtendedServerBlobAuditingPolicyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -313,6 +303,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_recoverable_sql_pools_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_recoverable_sql_pools_operations.py index 4431566fd2069..4adf82047b138 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_recoverable_sql_pools_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_recoverable_sql_pools_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._workspace_managed_sql_server_recoverable_sql_pools_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -56,8 +62,10 @@ def list( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RecoverableSqlPoolListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.RecoverableSqlPoolListResult] + :return: An iterator like instance of either RecoverableSqlPoolListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.RecoverableSqlPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoverableSqlPoolListResult"] @@ -65,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('RecoverableSqlPoolListResult', pipeline_response) + deserialized = self._deserialize("RecoverableSqlPoolListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,11 +117,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/recoverableSqlPools'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -144,28 +151,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,4 +176,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/recoverableSqlPools/{sqlPoolName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_security_alert_policy_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_security_alert_policy_operations.py index 0015236d16466..359790a79f46c 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_security_alert_policy_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_security_alert_policy_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._workspace_managed_sql_server_security_alert_policy_operations import build_create_or_update_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -59,7 +65,8 @@ async def get( :param workspace_name: The name of the workspace. :type workspace_name: str :param security_alert_policy_name: The name of the security alert policy. - :type security_alert_policy_name: str or ~azure.mgmt.synapse.models.SecurityAlertPolicyNameAutoGenerated + :type security_alert_policy_name: str or + ~azure.mgmt.synapse.models.SecurityAlertPolicyNameAutoGenerated :keyword callable cls: A custom type or function that will be passed the direct response :return: ServerSecurityAlertPolicy, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.ServerSecurityAlertPolicy @@ -70,28 +77,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'securityAlertPolicyName': self._serialize.url("security_alert_policy_name", security_alert_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + security_alert_policy_name=security_alert_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -105,8 +102,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/securityAlertPolicies/{securityAlertPolicyName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -120,33 +119,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'securityAlertPolicyName': self._serialize.url("security_alert_policy_name", security_alert_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ServerSecurityAlertPolicy') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + security_alert_policy_name=security_alert_policy_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServerSecurityAlertPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,8 +151,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/securityAlertPolicies/{securityAlertPolicyName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -181,20 +173,26 @@ async def begin_create_or_update( :param workspace_name: The name of the workspace. :type workspace_name: str :param security_alert_policy_name: The name of the security alert policy. - :type security_alert_policy_name: str or ~azure.mgmt.synapse.models.SecurityAlertPolicyNameAutoGenerated + :type security_alert_policy_name: str or + ~azure.mgmt.synapse.models.SecurityAlertPolicyNameAutoGenerated :param parameters: The workspace managed sql server security alert policy. :type parameters: ~azure.mgmt.synapse.models.ServerSecurityAlertPolicy :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServerSecurityAlertPolicy or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.ServerSecurityAlertPolicy] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServerSecurityAlertPolicy or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.ServerSecurityAlertPolicy] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerSecurityAlertPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -207,28 +205,21 @@ async def begin_create_or_update( workspace_name=workspace_name, security_alert_policy_name=security_alert_policy_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServerSecurityAlertPolicy', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'securityAlertPolicyName': self._serialize.url("security_alert_policy_name", security_alert_policy_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -240,8 +231,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/securityAlertPolicies/{securityAlertPolicyName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -257,8 +250,10 @@ def list( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServerSecurityAlertPolicyListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.ServerSecurityAlertPolicyListResult] + :return: An iterator like instance of either ServerSecurityAlertPolicyListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.ServerSecurityAlertPolicyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerSecurityAlertPolicyListResult"] @@ -266,36 +261,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServerSecurityAlertPolicyListResult', pipeline_response) + deserialized = self._deserialize("ServerSecurityAlertPolicyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -313,6 +305,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_usages_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_usages_operations.py index 39a1cbbc8e494..7f67bd43497a8 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_usages_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_usages_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._workspace_managed_sql_server_usages_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -56,8 +62,10 @@ def list( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServerUsageListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.ServerUsageListResult] + :return: An iterator like instance of either ServerUsageListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.ServerUsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerUsageListResult"] @@ -65,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServerUsageListResult', pipeline_response) + deserialized = self._deserialize("ServerUsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +117,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_vulnerability_assessments_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_vulnerability_assessments_operations.py index b709c590b67c9..25a00caaf095a 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_vulnerability_assessments_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_vulnerability_assessments_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._workspace_managed_sql_server_vulnerability_assessments_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -57,7 +63,8 @@ async def get( :param workspace_name: The name of the workspace. :type workspace_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :keyword callable cls: A custom type or function that will be passed the direct response :return: ServerVulnerabilityAssessment, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.ServerVulnerabilityAssessment @@ -68,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + vulnerability_assessment_name=vulnerability_assessment_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -103,8 +100,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -122,7 +122,8 @@ async def create_or_update( :param workspace_name: The name of the workspace. :type workspace_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :param parameters: Properties for vulnerability assessment. :type parameters: ~azure.mgmt.synapse.models.ServerVulnerabilityAssessment :keyword callable cls: A custom type or function that will be passed the direct response @@ -135,33 +136,23 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServerVulnerabilityAssessment') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + vulnerability_assessment_name=vulnerability_assessment_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServerVulnerabilityAssessment') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -179,8 +170,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -197,7 +191,8 @@ async def delete( :param workspace_name: The name of the workspace. :type workspace_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -208,26 +203,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + vulnerability_assessment_name=vulnerability_assessment_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,6 +227,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -255,8 +244,10 @@ def list( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServerVulnerabilityAssessmentListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.ServerVulnerabilityAssessmentListResult] + :return: An iterator like instance of either ServerVulnerabilityAssessmentListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.ServerVulnerabilityAssessmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerVulnerabilityAssessmentListResult"] @@ -264,36 +255,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ServerVulnerabilityAssessmentListResult', pipeline_response) + deserialized = self._deserialize("ServerVulnerabilityAssessmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -311,6 +299,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_sql_aad_admins_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_sql_aad_admins_operations.py index 96201bdb9c5f1..f6753a8faa6d5 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_sql_aad_admins_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_sql_aad_admins_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._workspace_sql_aad_admins_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -64,33 +69,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) @@ -99,8 +94,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlAdministrators/activeDirectory'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -113,39 +110,28 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(aad_admin_info, 'WorkspaceAadAdminInfo') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(aad_admin_info, 'WorkspaceAadAdminInfo') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) @@ -157,8 +143,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlAdministrators/activeDirectory'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -176,15 +165,19 @@ async def begin_create_or_update( :type aad_admin_info: ~azure.mgmt.synapse.models.WorkspaceAadAdminInfo :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either WorkspaceAadAdminInfo or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkspaceAadAdminInfo or the result + of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.WorkspaceAadAdminInfo] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceAadAdminInfo"] lro_delay = kwargs.pop( 'polling_interval', @@ -196,27 +189,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, aad_admin_info=aad_admin_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -228,6 +215,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlAdministrators/activeDirectory'} # type: ignore async def _delete_initial( @@ -241,40 +229,31 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlAdministrators/activeDirectory'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -289,15 +268,17 @@ async def begin_delete( :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -311,21 +292,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -337,4 +311,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlAdministrators/activeDirectory'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspaces_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspaces_operations.py index 04d74980a0785..3a2524b9a110d 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspaces_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspaces_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._workspaces_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -53,8 +59,10 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkspaceInfoListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.WorkspaceInfoListResult] + :return: An iterator like instance of either WorkspaceInfoListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.WorkspaceInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceInfoListResult"] @@ -62,35 +70,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('WorkspaceInfoListResult', pipeline_response) + deserialized = self._deserialize("WorkspaceInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,17 +107,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -136,33 +142,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Workspace', pipeline_response) @@ -171,8 +167,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore + async def _update_initial( self, resource_group_name: str, @@ -185,39 +183,28 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(workspace_patch_info, 'WorkspacePatchInfo') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workspace_patch_info, 'WorkspacePatchInfo') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Workspace', pipeline_response) @@ -229,8 +216,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -248,15 +238,19 @@ async def begin_update( :type workspace_patch_info: ~azure.mgmt.synapse.models.WorkspacePatchInfo :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Workspace or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Workspace or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.Workspace] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] lro_delay = kwargs.pop( 'polling_interval', @@ -268,27 +262,21 @@ async def begin_update( resource_group_name=resource_group_name, workspace_name=workspace_name, workspace_patch_info=workspace_patch_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Workspace', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -300,6 +288,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore async def _create_or_update_initial( @@ -314,39 +303,28 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(workspace_info, 'Workspace') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workspace_info, 'Workspace') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Workspace', pipeline_response) @@ -358,8 +336,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -377,15 +358,19 @@ async def begin_create_or_update( :type workspace_info: ~azure.mgmt.synapse.models.Workspace :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Workspace or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Workspace or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.Workspace] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] lro_delay = kwargs.pop( 'polling_interval', @@ -397,27 +382,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, workspace_info=workspace_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Workspace', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -429,6 +408,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore async def _delete_initial( @@ -442,34 +422,23 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -482,8 +451,11 @@ async def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -498,15 +470,17 @@ async def begin_delete( :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either any or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[any] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[Any] lro_delay = kwargs.pop( 'polling_interval', @@ -520,24 +494,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('object', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -549,8 +516,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -558,8 +527,10 @@ def list( """Returns a list of workspaces in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkspaceInfoListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.WorkspaceInfoListResult] + :return: An iterator like instance of either WorkspaceInfoListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.WorkspaceInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceInfoListResult"] @@ -567,34 +538,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('WorkspaceInfoListResult', pipeline_response) + deserialized = self._deserialize("WorkspaceInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -607,12 +573,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/__init__.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/__init__.py index 5587a9fb3620b..c9c72d8bc187a 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/__init__.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/__init__.py @@ -6,506 +6,256 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AttachedDatabaseConfiguration - from ._models_py3 import AttachedDatabaseConfigurationListResult - from ._models_py3 import AutoPauseProperties - from ._models_py3 import AutoScaleProperties - from ._models_py3 import AvailableRpOperation - from ._models_py3 import AvailableRpOperationDisplayInfo - from ._models_py3 import AzureADOnlyAuthentication - from ._models_py3 import AzureADOnlyAuthenticationListResult - from ._models_py3 import AzureCapacity - from ._models_py3 import AzureEntityResource - from ._models_py3 import AzureResourceSku - from ._models_py3 import AzureSku - from ._models_py3 import BigDataPoolPatchInfo - from ._models_py3 import BigDataPoolResourceInfo - from ._models_py3 import BigDataPoolResourceInfoListResult - from ._models_py3 import CheckNameAvailabilityRequest - from ._models_py3 import CheckNameAvailabilityResponse - from ._models_py3 import CheckNameResult - from ._models_py3 import ClusterPrincipalAssignment - from ._models_py3 import ClusterPrincipalAssignmentCheckNameRequest - from ._models_py3 import ClusterPrincipalAssignmentListResult - from ._models_py3 import CmdkeySetup - from ._models_py3 import ComponentSetup - from ._models_py3 import CreateSqlPoolRestorePointDefinition - from ._models_py3 import CspWorkspaceAdminProperties - from ._models_py3 import CustomSetupBase - from ._models_py3 import CustomerManagedKeyDetails - from ._models_py3 import DataConnection - from ._models_py3 import DataConnectionCheckNameRequest - from ._models_py3 import DataConnectionListResult - from ._models_py3 import DataConnectionValidation - from ._models_py3 import DataConnectionValidationListResult - from ._models_py3 import DataConnectionValidationResult - from ._models_py3 import DataLakeStorageAccountDetails - from ._models_py3 import DataMaskingPolicy - from ._models_py3 import DataMaskingRule - from ._models_py3 import DataMaskingRuleListResult - from ._models_py3 import DataWarehouseUserActivities - from ._models_py3 import Database - from ._models_py3 import DatabaseCheckNameRequest - from ._models_py3 import DatabaseListResult - from ._models_py3 import DatabasePrincipalAssignment - from ._models_py3 import DatabasePrincipalAssignmentCheckNameRequest - from ._models_py3 import DatabasePrincipalAssignmentListResult - from ._models_py3 import DatabaseStatistics - from ._models_py3 import DynamicExecutorAllocation - from ._models_py3 import EncryptionDetails - from ._models_py3 import EncryptionProtector - from ._models_py3 import EncryptionProtectorListResult - from ._models_py3 import EntityReference - from ._models_py3 import EnvironmentVariableSetup - from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorDetail - from ._models_py3 import ErrorResponse - from ._models_py3 import EventGridDataConnection - from ._models_py3 import EventHubDataConnection - from ._models_py3 import ExtendedServerBlobAuditingPolicy - from ._models_py3 import ExtendedServerBlobAuditingPolicyListResult - from ._models_py3 import ExtendedSqlPoolBlobAuditingPolicy - from ._models_py3 import ExtendedSqlPoolBlobAuditingPolicyListResult - from ._models_py3 import FollowerDatabaseDefinition - from ._models_py3 import FollowerDatabaseListResult - from ._models_py3 import GeoBackupPolicy - from ._models_py3 import GeoBackupPolicyListResult - from ._models_py3 import GetSsisObjectMetadataRequest - from ._models_py3 import IntegrationRuntime - from ._models_py3 import IntegrationRuntimeAuthKeys - from ._models_py3 import IntegrationRuntimeComputeProperties - from ._models_py3 import IntegrationRuntimeConnectionInfo - from ._models_py3 import IntegrationRuntimeCustomSetupScriptProperties - from ._models_py3 import IntegrationRuntimeDataFlowProperties - from ._models_py3 import IntegrationRuntimeDataProxyProperties - from ._models_py3 import IntegrationRuntimeListResponse - from ._models_py3 import IntegrationRuntimeMonitoringData - from ._models_py3 import IntegrationRuntimeNodeIpAddress - from ._models_py3 import IntegrationRuntimeNodeMonitoringData - from ._models_py3 import IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint - from ._models_py3 import IntegrationRuntimeOutboundNetworkDependenciesEndpoint - from ._models_py3 import IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails - from ._models_py3 import IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse - from ._models_py3 import IntegrationRuntimeRegenerateKeyParameters - from ._models_py3 import IntegrationRuntimeResource - from ._models_py3 import IntegrationRuntimeSsisCatalogInfo - from ._models_py3 import IntegrationRuntimeSsisProperties - from ._models_py3 import IntegrationRuntimeStatus - from ._models_py3 import IntegrationRuntimeStatusResponse - from ._models_py3 import IntegrationRuntimeVNetProperties - from ._models_py3 import IotHubDataConnection - from ._models_py3 import IpFirewallRuleInfo - from ._models_py3 import IpFirewallRuleInfoListResult - from ._models_py3 import IpFirewallRuleProperties - from ._models_py3 import KekIdentityProperties - from ._models_py3 import Key - from ._models_py3 import KeyInfoListResult - from ._models_py3 import KustoPool - from ._models_py3 import KustoPoolCheckNameRequest - from ._models_py3 import KustoPoolListResult - from ._models_py3 import KustoPoolUpdate - from ._models_py3 import LanguageExtension - from ._models_py3 import LanguageExtensionsList - from ._models_py3 import LibraryInfo - from ._models_py3 import LibraryListResponse - from ._models_py3 import LibraryRequirements - from ._models_py3 import LibraryResource - from ._models_py3 import LinkedIntegrationRuntime - from ._models_py3 import LinkedIntegrationRuntimeKeyAuthorization - from ._models_py3 import LinkedIntegrationRuntimeRbacAuthorization - from ._models_py3 import LinkedIntegrationRuntimeType - from ._models_py3 import ListResourceSkusResult - from ._models_py3 import ListSqlPoolSecurityAlertPolicies - from ._models_py3 import MaintenanceWindowOptions - from ._models_py3 import MaintenanceWindowTimeRange - from ._models_py3 import MaintenanceWindows - from ._models_py3 import ManagedIdentity - from ._models_py3 import ManagedIdentitySqlControlSettingsModel - from ._models_py3 import ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity - from ._models_py3 import ManagedIntegrationRuntime - from ._models_py3 import ManagedIntegrationRuntimeError - from ._models_py3 import ManagedIntegrationRuntimeNode - from ._models_py3 import ManagedIntegrationRuntimeOperationResult - from ._models_py3 import ManagedIntegrationRuntimeStatus - from ._models_py3 import ManagedVirtualNetworkSettings - from ._models_py3 import MetadataSyncConfig - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import OperationMetaLogSpecification - from ._models_py3 import OperationMetaMetricDimensionSpecification - from ._models_py3 import OperationMetaMetricSpecification - from ._models_py3 import OperationMetaServiceSpecification - from ._models_py3 import OperationResource - from ._models_py3 import OptimizedAutoscale - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionForPrivateLinkHub - from ._models_py3 import PrivateEndpointConnectionForPrivateLinkHubBasic - from ._models_py3 import PrivateEndpointConnectionForPrivateLinkHubBasicAutoGenerated - from ._models_py3 import PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse - from ._models_py3 import PrivateEndpointConnectionList - from ._models_py3 import PrivateEndpointConnectionProperties - from ._models_py3 import PrivateLinkHub - from ._models_py3 import PrivateLinkHubInfoListResult - from ._models_py3 import PrivateLinkHubPatchInfo - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkResourceProperties - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import ProxyResource - from ._models_py3 import PurviewConfiguration - from ._models_py3 import QueryInterval - from ._models_py3 import QueryMetric - from ._models_py3 import QueryStatistic - from ._models_py3 import ReadWriteDatabase - from ._models_py3 import RecommendedSensitivityLabelUpdate - from ._models_py3 import RecommendedSensitivityLabelUpdateList - from ._models_py3 import RecoverableSqlPool - from ._models_py3 import RecoverableSqlPoolListResult - from ._models_py3 import ReplaceAllFirewallRulesOperationResponse - from ._models_py3 import ReplaceAllIpFirewallRulesRequest - from ._models_py3 import ReplicationLink - from ._models_py3 import ReplicationLinkListResult - from ._models_py3 import Resource - from ._models_py3 import ResourceMoveDefinition - from ._models_py3 import RestorableDroppedSqlPool - from ._models_py3 import RestorableDroppedSqlPoolListResult - from ._models_py3 import RestorePoint - from ._models_py3 import RestorePointListResult - from ._models_py3 import SecretBase - from ._models_py3 import SecureString - from ._models_py3 import SelfHostedIntegrationRuntime - from ._models_py3 import SelfHostedIntegrationRuntimeNode - from ._models_py3 import SelfHostedIntegrationRuntimeStatus - from ._models_py3 import SensitivityLabel - from ._models_py3 import SensitivityLabelListResult - from ._models_py3 import SensitivityLabelUpdate - from ._models_py3 import SensitivityLabelUpdateList - from ._models_py3 import ServerBlobAuditingPolicy - from ._models_py3 import ServerBlobAuditingPolicyListResult - from ._models_py3 import ServerSecurityAlertPolicy - from ._models_py3 import ServerSecurityAlertPolicyListResult - from ._models_py3 import ServerUsage - from ._models_py3 import ServerUsageListResult - from ._models_py3 import ServerVulnerabilityAssessment - from ._models_py3 import ServerVulnerabilityAssessmentListResult - from ._models_py3 import Sku - from ._models_py3 import SkuDescription - from ._models_py3 import SkuDescriptionList - from ._models_py3 import SkuLocationInfoItem - from ._models_py3 import SparkConfigProperties - from ._models_py3 import SparkConfigurationListResponse - from ._models_py3 import SparkConfigurationResource - from ._models_py3 import SqlPool - from ._models_py3 import SqlPoolBlobAuditingPolicy - from ._models_py3 import SqlPoolBlobAuditingPolicyListResult - from ._models_py3 import SqlPoolBlobAuditingPolicySqlPoolOperationListResult - from ._models_py3 import SqlPoolColumn - from ._models_py3 import SqlPoolColumnListResult - from ._models_py3 import SqlPoolConnectionPolicy - from ._models_py3 import SqlPoolInfoListResult - from ._models_py3 import SqlPoolOperation - from ._models_py3 import SqlPoolPatchInfo - from ._models_py3 import SqlPoolSchema - from ._models_py3 import SqlPoolSchemaListResult - from ._models_py3 import SqlPoolSecurityAlertPolicy - from ._models_py3 import SqlPoolTable - from ._models_py3 import SqlPoolTableListResult - from ._models_py3 import SqlPoolUsage - from ._models_py3 import SqlPoolUsageListResult - from ._models_py3 import SqlPoolVulnerabilityAssessment - from ._models_py3 import SqlPoolVulnerabilityAssessmentListResult - from ._models_py3 import SqlPoolVulnerabilityAssessmentRuleBaseline - from ._models_py3 import SqlPoolVulnerabilityAssessmentRuleBaselineItem - from ._models_py3 import SqlPoolVulnerabilityAssessmentScansExport - from ._models_py3 import SsisEnvironment - from ._models_py3 import SsisEnvironmentReference - from ._models_py3 import SsisFolder - from ._models_py3 import SsisObjectMetadata - from ._models_py3 import SsisObjectMetadataListResponse - from ._models_py3 import SsisObjectMetadataStatusResponse - from ._models_py3 import SsisPackage - from ._models_py3 import SsisParameter - from ._models_py3 import SsisProject - from ._models_py3 import SsisVariable - from ._models_py3 import SubResource - from ._models_py3 import SystemData - from ._models_py3 import TableLevelSharingProperties - from ._models_py3 import TopQueries - from ._models_py3 import TopQueriesListResult - from ._models_py3 import TrackedResource - from ._models_py3 import TransparentDataEncryption - from ._models_py3 import TransparentDataEncryptionListResult - from ._models_py3 import UpdateIntegrationRuntimeNodeRequest - from ._models_py3 import UpdateIntegrationRuntimeRequest - from ._models_py3 import UserAssignedManagedIdentity - from ._models_py3 import VirtualNetworkProfile - from ._models_py3 import VulnerabilityAssessmentRecurringScansProperties - from ._models_py3 import VulnerabilityAssessmentScanError - from ._models_py3 import VulnerabilityAssessmentScanRecord - from ._models_py3 import VulnerabilityAssessmentScanRecordListResult - from ._models_py3 import WorkloadClassifier - from ._models_py3 import WorkloadClassifierListResult - from ._models_py3 import WorkloadGroup - from ._models_py3 import WorkloadGroupListResult - from ._models_py3 import Workspace - from ._models_py3 import WorkspaceAadAdminInfo - from ._models_py3 import WorkspaceInfoListResult - from ._models_py3 import WorkspaceKeyDetails - from ._models_py3 import WorkspacePatchInfo - from ._models_py3 import WorkspaceRepositoryConfiguration -except (SyntaxError, ImportError): - from ._models import AttachedDatabaseConfiguration # type: ignore - from ._models import AttachedDatabaseConfigurationListResult # type: ignore - from ._models import AutoPauseProperties # type: ignore - from ._models import AutoScaleProperties # type: ignore - from ._models import AvailableRpOperation # type: ignore - from ._models import AvailableRpOperationDisplayInfo # type: ignore - from ._models import AzureADOnlyAuthentication # type: ignore - from ._models import AzureADOnlyAuthenticationListResult # type: ignore - from ._models import AzureCapacity # type: ignore - from ._models import AzureEntityResource # type: ignore - from ._models import AzureResourceSku # type: ignore - from ._models import AzureSku # type: ignore - from ._models import BigDataPoolPatchInfo # type: ignore - from ._models import BigDataPoolResourceInfo # type: ignore - from ._models import BigDataPoolResourceInfoListResult # type: ignore - from ._models import CheckNameAvailabilityRequest # type: ignore - from ._models import CheckNameAvailabilityResponse # type: ignore - from ._models import CheckNameResult # type: ignore - from ._models import ClusterPrincipalAssignment # type: ignore - from ._models import ClusterPrincipalAssignmentCheckNameRequest # type: ignore - from ._models import ClusterPrincipalAssignmentListResult # type: ignore - from ._models import CmdkeySetup # type: ignore - from ._models import ComponentSetup # type: ignore - from ._models import CreateSqlPoolRestorePointDefinition # type: ignore - from ._models import CspWorkspaceAdminProperties # type: ignore - from ._models import CustomSetupBase # type: ignore - from ._models import CustomerManagedKeyDetails # type: ignore - from ._models import DataConnection # type: ignore - from ._models import DataConnectionCheckNameRequest # type: ignore - from ._models import DataConnectionListResult # type: ignore - from ._models import DataConnectionValidation # type: ignore - from ._models import DataConnectionValidationListResult # type: ignore - from ._models import DataConnectionValidationResult # type: ignore - from ._models import DataLakeStorageAccountDetails # type: ignore - from ._models import DataMaskingPolicy # type: ignore - from ._models import DataMaskingRule # type: ignore - from ._models import DataMaskingRuleListResult # type: ignore - from ._models import DataWarehouseUserActivities # type: ignore - from ._models import Database # type: ignore - from ._models import DatabaseCheckNameRequest # type: ignore - from ._models import DatabaseListResult # type: ignore - from ._models import DatabasePrincipalAssignment # type: ignore - from ._models import DatabasePrincipalAssignmentCheckNameRequest # type: ignore - from ._models import DatabasePrincipalAssignmentListResult # type: ignore - from ._models import DatabaseStatistics # type: ignore - from ._models import DynamicExecutorAllocation # type: ignore - from ._models import EncryptionDetails # type: ignore - from ._models import EncryptionProtector # type: ignore - from ._models import EncryptionProtectorListResult # type: ignore - from ._models import EntityReference # type: ignore - from ._models import EnvironmentVariableSetup # type: ignore - from ._models import ErrorAdditionalInfo # type: ignore - from ._models import ErrorDetail # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import EventGridDataConnection # type: ignore - from ._models import EventHubDataConnection # type: ignore - from ._models import ExtendedServerBlobAuditingPolicy # type: ignore - from ._models import ExtendedServerBlobAuditingPolicyListResult # type: ignore - from ._models import ExtendedSqlPoolBlobAuditingPolicy # type: ignore - from ._models import ExtendedSqlPoolBlobAuditingPolicyListResult # type: ignore - from ._models import FollowerDatabaseDefinition # type: ignore - from ._models import FollowerDatabaseListResult # type: ignore - from ._models import GeoBackupPolicy # type: ignore - from ._models import GeoBackupPolicyListResult # type: ignore - from ._models import GetSsisObjectMetadataRequest # type: ignore - from ._models import IntegrationRuntime # type: ignore - from ._models import IntegrationRuntimeAuthKeys # type: ignore - from ._models import IntegrationRuntimeComputeProperties # type: ignore - from ._models import IntegrationRuntimeConnectionInfo # type: ignore - from ._models import IntegrationRuntimeCustomSetupScriptProperties # type: ignore - from ._models import IntegrationRuntimeDataFlowProperties # type: ignore - from ._models import IntegrationRuntimeDataProxyProperties # type: ignore - from ._models import IntegrationRuntimeListResponse # type: ignore - from ._models import IntegrationRuntimeMonitoringData # type: ignore - from ._models import IntegrationRuntimeNodeIpAddress # type: ignore - from ._models import IntegrationRuntimeNodeMonitoringData # type: ignore - from ._models import IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint # type: ignore - from ._models import IntegrationRuntimeOutboundNetworkDependenciesEndpoint # type: ignore - from ._models import IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails # type: ignore - from ._models import IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse # type: ignore - from ._models import IntegrationRuntimeRegenerateKeyParameters # type: ignore - from ._models import IntegrationRuntimeResource # type: ignore - from ._models import IntegrationRuntimeSsisCatalogInfo # type: ignore - from ._models import IntegrationRuntimeSsisProperties # type: ignore - from ._models import IntegrationRuntimeStatus # type: ignore - from ._models import IntegrationRuntimeStatusResponse # type: ignore - from ._models import IntegrationRuntimeVNetProperties # type: ignore - from ._models import IotHubDataConnection # type: ignore - from ._models import IpFirewallRuleInfo # type: ignore - from ._models import IpFirewallRuleInfoListResult # type: ignore - from ._models import IpFirewallRuleProperties # type: ignore - from ._models import KekIdentityProperties # type: ignore - from ._models import Key # type: ignore - from ._models import KeyInfoListResult # type: ignore - from ._models import KustoPool # type: ignore - from ._models import KustoPoolCheckNameRequest # type: ignore - from ._models import KustoPoolListResult # type: ignore - from ._models import KustoPoolUpdate # type: ignore - from ._models import LanguageExtension # type: ignore - from ._models import LanguageExtensionsList # type: ignore - from ._models import LibraryInfo # type: ignore - from ._models import LibraryListResponse # type: ignore - from ._models import LibraryRequirements # type: ignore - from ._models import LibraryResource # type: ignore - from ._models import LinkedIntegrationRuntime # type: ignore - from ._models import LinkedIntegrationRuntimeKeyAuthorization # type: ignore - from ._models import LinkedIntegrationRuntimeRbacAuthorization # type: ignore - from ._models import LinkedIntegrationRuntimeType # type: ignore - from ._models import ListResourceSkusResult # type: ignore - from ._models import ListSqlPoolSecurityAlertPolicies # type: ignore - from ._models import MaintenanceWindowOptions # type: ignore - from ._models import MaintenanceWindowTimeRange # type: ignore - from ._models import MaintenanceWindows # type: ignore - from ._models import ManagedIdentity # type: ignore - from ._models import ManagedIdentitySqlControlSettingsModel # type: ignore - from ._models import ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity # type: ignore - from ._models import ManagedIntegrationRuntime # type: ignore - from ._models import ManagedIntegrationRuntimeError # type: ignore - from ._models import ManagedIntegrationRuntimeNode # type: ignore - from ._models import ManagedIntegrationRuntimeOperationResult # type: ignore - from ._models import ManagedIntegrationRuntimeStatus # type: ignore - from ._models import ManagedVirtualNetworkSettings # type: ignore - from ._models import MetadataSyncConfig # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import OperationMetaLogSpecification # type: ignore - from ._models import OperationMetaMetricDimensionSpecification # type: ignore - from ._models import OperationMetaMetricSpecification # type: ignore - from ._models import OperationMetaServiceSpecification # type: ignore - from ._models import OperationResource # type: ignore - from ._models import OptimizedAutoscale # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionForPrivateLinkHub # type: ignore - from ._models import PrivateEndpointConnectionForPrivateLinkHubBasic # type: ignore - from ._models import PrivateEndpointConnectionForPrivateLinkHubBasicAutoGenerated # type: ignore - from ._models import PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse # type: ignore - from ._models import PrivateEndpointConnectionList # type: ignore - from ._models import PrivateEndpointConnectionProperties # type: ignore - from ._models import PrivateLinkHub # type: ignore - from ._models import PrivateLinkHubInfoListResult # type: ignore - from ._models import PrivateLinkHubPatchInfo # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkResourceProperties # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import PurviewConfiguration # type: ignore - from ._models import QueryInterval # type: ignore - from ._models import QueryMetric # type: ignore - from ._models import QueryStatistic # type: ignore - from ._models import ReadWriteDatabase # type: ignore - from ._models import RecommendedSensitivityLabelUpdate # type: ignore - from ._models import RecommendedSensitivityLabelUpdateList # type: ignore - from ._models import RecoverableSqlPool # type: ignore - from ._models import RecoverableSqlPoolListResult # type: ignore - from ._models import ReplaceAllFirewallRulesOperationResponse # type: ignore - from ._models import ReplaceAllIpFirewallRulesRequest # type: ignore - from ._models import ReplicationLink # type: ignore - from ._models import ReplicationLinkListResult # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceMoveDefinition # type: ignore - from ._models import RestorableDroppedSqlPool # type: ignore - from ._models import RestorableDroppedSqlPoolListResult # type: ignore - from ._models import RestorePoint # type: ignore - from ._models import RestorePointListResult # type: ignore - from ._models import SecretBase # type: ignore - from ._models import SecureString # type: ignore - from ._models import SelfHostedIntegrationRuntime # type: ignore - from ._models import SelfHostedIntegrationRuntimeNode # type: ignore - from ._models import SelfHostedIntegrationRuntimeStatus # type: ignore - from ._models import SensitivityLabel # type: ignore - from ._models import SensitivityLabelListResult # type: ignore - from ._models import SensitivityLabelUpdate # type: ignore - from ._models import SensitivityLabelUpdateList # type: ignore - from ._models import ServerBlobAuditingPolicy # type: ignore - from ._models import ServerBlobAuditingPolicyListResult # type: ignore - from ._models import ServerSecurityAlertPolicy # type: ignore - from ._models import ServerSecurityAlertPolicyListResult # type: ignore - from ._models import ServerUsage # type: ignore - from ._models import ServerUsageListResult # type: ignore - from ._models import ServerVulnerabilityAssessment # type: ignore - from ._models import ServerVulnerabilityAssessmentListResult # type: ignore - from ._models import Sku # type: ignore - from ._models import SkuDescription # type: ignore - from ._models import SkuDescriptionList # type: ignore - from ._models import SkuLocationInfoItem # type: ignore - from ._models import SparkConfigProperties # type: ignore - from ._models import SparkConfigurationListResponse # type: ignore - from ._models import SparkConfigurationResource # type: ignore - from ._models import SqlPool # type: ignore - from ._models import SqlPoolBlobAuditingPolicy # type: ignore - from ._models import SqlPoolBlobAuditingPolicyListResult # type: ignore - from ._models import SqlPoolBlobAuditingPolicySqlPoolOperationListResult # type: ignore - from ._models import SqlPoolColumn # type: ignore - from ._models import SqlPoolColumnListResult # type: ignore - from ._models import SqlPoolConnectionPolicy # type: ignore - from ._models import SqlPoolInfoListResult # type: ignore - from ._models import SqlPoolOperation # type: ignore - from ._models import SqlPoolPatchInfo # type: ignore - from ._models import SqlPoolSchema # type: ignore - from ._models import SqlPoolSchemaListResult # type: ignore - from ._models import SqlPoolSecurityAlertPolicy # type: ignore - from ._models import SqlPoolTable # type: ignore - from ._models import SqlPoolTableListResult # type: ignore - from ._models import SqlPoolUsage # type: ignore - from ._models import SqlPoolUsageListResult # type: ignore - from ._models import SqlPoolVulnerabilityAssessment # type: ignore - from ._models import SqlPoolVulnerabilityAssessmentListResult # type: ignore - from ._models import SqlPoolVulnerabilityAssessmentRuleBaseline # type: ignore - from ._models import SqlPoolVulnerabilityAssessmentRuleBaselineItem # type: ignore - from ._models import SqlPoolVulnerabilityAssessmentScansExport # type: ignore - from ._models import SsisEnvironment # type: ignore - from ._models import SsisEnvironmentReference # type: ignore - from ._models import SsisFolder # type: ignore - from ._models import SsisObjectMetadata # type: ignore - from ._models import SsisObjectMetadataListResponse # type: ignore - from ._models import SsisObjectMetadataStatusResponse # type: ignore - from ._models import SsisPackage # type: ignore - from ._models import SsisParameter # type: ignore - from ._models import SsisProject # type: ignore - from ._models import SsisVariable # type: ignore - from ._models import SubResource # type: ignore - from ._models import SystemData # type: ignore - from ._models import TableLevelSharingProperties # type: ignore - from ._models import TopQueries # type: ignore - from ._models import TopQueriesListResult # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import TransparentDataEncryption # type: ignore - from ._models import TransparentDataEncryptionListResult # type: ignore - from ._models import UpdateIntegrationRuntimeNodeRequest # type: ignore - from ._models import UpdateIntegrationRuntimeRequest # type: ignore - from ._models import UserAssignedManagedIdentity # type: ignore - from ._models import VirtualNetworkProfile # type: ignore - from ._models import VulnerabilityAssessmentRecurringScansProperties # type: ignore - from ._models import VulnerabilityAssessmentScanError # type: ignore - from ._models import VulnerabilityAssessmentScanRecord # type: ignore - from ._models import VulnerabilityAssessmentScanRecordListResult # type: ignore - from ._models import WorkloadClassifier # type: ignore - from ._models import WorkloadClassifierListResult # type: ignore - from ._models import WorkloadGroup # type: ignore - from ._models import WorkloadGroupListResult # type: ignore - from ._models import Workspace # type: ignore - from ._models import WorkspaceAadAdminInfo # type: ignore - from ._models import WorkspaceInfoListResult # type: ignore - from ._models import WorkspaceKeyDetails # type: ignore - from ._models import WorkspacePatchInfo # type: ignore - from ._models import WorkspaceRepositoryConfiguration # type: ignore +from ._models_py3 import AttachedDatabaseConfiguration +from ._models_py3 import AttachedDatabaseConfigurationListResult +from ._models_py3 import AutoPauseProperties +from ._models_py3 import AutoScaleProperties +from ._models_py3 import AvailableRpOperation +from ._models_py3 import AvailableRpOperationDisplayInfo +from ._models_py3 import AzureADOnlyAuthentication +from ._models_py3 import AzureADOnlyAuthenticationListResult +from ._models_py3 import AzureCapacity +from ._models_py3 import AzureEntityResource +from ._models_py3 import AzureResourceSku +from ._models_py3 import AzureSku +from ._models_py3 import BigDataPoolPatchInfo +from ._models_py3 import BigDataPoolResourceInfo +from ._models_py3 import BigDataPoolResourceInfoListResult +from ._models_py3 import CheckNameAvailabilityRequest +from ._models_py3 import CheckNameAvailabilityResponse +from ._models_py3 import CheckNameResult +from ._models_py3 import ClusterPrincipalAssignment +from ._models_py3 import ClusterPrincipalAssignmentCheckNameRequest +from ._models_py3 import ClusterPrincipalAssignmentListResult +from ._models_py3 import CmdkeySetup +from ._models_py3 import ComponentSetup +from ._models_py3 import CreateSqlPoolRestorePointDefinition +from ._models_py3 import CspWorkspaceAdminProperties +from ._models_py3 import CustomSetupBase +from ._models_py3 import CustomerManagedKeyDetails +from ._models_py3 import DataConnection +from ._models_py3 import DataConnectionCheckNameRequest +from ._models_py3 import DataConnectionListResult +from ._models_py3 import DataConnectionValidation +from ._models_py3 import DataConnectionValidationListResult +from ._models_py3 import DataConnectionValidationResult +from ._models_py3 import DataLakeStorageAccountDetails +from ._models_py3 import DataMaskingPolicy +from ._models_py3 import DataMaskingRule +from ._models_py3 import DataMaskingRuleListResult +from ._models_py3 import DataWarehouseUserActivities +from ._models_py3 import Database +from ._models_py3 import DatabaseCheckNameRequest +from ._models_py3 import DatabaseListResult +from ._models_py3 import DatabasePrincipalAssignment +from ._models_py3 import DatabasePrincipalAssignmentCheckNameRequest +from ._models_py3 import DatabasePrincipalAssignmentListResult +from ._models_py3 import DatabaseStatistics +from ._models_py3 import DynamicExecutorAllocation +from ._models_py3 import EncryptionDetails +from ._models_py3 import EncryptionProtector +from ._models_py3 import EncryptionProtectorListResult +from ._models_py3 import EntityReference +from ._models_py3 import EnvironmentVariableSetup +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import EventGridDataConnection +from ._models_py3 import EventHubDataConnection +from ._models_py3 import ExtendedServerBlobAuditingPolicy +from ._models_py3 import ExtendedServerBlobAuditingPolicyListResult +from ._models_py3 import ExtendedSqlPoolBlobAuditingPolicy +from ._models_py3 import ExtendedSqlPoolBlobAuditingPolicyListResult +from ._models_py3 import FollowerDatabaseDefinition +from ._models_py3 import FollowerDatabaseListResult +from ._models_py3 import GeoBackupPolicy +from ._models_py3 import GeoBackupPolicyListResult +from ._models_py3 import GetSsisObjectMetadataRequest +from ._models_py3 import IntegrationRuntime +from ._models_py3 import IntegrationRuntimeAuthKeys +from ._models_py3 import IntegrationRuntimeComputeProperties +from ._models_py3 import IntegrationRuntimeConnectionInfo +from ._models_py3 import IntegrationRuntimeCustomSetupScriptProperties +from ._models_py3 import IntegrationRuntimeDataFlowProperties +from ._models_py3 import IntegrationRuntimeDataProxyProperties +from ._models_py3 import IntegrationRuntimeListResponse +from ._models_py3 import IntegrationRuntimeMonitoringData +from ._models_py3 import IntegrationRuntimeNodeIpAddress +from ._models_py3 import IntegrationRuntimeNodeMonitoringData +from ._models_py3 import IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint +from ._models_py3 import IntegrationRuntimeOutboundNetworkDependenciesEndpoint +from ._models_py3 import IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails +from ._models_py3 import IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse +from ._models_py3 import IntegrationRuntimeRegenerateKeyParameters +from ._models_py3 import IntegrationRuntimeResource +from ._models_py3 import IntegrationRuntimeSsisCatalogInfo +from ._models_py3 import IntegrationRuntimeSsisProperties +from ._models_py3 import IntegrationRuntimeStatus +from ._models_py3 import IntegrationRuntimeStatusResponse +from ._models_py3 import IntegrationRuntimeVNetProperties +from ._models_py3 import IotHubDataConnection +from ._models_py3 import IpFirewallRuleInfo +from ._models_py3 import IpFirewallRuleInfoListResult +from ._models_py3 import IpFirewallRuleProperties +from ._models_py3 import KekIdentityProperties +from ._models_py3 import Key +from ._models_py3 import KeyInfoListResult +from ._models_py3 import KustoPool +from ._models_py3 import KustoPoolCheckNameRequest +from ._models_py3 import KustoPoolListResult +from ._models_py3 import KustoPoolUpdate +from ._models_py3 import LanguageExtension +from ._models_py3 import LanguageExtensionsList +from ._models_py3 import LibraryInfo +from ._models_py3 import LibraryListResponse +from ._models_py3 import LibraryRequirements +from ._models_py3 import LibraryResource +from ._models_py3 import LinkedIntegrationRuntime +from ._models_py3 import LinkedIntegrationRuntimeKeyAuthorization +from ._models_py3 import LinkedIntegrationRuntimeRbacAuthorization +from ._models_py3 import LinkedIntegrationRuntimeType +from ._models_py3 import ListResourceSkusResult +from ._models_py3 import ListSqlPoolSecurityAlertPolicies +from ._models_py3 import MaintenanceWindowOptions +from ._models_py3 import MaintenanceWindowTimeRange +from ._models_py3 import MaintenanceWindows +from ._models_py3 import ManagedIdentity +from ._models_py3 import ManagedIdentitySqlControlSettingsModel +from ._models_py3 import ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity +from ._models_py3 import ManagedIntegrationRuntime +from ._models_py3 import ManagedIntegrationRuntimeError +from ._models_py3 import ManagedIntegrationRuntimeNode +from ._models_py3 import ManagedIntegrationRuntimeOperationResult +from ._models_py3 import ManagedIntegrationRuntimeStatus +from ._models_py3 import ManagedVirtualNetworkSettings +from ._models_py3 import MetadataSyncConfig +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import OperationMetaLogSpecification +from ._models_py3 import OperationMetaMetricDimensionSpecification +from ._models_py3 import OperationMetaMetricSpecification +from ._models_py3 import OperationMetaServiceSpecification +from ._models_py3 import OperationResource +from ._models_py3 import OptimizedAutoscale +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionForPrivateLinkHub +from ._models_py3 import PrivateEndpointConnectionForPrivateLinkHubBasic +from ._models_py3 import PrivateEndpointConnectionForPrivateLinkHubBasicAutoGenerated +from ._models_py3 import PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse +from ._models_py3 import PrivateEndpointConnectionList +from ._models_py3 import PrivateEndpointConnectionProperties +from ._models_py3 import PrivateLinkHub +from ._models_py3 import PrivateLinkHubInfoListResult +from ._models_py3 import PrivateLinkHubPatchInfo +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkResourceProperties +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import ProxyResource +from ._models_py3 import PurviewConfiguration +from ._models_py3 import QueryInterval +from ._models_py3 import QueryMetric +from ._models_py3 import QueryStatistic +from ._models_py3 import ReadWriteDatabase +from ._models_py3 import RecommendedSensitivityLabelUpdate +from ._models_py3 import RecommendedSensitivityLabelUpdateList +from ._models_py3 import RecoverableSqlPool +from ._models_py3 import RecoverableSqlPoolListResult +from ._models_py3 import ReplaceAllFirewallRulesOperationResponse +from ._models_py3 import ReplaceAllIpFirewallRulesRequest +from ._models_py3 import ReplicationLink +from ._models_py3 import ReplicationLinkListResult +from ._models_py3 import Resource +from ._models_py3 import ResourceMoveDefinition +from ._models_py3 import RestorableDroppedSqlPool +from ._models_py3 import RestorableDroppedSqlPoolListResult +from ._models_py3 import RestorePoint +from ._models_py3 import RestorePointListResult +from ._models_py3 import SecretBase +from ._models_py3 import SecureString +from ._models_py3 import SelfHostedIntegrationRuntime +from ._models_py3 import SelfHostedIntegrationRuntimeNode +from ._models_py3 import SelfHostedIntegrationRuntimeStatus +from ._models_py3 import SensitivityLabel +from ._models_py3 import SensitivityLabelListResult +from ._models_py3 import SensitivityLabelUpdate +from ._models_py3 import SensitivityLabelUpdateList +from ._models_py3 import ServerBlobAuditingPolicy +from ._models_py3 import ServerBlobAuditingPolicyListResult +from ._models_py3 import ServerSecurityAlertPolicy +from ._models_py3 import ServerSecurityAlertPolicyListResult +from ._models_py3 import ServerUsage +from ._models_py3 import ServerUsageListResult +from ._models_py3 import ServerVulnerabilityAssessment +from ._models_py3 import ServerVulnerabilityAssessmentListResult +from ._models_py3 import Sku +from ._models_py3 import SkuDescription +from ._models_py3 import SkuDescriptionList +from ._models_py3 import SkuLocationInfoItem +from ._models_py3 import SparkConfigProperties +from ._models_py3 import SparkConfigurationListResponse +from ._models_py3 import SparkConfigurationResource +from ._models_py3 import SqlPool +from ._models_py3 import SqlPoolBlobAuditingPolicy +from ._models_py3 import SqlPoolBlobAuditingPolicyListResult +from ._models_py3 import SqlPoolBlobAuditingPolicySqlPoolOperationListResult +from ._models_py3 import SqlPoolColumn +from ._models_py3 import SqlPoolColumnListResult +from ._models_py3 import SqlPoolConnectionPolicy +from ._models_py3 import SqlPoolInfoListResult +from ._models_py3 import SqlPoolOperation +from ._models_py3 import SqlPoolPatchInfo +from ._models_py3 import SqlPoolSchema +from ._models_py3 import SqlPoolSchemaListResult +from ._models_py3 import SqlPoolSecurityAlertPolicy +from ._models_py3 import SqlPoolTable +from ._models_py3 import SqlPoolTableListResult +from ._models_py3 import SqlPoolUsage +from ._models_py3 import SqlPoolUsageListResult +from ._models_py3 import SqlPoolVulnerabilityAssessment +from ._models_py3 import SqlPoolVulnerabilityAssessmentListResult +from ._models_py3 import SqlPoolVulnerabilityAssessmentRuleBaseline +from ._models_py3 import SqlPoolVulnerabilityAssessmentRuleBaselineItem +from ._models_py3 import SqlPoolVulnerabilityAssessmentScansExport +from ._models_py3 import SsisEnvironment +from ._models_py3 import SsisEnvironmentReference +from ._models_py3 import SsisFolder +from ._models_py3 import SsisObjectMetadata +from ._models_py3 import SsisObjectMetadataListResponse +from ._models_py3 import SsisObjectMetadataStatusResponse +from ._models_py3 import SsisPackage +from ._models_py3 import SsisParameter +from ._models_py3 import SsisProject +from ._models_py3 import SsisVariable +from ._models_py3 import SubResource +from ._models_py3 import SystemData +from ._models_py3 import TableLevelSharingProperties +from ._models_py3 import TopQueries +from ._models_py3 import TopQueriesListResult +from ._models_py3 import TrackedResource +from ._models_py3 import TransparentDataEncryption +from ._models_py3 import TransparentDataEncryptionListResult +from ._models_py3 import UpdateIntegrationRuntimeNodeRequest +from ._models_py3 import UpdateIntegrationRuntimeRequest +from ._models_py3 import UserAssignedManagedIdentity +from ._models_py3 import VirtualNetworkProfile +from ._models_py3 import VulnerabilityAssessmentRecurringScansProperties +from ._models_py3 import VulnerabilityAssessmentScanError +from ._models_py3 import VulnerabilityAssessmentScanRecord +from ._models_py3 import VulnerabilityAssessmentScanRecordListResult +from ._models_py3 import WorkloadClassifier +from ._models_py3 import WorkloadClassifierListResult +from ._models_py3 import WorkloadGroup +from ._models_py3 import WorkloadGroupListResult +from ._models_py3 import Workspace +from ._models_py3 import WorkspaceAadAdminInfo +from ._models_py3 import WorkspaceInfoListResult +from ._models_py3 import WorkspaceKeyDetails +from ._models_py3 import WorkspacePatchInfo +from ._models_py3 import WorkspaceRepositoryConfiguration + from ._synapse_management_client_enums import ( AzureADOnlyAuthenticationName, diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_models.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_models.py deleted file mode 100644 index 30403b5065b17..0000000000000 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_models.py +++ /dev/null @@ -1,10629 +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 azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class AttachedDatabaseConfiguration(ProxyResource): - """Class representing an attached database configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param location: Resource location. - :type location: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.synapse.models.SystemData - :ivar provisioning_state: The provisioned state of the resource. Possible values include: - "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState - :param database_name: The name of the database which you would like to attach, use * if you - want to follow all current and future databases. - :type database_name: str - :param kusto_pool_resource_id: The resource id of the kusto pool where the databases you would - like to attach reside. - :type kusto_pool_resource_id: str - :ivar attached_database_names: The list of databases from the clusterResourceId which are - currently attached to the kusto pool. - :vartype attached_database_names: list[str] - :param default_principals_modification_kind: The default principals modification kind. Possible - values include: "Union", "Replace", "None". - :type default_principals_modification_kind: str or - ~azure.mgmt.synapse.models.DefaultPrincipalsModificationKind - :param table_level_sharing_properties: Table level sharing specifications. - :type table_level_sharing_properties: ~azure.mgmt.synapse.models.TableLevelSharingProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'attached_database_names': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'database_name': {'key': 'properties.databaseName', 'type': 'str'}, - 'kusto_pool_resource_id': {'key': 'properties.clusterResourceId', 'type': 'str'}, - 'attached_database_names': {'key': 'properties.attachedDatabaseNames', 'type': '[str]'}, - 'default_principals_modification_kind': {'key': 'properties.defaultPrincipalsModificationKind', 'type': 'str'}, - 'table_level_sharing_properties': {'key': 'properties.tableLevelSharingProperties', 'type': 'TableLevelSharingProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(AttachedDatabaseConfiguration, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.system_data = None - self.provisioning_state = None - self.database_name = kwargs.get('database_name', None) - self.kusto_pool_resource_id = kwargs.get('kusto_pool_resource_id', None) - self.attached_database_names = None - self.default_principals_modification_kind = kwargs.get('default_principals_modification_kind', None) - self.table_level_sharing_properties = kwargs.get('table_level_sharing_properties', None) - - -class AttachedDatabaseConfigurationListResult(msrest.serialization.Model): - """The list attached database configurations operation response. - - :param value: The list of attached database configurations. - :type value: list[~azure.mgmt.synapse.models.AttachedDatabaseConfiguration] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AttachedDatabaseConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(AttachedDatabaseConfigurationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class AutoPauseProperties(msrest.serialization.Model): - """Auto-pausing properties of a Big Data pool powered by Apache Spark. - - :param delay_in_minutes: Number of minutes of idle time before the Big Data pool is - automatically paused. - :type delay_in_minutes: int - :param enabled: Whether auto-pausing is enabled for the Big Data pool. - :type enabled: bool - """ - - _attribute_map = { - 'delay_in_minutes': {'key': 'delayInMinutes', 'type': 'int'}, - 'enabled': {'key': 'enabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(AutoPauseProperties, self).__init__(**kwargs) - self.delay_in_minutes = kwargs.get('delay_in_minutes', None) - self.enabled = kwargs.get('enabled', None) - - -class AutoScaleProperties(msrest.serialization.Model): - """Auto-scaling properties of a Big Data pool powered by Apache Spark. - - :param min_node_count: The minimum number of nodes the Big Data pool can support. - :type min_node_count: int - :param enabled: Whether automatic scaling is enabled for the Big Data pool. - :type enabled: bool - :param max_node_count: The maximum number of nodes the Big Data pool can support. - :type max_node_count: int - """ - - _attribute_map = { - 'min_node_count': {'key': 'minNodeCount', 'type': 'int'}, - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'max_node_count': {'key': 'maxNodeCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AutoScaleProperties, self).__init__(**kwargs) - self.min_node_count = kwargs.get('min_node_count', None) - self.enabled = kwargs.get('enabled', None) - self.max_node_count = kwargs.get('max_node_count', None) - - -class AvailableRpOperation(msrest.serialization.Model): - """An operation that is available in this resource provider. - - :param display: Display properties of the operation. - :type display: ~azure.mgmt.synapse.models.AvailableRpOperationDisplayInfo - :param is_data_action: Whether this operation is a data action. - :type is_data_action: str - :param name: Operation name. - :type name: str - :param origin: Operation origin. - :type origin: str - :param service_specification: Operation service specification. - :type service_specification: ~azure.mgmt.synapse.models.OperationMetaServiceSpecification - """ - - _attribute_map = { - 'display': {'key': 'display', 'type': 'AvailableRpOperationDisplayInfo'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'OperationMetaServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailableRpOperation, self).__init__(**kwargs) - self.display = kwargs.get('display', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.name = kwargs.get('name', None) - self.origin = kwargs.get('origin', None) - self.service_specification = kwargs.get('service_specification', None) - - -class AvailableRpOperationDisplayInfo(msrest.serialization.Model): - """Description of an available operation. - - :param description: Operation description. - :type description: str - :param resource: Resource type. - :type resource: str - :param provider: Resource provider name. - :type provider: str - :param operation: Operation name. - :type operation: str - """ - - _attribute_map = { - 'description': {'key': 'description', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailableRpOperationDisplayInfo, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.resource = kwargs.get('resource', None) - self.provider = kwargs.get('provider', None) - self.operation = kwargs.get('operation', None) - - -class AzureADOnlyAuthentication(ProxyResource): - """Azure Active Directory Only Authentication Info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param azure_ad_only_authentication: Azure Active Directory only Authentication enabled. - :type azure_ad_only_authentication: bool - :ivar state: property configuration state. Possible values include: "Consistent", - "InConsistent", "Updating". - :vartype state: str or ~azure.mgmt.synapse.models.StateValue - :ivar creation_date: property configuration date. - :vartype creation_date: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'state': {'readonly': True}, - 'creation_date': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'azure_ad_only_authentication': {'key': 'properties.azureADOnlyAuthentication', 'type': 'bool'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureADOnlyAuthentication, self).__init__(**kwargs) - self.azure_ad_only_authentication = kwargs.get('azure_ad_only_authentication', None) - self.state = None - self.creation_date = None - - -class AzureADOnlyAuthenticationListResult(msrest.serialization.Model): - """A list of active directory only authentications. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.synapse.models.AzureADOnlyAuthentication] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AzureADOnlyAuthentication]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureADOnlyAuthenticationListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class AzureCapacity(msrest.serialization.Model): - """Azure capacity definition. - - All required parameters must be populated in order to send to Azure. - - :param scale_type: Required. Scale type. Possible values include: "automatic", "manual", - "none". - :type scale_type: str or ~azure.mgmt.synapse.models.AzureScaleType - :param minimum: Required. Minimum allowed capacity. - :type minimum: int - :param maximum: Required. Maximum allowed capacity. - :type maximum: int - :param default: Required. The default capacity that would be used. - :type default: int - """ - - _validation = { - 'scale_type': {'required': True}, - 'minimum': {'required': True}, - 'maximum': {'required': True}, - 'default': {'required': True}, - } - - _attribute_map = { - 'scale_type': {'key': 'scaleType', 'type': 'str'}, - 'minimum': {'key': 'minimum', 'type': 'int'}, - 'maximum': {'key': 'maximum', 'type': 'int'}, - 'default': {'key': 'default', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureCapacity, self).__init__(**kwargs) - self.scale_type = kwargs['scale_type'] - self.minimum = kwargs['minimum'] - self.maximum = kwargs['maximum'] - self.default = kwargs['default'] - - -class AzureEntityResource(Resource): - """The resource model definition for an Azure Resource Manager resource with an etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureEntityResource, self).__init__(**kwargs) - self.etag = None - - -class AzureResourceSku(msrest.serialization.Model): - """Azure resource SKU definition. - - :param resource_type: Resource Namespace and Type. - :type resource_type: str - :param sku: The SKU details. - :type sku: ~azure.mgmt.synapse.models.AzureSku - :param capacity: The number of instances of the cluster. - :type capacity: ~azure.mgmt.synapse.models.AzureCapacity - """ - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'AzureSku'}, - 'capacity': {'key': 'capacity', 'type': 'AzureCapacity'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureResourceSku, self).__init__(**kwargs) - self.resource_type = kwargs.get('resource_type', None) - self.sku = kwargs.get('sku', None) - self.capacity = kwargs.get('capacity', None) - - -class AzureSku(msrest.serialization.Model): - """Azure SKU definition. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. SKU name. Possible values include: "Compute optimized", "Storage - optimized". - :type name: str or ~azure.mgmt.synapse.models.SkuName - :param capacity: The number of instances of the cluster. - :type capacity: int - :param size: Required. SKU size. Possible values include: "Extra small", "Small", "Medium", - "Large". - :type size: str or ~azure.mgmt.synapse.models.SkuSize - """ - - _validation = { - 'name': {'required': True}, - 'size': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - 'size': {'key': 'size', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureSku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.capacity = kwargs.get('capacity', None) - self.size = kwargs['size'] - - -class BigDataPoolPatchInfo(msrest.serialization.Model): - """Properties patch for a Big Data pool. - - :param tags: A set of tags. Updated tags for the Big Data pool. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(BigDataPoolPatchInfo, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class BigDataPoolResourceInfo(TrackedResource): - """A Big Data pool. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param provisioning_state: The state of the Big Data pool. - :type provisioning_state: str - :param auto_scale: Auto-scaling properties. - :type auto_scale: ~azure.mgmt.synapse.models.AutoScaleProperties - :param creation_date: The time when the Big Data pool was created. - :type creation_date: ~datetime.datetime - :param auto_pause: Auto-pausing properties. - :type auto_pause: ~azure.mgmt.synapse.models.AutoPauseProperties - :param is_compute_isolation_enabled: Whether compute isolation is required or not. - :type is_compute_isolation_enabled: bool - :param session_level_packages_enabled: Whether session level packages enabled. - :type session_level_packages_enabled: bool - :param cache_size: The cache size. - :type cache_size: int - :param dynamic_executor_allocation: Dynamic Executor Allocation. - :type dynamic_executor_allocation: ~azure.mgmt.synapse.models.DynamicExecutorAllocation - :param spark_events_folder: The Spark events folder. - :type spark_events_folder: str - :param node_count: The number of nodes in the Big Data pool. - :type node_count: int - :param library_requirements: Library version requirements. - :type library_requirements: ~azure.mgmt.synapse.models.LibraryRequirements - :param custom_libraries: List of custom libraries/packages associated with the spark pool. - :type custom_libraries: list[~azure.mgmt.synapse.models.LibraryInfo] - :param spark_config_properties: Spark configuration file to specify additional properties. - :type spark_config_properties: ~azure.mgmt.synapse.models.SparkConfigProperties - :param spark_version: The Apache Spark version. - :type spark_version: str - :param default_spark_log_folder: The default folder where Spark logs will be written. - :type default_spark_log_folder: str - :param node_size: The level of compute power that each node in the Big Data pool has. Possible - values include: "None", "Small", "Medium", "Large", "XLarge", "XXLarge", "XXXLarge". - :type node_size: str or ~azure.mgmt.synapse.models.NodeSize - :param node_size_family: The kind of nodes that the Big Data pool provides. Possible values - include: "None", "MemoryOptimized", "HardwareAcceleratedFPGA", "HardwareAcceleratedGPU". - :type node_size_family: str or ~azure.mgmt.synapse.models.NodeSizeFamily - :ivar last_succeeded_timestamp: The time when the Big Data pool was updated successfully. - :vartype last_succeeded_timestamp: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'last_succeeded_timestamp': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'auto_scale': {'key': 'properties.autoScale', 'type': 'AutoScaleProperties'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'auto_pause': {'key': 'properties.autoPause', 'type': 'AutoPauseProperties'}, - 'is_compute_isolation_enabled': {'key': 'properties.isComputeIsolationEnabled', 'type': 'bool'}, - 'session_level_packages_enabled': {'key': 'properties.sessionLevelPackagesEnabled', 'type': 'bool'}, - 'cache_size': {'key': 'properties.cacheSize', 'type': 'int'}, - 'dynamic_executor_allocation': {'key': 'properties.dynamicExecutorAllocation', 'type': 'DynamicExecutorAllocation'}, - 'spark_events_folder': {'key': 'properties.sparkEventsFolder', 'type': 'str'}, - 'node_count': {'key': 'properties.nodeCount', 'type': 'int'}, - 'library_requirements': {'key': 'properties.libraryRequirements', 'type': 'LibraryRequirements'}, - 'custom_libraries': {'key': 'properties.customLibraries', 'type': '[LibraryInfo]'}, - 'spark_config_properties': {'key': 'properties.sparkConfigProperties', 'type': 'SparkConfigProperties'}, - 'spark_version': {'key': 'properties.sparkVersion', 'type': 'str'}, - 'default_spark_log_folder': {'key': 'properties.defaultSparkLogFolder', 'type': 'str'}, - 'node_size': {'key': 'properties.nodeSize', 'type': 'str'}, - 'node_size_family': {'key': 'properties.nodeSizeFamily', 'type': 'str'}, - 'last_succeeded_timestamp': {'key': 'properties.lastSucceededTimestamp', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(BigDataPoolResourceInfo, self).__init__(**kwargs) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.auto_scale = kwargs.get('auto_scale', None) - self.creation_date = kwargs.get('creation_date', None) - self.auto_pause = kwargs.get('auto_pause', None) - self.is_compute_isolation_enabled = kwargs.get('is_compute_isolation_enabled', None) - self.session_level_packages_enabled = kwargs.get('session_level_packages_enabled', None) - self.cache_size = kwargs.get('cache_size', None) - self.dynamic_executor_allocation = kwargs.get('dynamic_executor_allocation', None) - self.spark_events_folder = kwargs.get('spark_events_folder', None) - self.node_count = kwargs.get('node_count', None) - self.library_requirements = kwargs.get('library_requirements', None) - self.custom_libraries = kwargs.get('custom_libraries', None) - self.spark_config_properties = kwargs.get('spark_config_properties', None) - self.spark_version = kwargs.get('spark_version', None) - self.default_spark_log_folder = kwargs.get('default_spark_log_folder', None) - self.node_size = kwargs.get('node_size', None) - self.node_size_family = kwargs.get('node_size_family', None) - self.last_succeeded_timestamp = None - - -class BigDataPoolResourceInfoListResult(msrest.serialization.Model): - """Collection of Big Data pool information. - - :param next_link: Link to the next page of results. - :type next_link: str - :param value: List of Big Data pools. - :type value: list[~azure.mgmt.synapse.models.BigDataPoolResourceInfo] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[BigDataPoolResourceInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(BigDataPoolResourceInfoListResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) - - -class CheckNameAvailabilityRequest(msrest.serialization.Model): - """A request about whether a workspace name is available. - - :param name: Workspace name. - :type name: str - :param type: Type: workspace. - :type type: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityRequest, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - - -class CheckNameAvailabilityResponse(msrest.serialization.Model): - """A response saying whether the workspace name is available. - - :param message: Validation message. - :type message: str - :param available: Whether the workspace name is available. - :type available: bool - :param reason: Reason the workspace name is or is not available. - :type reason: str - :param name: Workspace name. - :type name: str - """ - - _attribute_map = { - 'message': {'key': 'message', 'type': 'str'}, - 'available': {'key': 'available', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResponse, self).__init__(**kwargs) - self.message = kwargs.get('message', None) - self.available = kwargs.get('available', None) - self.reason = kwargs.get('reason', None) - self.name = kwargs.get('name', None) - - -class CheckNameResult(msrest.serialization.Model): - """The result returned from a check name availability request. - - :param name_available: Specifies a Boolean value that indicates if the name is available. - :type name_available: bool - :param name: The name that was checked. - :type name: str - :param message: Message indicating an unavailable name due to a conflict, or a description of - the naming rules that are violated. - :type message: str - :param reason: Message providing the reason why the given name is invalid. Possible values - include: "Invalid", "AlreadyExists". - :type reason: str or ~azure.mgmt.synapse.models.Reason - """ - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'reason': {'key': 'reason', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameResult, self).__init__(**kwargs) - self.name_available = kwargs.get('name_available', None) - self.name = kwargs.get('name', None) - self.message = kwargs.get('message', None) - self.reason = kwargs.get('reason', None) - - -class ClusterPrincipalAssignment(ProxyResource): - """Class representing a cluster principal assignment. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.synapse.models.SystemData - :param principal_id: The principal ID assigned to the cluster principal. It can be a user - email, application ID, or security group name. - :type principal_id: str - :param role: Cluster principal role. Possible values include: "AllDatabasesAdmin", - "AllDatabasesViewer". - :type role: str or ~azure.mgmt.synapse.models.ClusterPrincipalRole - :param tenant_id: The tenant id of the principal. - :type tenant_id: str - :param principal_type: Principal type. Possible values include: "App", "Group", "User". - :type principal_type: str or ~azure.mgmt.synapse.models.PrincipalType - :ivar tenant_name: The tenant name of the principal. - :vartype tenant_name: str - :ivar principal_name: The principal name. - :vartype principal_name: str - :ivar provisioning_state: The provisioned state of the resource. Possible values include: - "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'tenant_name': {'readonly': True}, - 'principal_name': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, - 'role': {'key': 'properties.role', 'type': 'str'}, - 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, - 'principal_type': {'key': 'properties.principalType', 'type': 'str'}, - 'tenant_name': {'key': 'properties.tenantName', 'type': 'str'}, - 'principal_name': {'key': 'properties.principalName', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterPrincipalAssignment, self).__init__(**kwargs) - self.system_data = None - self.principal_id = kwargs.get('principal_id', None) - self.role = kwargs.get('role', None) - self.tenant_id = kwargs.get('tenant_id', None) - self.principal_type = kwargs.get('principal_type', None) - self.tenant_name = None - self.principal_name = None - self.provisioning_state = None - - -class ClusterPrincipalAssignmentCheckNameRequest(msrest.serialization.Model): - """A principal assignment check name availability request. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Principal Assignment resource name. - :type name: str - :ivar type: The type of resource, Microsoft.Synapse/workspaces/kustoPools/principalAssignments. - Has constant value: "Microsoft.Synapse/workspaces/kustoPools/principalAssignments". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Synapse/workspaces/kustoPools/principalAssignments" - - def __init__( - self, - **kwargs - ): - super(ClusterPrincipalAssignmentCheckNameRequest, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class ClusterPrincipalAssignmentListResult(msrest.serialization.Model): - """The list Kusto cluster principal assignments operation response. - - :param value: The list of Kusto cluster principal assignments. - :type value: list[~azure.mgmt.synapse.models.ClusterPrincipalAssignment] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ClusterPrincipalAssignment]'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterPrincipalAssignmentListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class CustomSetupBase(msrest.serialization.Model): - """The base definition of the custom setup. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: CmdkeySetup, ComponentSetup, EnvironmentVariableSetup. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of custom setup.Constant filled by server. - :type type: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'CmdkeySetup': 'CmdkeySetup', 'ComponentSetup': 'ComponentSetup', 'EnvironmentVariableSetup': 'EnvironmentVariableSetup'} - } - - def __init__( - self, - **kwargs - ): - super(CustomSetupBase, self).__init__(**kwargs) - self.type = None # type: Optional[str] - - -class CmdkeySetup(CustomSetupBase): - """The custom setup of running cmdkey commands. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of custom setup.Constant filled by server. - :type type: str - :param target_name: Required. The server name of data source access. - :type target_name: any - :param user_name: Required. The user name of data source access. - :type user_name: any - :param password: Required. The password of data source access. - :type password: ~azure.mgmt.synapse.models.SecretBase - """ - - _validation = { - 'type': {'required': True}, - 'target_name': {'required': True}, - 'user_name': {'required': True}, - 'password': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'target_name': {'key': 'typeProperties.targetName', 'type': 'object'}, - 'user_name': {'key': 'typeProperties.userName', 'type': 'object'}, - 'password': {'key': 'typeProperties.password', 'type': 'SecretBase'}, - } - - def __init__( - self, - **kwargs - ): - super(CmdkeySetup, self).__init__(**kwargs) - self.type = 'CmdkeySetup' # type: str - self.target_name = kwargs['target_name'] - self.user_name = kwargs['user_name'] - self.password = kwargs['password'] - - -class ComponentSetup(CustomSetupBase): - """The custom setup of installing 3rd party components. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of custom setup.Constant filled by server. - :type type: str - :param component_name: Required. The name of the 3rd party component. - :type component_name: str - :param license_key: The license key to activate the component. - :type license_key: ~azure.mgmt.synapse.models.SecretBase - """ - - _validation = { - 'type': {'required': True}, - 'component_name': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'component_name': {'key': 'typeProperties.componentName', 'type': 'str'}, - 'license_key': {'key': 'typeProperties.licenseKey', 'type': 'SecretBase'}, - } - - def __init__( - self, - **kwargs - ): - super(ComponentSetup, self).__init__(**kwargs) - self.type = 'ComponentSetup' # type: str - self.component_name = kwargs['component_name'] - self.license_key = kwargs.get('license_key', None) - - -class CreateSqlPoolRestorePointDefinition(msrest.serialization.Model): - """Contains the information necessary to perform a create Sql pool restore point operation. - - All required parameters must be populated in order to send to Azure. - - :param restore_point_label: Required. The restore point label to apply. - :type restore_point_label: str - """ - - _validation = { - 'restore_point_label': {'required': True}, - } - - _attribute_map = { - 'restore_point_label': {'key': 'restorePointLabel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CreateSqlPoolRestorePointDefinition, self).__init__(**kwargs) - self.restore_point_label = kwargs['restore_point_label'] - - -class CspWorkspaceAdminProperties(msrest.serialization.Model): - """Initial workspace AAD admin properties for a CSP subscription. - - :param initial_workspace_admin_object_id: AAD object ID of initial workspace admin. - :type initial_workspace_admin_object_id: str - """ - - _attribute_map = { - 'initial_workspace_admin_object_id': {'key': 'initialWorkspaceAdminObjectId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CspWorkspaceAdminProperties, self).__init__(**kwargs) - self.initial_workspace_admin_object_id = kwargs.get('initial_workspace_admin_object_id', None) - - -class CustomerManagedKeyDetails(msrest.serialization.Model): - """Details of the customer managed key associated with the workspace. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The customer managed key status on the workspace. - :vartype status: str - :param key: The key object of the workspace. - :type key: ~azure.mgmt.synapse.models.WorkspaceKeyDetails - :param kek_identity: Key encryption key. - :type kek_identity: ~azure.mgmt.synapse.models.KekIdentityProperties - """ - - _validation = { - 'status': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'WorkspaceKeyDetails'}, - 'kek_identity': {'key': 'kekIdentity', 'type': 'KekIdentityProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(CustomerManagedKeyDetails, self).__init__(**kwargs) - self.status = None - self.key = kwargs.get('key', None) - self.kek_identity = kwargs.get('kek_identity', None) - - -class Database(ProxyResource): - """Class representing a Kusto database. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ReadWriteDatabase. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the database.Constant filled by server. Possible values - include: "ReadWrite", "ReadOnlyFollowing". - :type kind: str or ~azure.mgmt.synapse.models.Kind - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.synapse.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - _subtype_map = { - 'kind': {'ReadWrite': 'ReadWriteDatabase'} - } - - def __init__( - self, - **kwargs - ): - super(Database, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.kind = 'Database' # type: str - self.system_data = None - - -class DatabaseCheckNameRequest(msrest.serialization.Model): - """The result returned from a database check name availability request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Resource name. - :type name: str - :param type: Required. The type of resource, for instance - Microsoft.Synapse/workspaces/kustoPools/databases. Possible values include: - "Microsoft.Synapse/workspaces/kustoPools/databases", - "Microsoft.Synapse/workspaces/kustoPools/attachedDatabaseConfigurations". - :type type: str or ~azure.mgmt.synapse.models.Type - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DatabaseCheckNameRequest, self).__init__(**kwargs) - self.name = kwargs['name'] - self.type = kwargs['type'] - - -class DatabaseListResult(msrest.serialization.Model): - """The list Kusto databases operation response. - - :param value: The list of Kusto databases. - :type value: list[~azure.mgmt.synapse.models.Database] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Database]'}, - } - - def __init__( - self, - **kwargs - ): - super(DatabaseListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class DatabasePrincipalAssignment(ProxyResource): - """Class representing a database principal assignment. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.synapse.models.SystemData - :param principal_id: The principal ID assigned to the database principal. It can be a user - email, application ID, or security group name. - :type principal_id: str - :param role: Database principal role. Possible values include: "Admin", "Ingestor", "Monitor", - "User", "UnrestrictedViewer", "Viewer". - :type role: str or ~azure.mgmt.synapse.models.DatabasePrincipalRole - :param tenant_id: The tenant id of the principal. - :type tenant_id: str - :param principal_type: Principal type. Possible values include: "App", "Group", "User". - :type principal_type: str or ~azure.mgmt.synapse.models.PrincipalType - :ivar tenant_name: The tenant name of the principal. - :vartype tenant_name: str - :ivar principal_name: The principal name. - :vartype principal_name: str - :ivar provisioning_state: The provisioned state of the resource. Possible values include: - "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'tenant_name': {'readonly': True}, - 'principal_name': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, - 'role': {'key': 'properties.role', 'type': 'str'}, - 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, - 'principal_type': {'key': 'properties.principalType', 'type': 'str'}, - 'tenant_name': {'key': 'properties.tenantName', 'type': 'str'}, - 'principal_name': {'key': 'properties.principalName', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DatabasePrincipalAssignment, self).__init__(**kwargs) - self.system_data = None - self.principal_id = kwargs.get('principal_id', None) - self.role = kwargs.get('role', None) - self.tenant_id = kwargs.get('tenant_id', None) - self.principal_type = kwargs.get('principal_type', None) - self.tenant_name = None - self.principal_name = None - self.provisioning_state = None - - -class DatabasePrincipalAssignmentCheckNameRequest(msrest.serialization.Model): - """A principal assignment check name availability request. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Principal Assignment resource name. - :type name: str - :ivar type: The type of resource, - Microsoft.Synapse/workspaces/kustoPools/databases/principalAssignments. Has constant value: - "Microsoft.Synapse/workspaces/kustoPools/databases/principalAssignments". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Synapse/workspaces/kustoPools/databases/principalAssignments" - - def __init__( - self, - **kwargs - ): - super(DatabasePrincipalAssignmentCheckNameRequest, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class DatabasePrincipalAssignmentListResult(msrest.serialization.Model): - """The list Kusto database principal assignments operation response. - - :param value: The list of Kusto database principal assignments. - :type value: list[~azure.mgmt.synapse.models.DatabasePrincipalAssignment] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DatabasePrincipalAssignment]'}, - } - - def __init__( - self, - **kwargs - ): - super(DatabasePrincipalAssignmentListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class DatabaseStatistics(msrest.serialization.Model): - """A class that contains database statistics information. - - :param size: The database size - the total size of compressed data and index in bytes. - :type size: float - """ - - _attribute_map = { - 'size': {'key': 'size', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(DatabaseStatistics, self).__init__(**kwargs) - self.size = kwargs.get('size', None) - - -class DataConnection(ProxyResource): - """Class representing a data connection. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: EventGridDataConnection, EventHubDataConnection, IotHubDataConnection. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. - Possible values include: "EventHub", "EventGrid", "IotHub". - :type kind: str or ~azure.mgmt.synapse.models.DataConnectionKind - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.synapse.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - _subtype_map = { - 'kind': {'EventGrid': 'EventGridDataConnection', 'EventHub': 'EventHubDataConnection', 'IotHub': 'IotHubDataConnection'} - } - - def __init__( - self, - **kwargs - ): - super(DataConnection, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.kind = 'DataConnection' # type: str - self.system_data = None - - -class DataConnectionCheckNameRequest(msrest.serialization.Model): - """A data connection check name availability request. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Data Connection name. - :type name: str - :ivar type: The type of resource, - Microsoft.Synapse/workspaces/kustoPools/databases/dataConnections. Has constant value: - "Microsoft.Synapse/workspaces/kustoPools/databases/dataConnections". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Synapse/workspaces/kustoPools/databases/dataConnections" - - def __init__( - self, - **kwargs - ): - super(DataConnectionCheckNameRequest, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class DataConnectionListResult(msrest.serialization.Model): - """The list Kusto data connections operation response. - - :param value: The list of Kusto data connections. - :type value: list[~azure.mgmt.synapse.models.DataConnection] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DataConnection]'}, - } - - def __init__( - self, - **kwargs - ): - super(DataConnectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class DataConnectionValidation(msrest.serialization.Model): - """Class representing an data connection validation. - - :param data_connection_name: The name of the data connection. - :type data_connection_name: str - :param properties: The data connection properties to validate. - :type properties: ~azure.mgmt.synapse.models.DataConnection - """ - - _attribute_map = { - 'data_connection_name': {'key': 'dataConnectionName', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'DataConnection'}, - } - - def __init__( - self, - **kwargs - ): - super(DataConnectionValidation, self).__init__(**kwargs) - self.data_connection_name = kwargs.get('data_connection_name', None) - self.properties = kwargs.get('properties', None) - - -class DataConnectionValidationListResult(msrest.serialization.Model): - """The list Kusto data connection validation result. - - :param value: The list of Kusto data connection validation errors. - :type value: list[~azure.mgmt.synapse.models.DataConnectionValidationResult] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DataConnectionValidationResult]'}, - } - - def __init__( - self, - **kwargs - ): - super(DataConnectionValidationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class DataConnectionValidationResult(msrest.serialization.Model): - """The result returned from a data connection validation request. - - :param error_message: A message which indicates a problem in data connection validation. - :type error_message: str - """ - - _attribute_map = { - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataConnectionValidationResult, self).__init__(**kwargs) - self.error_message = kwargs.get('error_message', None) - - -class DataLakeStorageAccountDetails(msrest.serialization.Model): - """Details of the data lake storage account associated with the workspace. - - :param account_url: Account URL. - :type account_url: str - :param filesystem: Filesystem name. - :type filesystem: str - :param resource_id: ARM resource Id of this storage account. - :type resource_id: str - :param create_managed_private_endpoint: Create managed private endpoint to this storage account - or not. - :type create_managed_private_endpoint: bool - """ - - _attribute_map = { - 'account_url': {'key': 'accountUrl', 'type': 'str'}, - 'filesystem': {'key': 'filesystem', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'create_managed_private_endpoint': {'key': 'createManagedPrivateEndpoint', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(DataLakeStorageAccountDetails, self).__init__(**kwargs) - self.account_url = kwargs.get('account_url', None) - self.filesystem = kwargs.get('filesystem', None) - self.resource_id = kwargs.get('resource_id', None) - self.create_managed_private_endpoint = kwargs.get('create_managed_private_endpoint', None) - - -class DataMaskingPolicy(ProxyResource): - """DataMaskingPolicy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar location: The location of the data masking policy. - :vartype location: str - :ivar kind: The kind of data masking policy. Metadata, used for Azure portal. - :vartype kind: str - :ivar managed_by: Fully qualified resource ID of the sql pool. - :vartype managed_by: str - :param data_masking_state: The state of the data masking policy. Possible values include: - "Disabled", "Enabled". - :type data_masking_state: str or ~azure.mgmt.synapse.models.DataMaskingState - :param exempt_principals: The list of the exempt principals. Specifies the semicolon-separated - list of database users for which the data masking policy does not apply. The specified users - receive data results without masking for all of the database queries. - :type exempt_principals: str - :ivar application_principals: The list of the application principals. This is a legacy - parameter and is no longer used. - :vartype application_principals: str - :ivar masking_level: The masking level. This is a legacy parameter and is no longer used. - :vartype masking_level: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'kind': {'readonly': True}, - 'managed_by': {'readonly': True}, - 'application_principals': {'readonly': True}, - 'masking_level': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'data_masking_state': {'key': 'properties.dataMaskingState', 'type': 'str'}, - 'exempt_principals': {'key': 'properties.exemptPrincipals', 'type': 'str'}, - 'application_principals': {'key': 'properties.applicationPrincipals', 'type': 'str'}, - 'masking_level': {'key': 'properties.maskingLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataMaskingPolicy, self).__init__(**kwargs) - self.location = None - self.kind = None - self.managed_by = None - self.data_masking_state = kwargs.get('data_masking_state', None) - self.exempt_principals = kwargs.get('exempt_principals', None) - self.application_principals = None - self.masking_level = None - - -class DataMaskingRule(ProxyResource): - """Represents a Sql pool data masking rule. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar location: The location of the data masking rule. - :vartype location: str - :ivar kind: The kind of Data Masking Rule. Metadata, used for Azure portal. - :vartype kind: str - :ivar id_properties_id: The rule Id. - :vartype id_properties_id: str - :param alias_name: The alias name. This is a legacy parameter and is no longer used. - :type alias_name: str - :param rule_state: The rule state. Used to delete a rule. To delete an existing rule, specify - the schemaName, tableName, columnName, maskingFunction, and specify ruleState as disabled. - However, if the rule doesn't already exist, the rule will be created with ruleState set to - enabled, regardless of the provided value of ruleState. Possible values include: "Disabled", - "Enabled". - :type rule_state: str or ~azure.mgmt.synapse.models.DataMaskingRuleState - :param schema_name: The schema name on which the data masking rule is applied. - :type schema_name: str - :param table_name: The table name on which the data masking rule is applied. - :type table_name: str - :param column_name: The column name on which the data masking rule is applied. - :type column_name: str - :param masking_function: The masking function that is used for the data masking rule. Possible - values include: "Default", "CCN", "Email", "Number", "SSN", "Text". - :type masking_function: str or ~azure.mgmt.synapse.models.DataMaskingFunction - :param number_from: The numberFrom property of the masking rule. Required if maskingFunction is - set to Number, otherwise this parameter will be ignored. - :type number_from: str - :param number_to: The numberTo property of the data masking rule. Required if maskingFunction - is set to Number, otherwise this parameter will be ignored. - :type number_to: str - :param prefix_size: If maskingFunction is set to Text, the number of characters to show - unmasked in the beginning of the string. Otherwise, this parameter will be ignored. - :type prefix_size: str - :param suffix_size: If maskingFunction is set to Text, the number of characters to show - unmasked at the end of the string. Otherwise, this parameter will be ignored. - :type suffix_size: str - :param replacement_string: If maskingFunction is set to Text, the character to use for masking - the unexposed part of the string. Otherwise, this parameter will be ignored. - :type replacement_string: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'kind': {'readonly': True}, - 'id_properties_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'id_properties_id': {'key': 'properties.id', 'type': 'str'}, - 'alias_name': {'key': 'properties.aliasName', 'type': 'str'}, - 'rule_state': {'key': 'properties.ruleState', 'type': 'str'}, - 'schema_name': {'key': 'properties.schemaName', 'type': 'str'}, - 'table_name': {'key': 'properties.tableName', 'type': 'str'}, - 'column_name': {'key': 'properties.columnName', 'type': 'str'}, - 'masking_function': {'key': 'properties.maskingFunction', 'type': 'str'}, - 'number_from': {'key': 'properties.numberFrom', 'type': 'str'}, - 'number_to': {'key': 'properties.numberTo', 'type': 'str'}, - 'prefix_size': {'key': 'properties.prefixSize', 'type': 'str'}, - 'suffix_size': {'key': 'properties.suffixSize', 'type': 'str'}, - 'replacement_string': {'key': 'properties.replacementString', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataMaskingRule, self).__init__(**kwargs) - self.location = None - self.kind = None - self.id_properties_id = None - self.alias_name = kwargs.get('alias_name', None) - self.rule_state = kwargs.get('rule_state', None) - self.schema_name = kwargs.get('schema_name', None) - self.table_name = kwargs.get('table_name', None) - self.column_name = kwargs.get('column_name', None) - self.masking_function = kwargs.get('masking_function', None) - self.number_from = kwargs.get('number_from', None) - self.number_to = kwargs.get('number_to', None) - self.prefix_size = kwargs.get('prefix_size', None) - self.suffix_size = kwargs.get('suffix_size', None) - self.replacement_string = kwargs.get('replacement_string', None) - - -class DataMaskingRuleListResult(msrest.serialization.Model): - """The response to a list data masking rules request. - - :param value: The list of Sql pool data masking rules. - :type value: list[~azure.mgmt.synapse.models.DataMaskingRule] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DataMaskingRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(DataMaskingRuleListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class DataWarehouseUserActivities(ProxyResource): - """User activities of a data warehouse. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar active_queries_count: Count of running and suspended queries. - :vartype active_queries_count: int - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'active_queries_count': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'active_queries_count': {'key': 'properties.activeQueriesCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(DataWarehouseUserActivities, self).__init__(**kwargs) - self.active_queries_count = None - - -class DynamicExecutorAllocation(msrest.serialization.Model): - """Dynamic Executor Allocation Properties. - - :param enabled: Indicates whether Dynamic Executor Allocation is enabled or not. - :type enabled: bool - """ - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(DynamicExecutorAllocation, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - - -class EncryptionDetails(msrest.serialization.Model): - """Details of the encryption associated with the workspace. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar double_encryption_enabled: Double Encryption enabled. - :vartype double_encryption_enabled: bool - :param cmk: Customer Managed Key Details. - :type cmk: ~azure.mgmt.synapse.models.CustomerManagedKeyDetails - """ - - _validation = { - 'double_encryption_enabled': {'readonly': True}, - } - - _attribute_map = { - 'double_encryption_enabled': {'key': 'doubleEncryptionEnabled', 'type': 'bool'}, - 'cmk': {'key': 'cmk', 'type': 'CustomerManagedKeyDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionDetails, self).__init__(**kwargs) - self.double_encryption_enabled = None - self.cmk = kwargs.get('cmk', None) - - -class EncryptionProtector(ProxyResource): - """The server encryption protector. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar kind: Kind of encryption protector. This is metadata used for the Azure portal - experience. - :vartype kind: str - :ivar location: Resource location. - :vartype location: str - :ivar subregion: Subregion of the encryption protector. - :vartype subregion: str - :param server_key_name: The name of the server key. - :type server_key_name: str - :param server_key_type: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. - Possible values include: "ServiceManaged", "AzureKeyVault". - :type server_key_type: str or ~azure.mgmt.synapse.models.ServerKeyType - :ivar uri: The URI of the server key. - :vartype uri: str - :ivar thumbprint: Thumbprint of the server key. - :vartype thumbprint: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'readonly': True}, - 'location': {'readonly': True}, - 'subregion': {'readonly': True}, - 'uri': {'readonly': True}, - 'thumbprint': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'subregion': {'key': 'properties.subregion', 'type': 'str'}, - 'server_key_name': {'key': 'properties.serverKeyName', 'type': 'str'}, - 'server_key_type': {'key': 'properties.serverKeyType', 'type': 'str'}, - 'uri': {'key': 'properties.uri', 'type': 'str'}, - 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionProtector, self).__init__(**kwargs) - self.kind = None - self.location = None - self.subregion = None - self.server_key_name = kwargs.get('server_key_name', None) - self.server_key_type = kwargs.get('server_key_type', None) - self.uri = None - self.thumbprint = None - - -class EncryptionProtectorListResult(msrest.serialization.Model): - """A list of server encryption protectors. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.synapse.models.EncryptionProtector] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[EncryptionProtector]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EncryptionProtectorListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class EntityReference(msrest.serialization.Model): - """The entity reference. - - :param type: The type of this referenced entity. Possible values include: - "IntegrationRuntimeReference", "LinkedServiceReference". - :type type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeEntityReferenceType - :param reference_name: The name of this referenced entity. - :type reference_name: str - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'reference_name': {'key': 'referenceName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EntityReference, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.reference_name = kwargs.get('reference_name', None) - - -class EnvironmentVariableSetup(CustomSetupBase): - """The custom setup of setting environment variable. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of custom setup.Constant filled by server. - :type type: str - :param variable_name: Required. The name of the environment variable. - :type variable_name: str - :param variable_value: Required. The value of the environment variable. - :type variable_value: str - """ - - _validation = { - 'type': {'required': True}, - 'variable_name': {'required': True}, - 'variable_value': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'variable_name': {'key': 'typeProperties.variableName', 'type': 'str'}, - 'variable_value': {'key': 'typeProperties.variableValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EnvironmentVariableSetup, self).__init__(**kwargs) - self.type = 'EnvironmentVariableSetup' # type: str - self.variable_name = kwargs['variable_name'] - self.variable_value = kwargs['variable_value'] - - -class ErrorAdditionalInfo(msrest.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: any - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(msrest.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.synapse.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.synapse.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': '[ErrorDetail]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(msrest.serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - - :param error: The error object. - :type error: ~azure.mgmt.synapse.models.ErrorDetail - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class EventGridDataConnection(DataConnection): - """Class representing an Event Grid data connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. - Possible values include: "EventHub", "EventGrid", "IotHub". - :type kind: str or ~azure.mgmt.synapse.models.DataConnectionKind - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.synapse.models.SystemData - :param storage_account_resource_id: The resource ID of the storage account where the data - resides. - :type storage_account_resource_id: str - :param event_hub_resource_id: The resource ID where the event grid is configured to send - events. - :type event_hub_resource_id: str - :param consumer_group: The event hub consumer group. - :type consumer_group: str - :param table_name: The table where the data should be ingested. Optionally the table - information can be added to each message. - :type table_name: str - :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the - mapping information can be added to each message. - :type mapping_rule_name: str - :param data_format: The data format of the message. Optionally the data format can be added to - each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", - "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", - "W3CLOGFILE". - :type data_format: str or ~azure.mgmt.synapse.models.EventGridDataFormat - :param ignore_first_record: A Boolean value that, if set to true, indicates that ingestion - should ignore the first record of every file. - :type ignore_first_record: bool - :param blob_storage_event_type: The name of blob storage event type to process. Possible values - include: "Microsoft.Storage.BlobCreated", "Microsoft.Storage.BlobRenamed". - :type blob_storage_event_type: str or ~azure.mgmt.synapse.models.BlobStorageEventType - :ivar provisioning_state: The provisioned state of the resource. Possible values include: - "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'storage_account_resource_id': {'key': 'properties.storageAccountResourceId', 'type': 'str'}, - 'event_hub_resource_id': {'key': 'properties.eventHubResourceId', 'type': 'str'}, - 'consumer_group': {'key': 'properties.consumerGroup', 'type': 'str'}, - 'table_name': {'key': 'properties.tableName', 'type': 'str'}, - 'mapping_rule_name': {'key': 'properties.mappingRuleName', 'type': 'str'}, - 'data_format': {'key': 'properties.dataFormat', 'type': 'str'}, - 'ignore_first_record': {'key': 'properties.ignoreFirstRecord', 'type': 'bool'}, - 'blob_storage_event_type': {'key': 'properties.blobStorageEventType', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventGridDataConnection, self).__init__(**kwargs) - self.kind = 'EventGrid' # type: str - self.storage_account_resource_id = kwargs.get('storage_account_resource_id', None) - self.event_hub_resource_id = kwargs.get('event_hub_resource_id', None) - self.consumer_group = kwargs.get('consumer_group', None) - self.table_name = kwargs.get('table_name', None) - self.mapping_rule_name = kwargs.get('mapping_rule_name', None) - self.data_format = kwargs.get('data_format', None) - self.ignore_first_record = kwargs.get('ignore_first_record', None) - self.blob_storage_event_type = kwargs.get('blob_storage_event_type', None) - self.provisioning_state = None - - -class EventHubDataConnection(DataConnection): - """Class representing an event hub data connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. - Possible values include: "EventHub", "EventGrid", "IotHub". - :type kind: str or ~azure.mgmt.synapse.models.DataConnectionKind - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.synapse.models.SystemData - :param event_hub_resource_id: The resource ID of the event hub to be used to create a data - connection. - :type event_hub_resource_id: str - :param consumer_group: The event hub consumer group. - :type consumer_group: str - :param table_name: The table where the data should be ingested. Optionally the table - information can be added to each message. - :type table_name: str - :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the - mapping information can be added to each message. - :type mapping_rule_name: str - :param data_format: The data format of the message. Optionally the data format can be added to - each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", - "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", - "W3CLOGFILE". - :type data_format: str or ~azure.mgmt.synapse.models.EventHubDataFormat - :param event_system_properties: System properties of the event hub. - :type event_system_properties: list[str] - :param compression: The event hub messages compression type. Possible values include: "None", - "GZip". - :type compression: str or ~azure.mgmt.synapse.models.Compression - :ivar provisioning_state: The provisioned state of the resource. Possible values include: - "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState - :param managed_identity_resource_id: The resource ID of a managed identity (system or user - assigned) to be used to authenticate with event hub. - :type managed_identity_resource_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'event_hub_resource_id': {'key': 'properties.eventHubResourceId', 'type': 'str'}, - 'consumer_group': {'key': 'properties.consumerGroup', 'type': 'str'}, - 'table_name': {'key': 'properties.tableName', 'type': 'str'}, - 'mapping_rule_name': {'key': 'properties.mappingRuleName', 'type': 'str'}, - 'data_format': {'key': 'properties.dataFormat', 'type': 'str'}, - 'event_system_properties': {'key': 'properties.eventSystemProperties', 'type': '[str]'}, - 'compression': {'key': 'properties.compression', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'managed_identity_resource_id': {'key': 'properties.managedIdentityResourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventHubDataConnection, self).__init__(**kwargs) - self.kind = 'EventHub' # type: str - self.event_hub_resource_id = kwargs.get('event_hub_resource_id', None) - self.consumer_group = kwargs.get('consumer_group', None) - self.table_name = kwargs.get('table_name', None) - self.mapping_rule_name = kwargs.get('mapping_rule_name', None) - self.data_format = kwargs.get('data_format', None) - self.event_system_properties = kwargs.get('event_system_properties', None) - self.compression = kwargs.get('compression', None) - self.provisioning_state = None - self.managed_identity_resource_id = kwargs.get('managed_identity_resource_id', None) - - -class ExtendedServerBlobAuditingPolicy(ProxyResource): - """An extended server blob auditing policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param predicate_expression: Specifies condition of where clause when creating an audit. - :type predicate_expression: str - :param state: Specifies the state of the policy. If state is Enabled, storageEndpoint or - isAzureMonitorTargetEnabled are required. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyState - :param storage_endpoint: Specifies the blob storage endpoint (e.g. - https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or - isAzureMonitorTargetEnabled is required. - :type storage_endpoint: str - :param storage_account_access_key: Specifies the identifier key of the auditing storage - account. - If state is Enabled and storageEndpoint is specified, not specifying the - storageAccountAccessKey will use SQL server system-assigned managed identity to access the - storage. - Prerequisites for using managed identity authentication: - - - #. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). - #. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data - Contributor' RBAC role to the server identity. - For more information, see `Auditing to storage using Managed Identity authentication - `_. - :type storage_account_access_key: str - :param retention_days: Specifies the number of days to keep in the audit logs in the storage - account. - :type retention_days: int - :param audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit. - - The recommended set of action groups to use is the following combination - this will audit all - the queries and stored procedures executed against the database, as well as successful and - failed logins: - - BATCH_COMPLETED_GROUP, - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - FAILED_DATABASE_AUTHENTICATION_GROUP. - - This above combination is also the set that is configured by default when enabling auditing - from the Azure portal. - - The supported action groups to audit are (note: choose only specific groups that cover your - auditing needs. Using unnecessary groups could lead to very large quantities of audit records): - - APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - BACKUP_RESTORE_GROUP - DATABASE_LOGOUT_GROUP - DATABASE_OBJECT_CHANGE_GROUP - DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - DATABASE_OPERATION_GROUP - DATABASE_PERMISSION_CHANGE_GROUP - DATABASE_PRINCIPAL_CHANGE_GROUP - DATABASE_PRINCIPAL_IMPERSONATION_GROUP - DATABASE_ROLE_MEMBER_CHANGE_GROUP - FAILED_DATABASE_AUTHENTICATION_GROUP - SCHEMA_OBJECT_ACCESS_GROUP - SCHEMA_OBJECT_CHANGE_GROUP - SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - USER_CHANGE_PASSWORD_GROUP - BATCH_STARTED_GROUP - BATCH_COMPLETED_GROUP - - These are groups that cover all sql statements and stored procedures executed against the - database, and should not be used in combination with other groups as this will result in - duplicate audit logs. - - For more information, see `Database-Level Audit Action Groups - `_. - - For Database auditing policy, specific Actions can also be specified (note that Actions cannot - be specified for Server auditing policy). The supported actions to audit are: - SELECT - UPDATE - INSERT - DELETE - EXECUTE - RECEIVE - REFERENCES - - The general form for defining an action to be audited is: - {action} ON {object} BY {principal} - - Note that :code:`` in the above format can refer to an object like a table, view, or - stored procedure, or an entire database or schema. For the latter cases, the forms - DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. - - For example: - SELECT on dbo.myTable by public - SELECT on DATABASE::myDatabase by public - SELECT on SCHEMA::mySchema by public - - For more information, see `Database-Level Audit Actions - `_. - :type audit_actions_and_groups: list[str] - :param storage_account_subscription_id: Specifies the blob storage subscription Id. - :type storage_account_subscription_id: str - :param is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is the - storage's secondary key. - :type is_storage_secondary_key_in_use: bool - :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure - Monitor. - In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and - 'isAzureMonitorTargetEnabled' as true. - - When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' - diagnostic logs category on the database should be also created. - Note that for server level audit you should use the 'master' database as {databaseName}. - - Diagnostic Settings URI format: - PUT - https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview - - For more information, see `Diagnostic Settings REST API - `_ - or `Diagnostic Settings PowerShell `_. - :type is_azure_monitor_target_enabled: bool - :param queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before - audit actions are forced to be processed. - The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. - :type queue_delay_ms: int - """ - - _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'}, - 'predicate_expression': {'key': 'properties.predicateExpression', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, - 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, - 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, - 'audit_actions_and_groups': {'key': 'properties.auditActionsAndGroups', 'type': '[str]'}, - 'storage_account_subscription_id': {'key': 'properties.storageAccountSubscriptionId', 'type': 'str'}, - 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, - 'is_azure_monitor_target_enabled': {'key': 'properties.isAzureMonitorTargetEnabled', 'type': 'bool'}, - 'queue_delay_ms': {'key': 'properties.queueDelayMs', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtendedServerBlobAuditingPolicy, self).__init__(**kwargs) - self.predicate_expression = kwargs.get('predicate_expression', None) - self.state = kwargs.get('state', None) - self.storage_endpoint = kwargs.get('storage_endpoint', None) - self.storage_account_access_key = kwargs.get('storage_account_access_key', None) - self.retention_days = kwargs.get('retention_days', None) - self.audit_actions_and_groups = kwargs.get('audit_actions_and_groups', None) - self.storage_account_subscription_id = kwargs.get('storage_account_subscription_id', None) - self.is_storage_secondary_key_in_use = kwargs.get('is_storage_secondary_key_in_use', None) - self.is_azure_monitor_target_enabled = kwargs.get('is_azure_monitor_target_enabled', None) - self.queue_delay_ms = kwargs.get('queue_delay_ms', None) - - -class ExtendedServerBlobAuditingPolicyListResult(msrest.serialization.Model): - """A list of server extended auditing settings. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.synapse.models.ExtendedServerBlobAuditingPolicy] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ExtendedServerBlobAuditingPolicy]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtendedServerBlobAuditingPolicyListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ExtendedSqlPoolBlobAuditingPolicy(ProxyResource): - """An extended Sql pool blob auditing policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param predicate_expression: Specifies condition of where clause when creating an audit. - :type predicate_expression: str - :param state: Specifies the state of the policy. If state is Enabled, storageEndpoint or - isAzureMonitorTargetEnabled are required. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyState - :param storage_endpoint: Specifies the blob storage endpoint (e.g. - https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or - isAzureMonitorTargetEnabled is required. - :type storage_endpoint: str - :param storage_account_access_key: Specifies the identifier key of the auditing storage - account. - If state is Enabled and storageEndpoint is specified, not specifying the - storageAccountAccessKey will use SQL server system-assigned managed identity to access the - storage. - Prerequisites for using managed identity authentication: - - - #. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). - #. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data - Contributor' RBAC role to the server identity. - For more information, see `Auditing to storage using Managed Identity authentication - `_. - :type storage_account_access_key: str - :param retention_days: Specifies the number of days to keep in the audit logs in the storage - account. - :type retention_days: int - :param audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit. - - The recommended set of action groups to use is the following combination - this will audit all - the queries and stored procedures executed against the database, as well as successful and - failed logins: - - BATCH_COMPLETED_GROUP, - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - FAILED_DATABASE_AUTHENTICATION_GROUP. - - This above combination is also the set that is configured by default when enabling auditing - from the Azure portal. - - The supported action groups to audit are (note: choose only specific groups that cover your - auditing needs. Using unnecessary groups could lead to very large quantities of audit records): - - APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - BACKUP_RESTORE_GROUP - DATABASE_LOGOUT_GROUP - DATABASE_OBJECT_CHANGE_GROUP - DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - DATABASE_OPERATION_GROUP - DATABASE_PERMISSION_CHANGE_GROUP - DATABASE_PRINCIPAL_CHANGE_GROUP - DATABASE_PRINCIPAL_IMPERSONATION_GROUP - DATABASE_ROLE_MEMBER_CHANGE_GROUP - FAILED_DATABASE_AUTHENTICATION_GROUP - SCHEMA_OBJECT_ACCESS_GROUP - SCHEMA_OBJECT_CHANGE_GROUP - SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - USER_CHANGE_PASSWORD_GROUP - BATCH_STARTED_GROUP - BATCH_COMPLETED_GROUP - - These are groups that cover all sql statements and stored procedures executed against the - database, and should not be used in combination with other groups as this will result in - duplicate audit logs. - - For more information, see `Database-Level Audit Action Groups - `_. - - For Database auditing policy, specific Actions can also be specified (note that Actions cannot - be specified for Server auditing policy). The supported actions to audit are: - SELECT - UPDATE - INSERT - DELETE - EXECUTE - RECEIVE - REFERENCES - - The general form for defining an action to be audited is: - {action} ON {object} BY {principal} - - Note that :code:`` in the above format can refer to an object like a table, view, or - stored procedure, or an entire database or schema. For the latter cases, the forms - DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. - - For example: - SELECT on dbo.myTable by public - SELECT on DATABASE::myDatabase by public - SELECT on SCHEMA::mySchema by public - - For more information, see `Database-Level Audit Actions - `_. - :type audit_actions_and_groups: list[str] - :param storage_account_subscription_id: Specifies the blob storage subscription Id. - :type storage_account_subscription_id: str - :param is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is the - storage's secondary key. - :type is_storage_secondary_key_in_use: bool - :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure - Monitor. - In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and - 'isAzureMonitorTargetEnabled' as true. - - When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' - diagnostic logs category on the database should be also created. - Note that for server level audit you should use the 'master' database as {databaseName}. - - Diagnostic Settings URI format: - PUT - https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview - - For more information, see `Diagnostic Settings REST API - `_ - or `Diagnostic Settings PowerShell `_. - :type is_azure_monitor_target_enabled: bool - :param queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before - audit actions are forced to be processed. - The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. - :type queue_delay_ms: int - """ - - _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'}, - 'predicate_expression': {'key': 'properties.predicateExpression', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, - 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, - 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, - 'audit_actions_and_groups': {'key': 'properties.auditActionsAndGroups', 'type': '[str]'}, - 'storage_account_subscription_id': {'key': 'properties.storageAccountSubscriptionId', 'type': 'str'}, - 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, - 'is_azure_monitor_target_enabled': {'key': 'properties.isAzureMonitorTargetEnabled', 'type': 'bool'}, - 'queue_delay_ms': {'key': 'properties.queueDelayMs', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtendedSqlPoolBlobAuditingPolicy, self).__init__(**kwargs) - self.predicate_expression = kwargs.get('predicate_expression', None) - self.state = kwargs.get('state', None) - self.storage_endpoint = kwargs.get('storage_endpoint', None) - self.storage_account_access_key = kwargs.get('storage_account_access_key', None) - self.retention_days = kwargs.get('retention_days', None) - self.audit_actions_and_groups = kwargs.get('audit_actions_and_groups', None) - self.storage_account_subscription_id = kwargs.get('storage_account_subscription_id', None) - self.is_storage_secondary_key_in_use = kwargs.get('is_storage_secondary_key_in_use', None) - self.is_azure_monitor_target_enabled = kwargs.get('is_azure_monitor_target_enabled', None) - self.queue_delay_ms = kwargs.get('queue_delay_ms', None) - - -class ExtendedSqlPoolBlobAuditingPolicyListResult(msrest.serialization.Model): - """A list of sql pool extended auditing settings. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.synapse.models.ExtendedSqlPoolBlobAuditingPolicy] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ExtendedSqlPoolBlobAuditingPolicy]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtendedSqlPoolBlobAuditingPolicyListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class FollowerDatabaseDefinition(msrest.serialization.Model): - """A class representing follower database request. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param kusto_pool_resource_id: Required. Resource id of the cluster that follows a database - owned by this cluster. - :type kusto_pool_resource_id: str - :param attached_database_configuration_name: Required. Resource name of the attached database - configuration in the follower cluster. - :type attached_database_configuration_name: str - :ivar database_name: The database name owned by this cluster that was followed. * in case - following all databases. - :vartype database_name: str - """ - - _validation = { - 'kusto_pool_resource_id': {'required': True}, - 'attached_database_configuration_name': {'required': True}, - 'database_name': {'readonly': True}, - } - - _attribute_map = { - 'kusto_pool_resource_id': {'key': 'clusterResourceId', 'type': 'str'}, - 'attached_database_configuration_name': {'key': 'attachedDatabaseConfigurationName', 'type': 'str'}, - 'database_name': {'key': 'databaseName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FollowerDatabaseDefinition, self).__init__(**kwargs) - self.kusto_pool_resource_id = kwargs['kusto_pool_resource_id'] - self.attached_database_configuration_name = kwargs['attached_database_configuration_name'] - self.database_name = None - - -class FollowerDatabaseListResult(msrest.serialization.Model): - """The list Kusto database principals operation response. - - :param value: The list of follower database result. - :type value: list[~azure.mgmt.synapse.models.FollowerDatabaseDefinition] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FollowerDatabaseDefinition]'}, - } - - def __init__( - self, - **kwargs - ): - super(FollowerDatabaseListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class GeoBackupPolicy(ProxyResource): - """A database geo backup policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar kind: Kind of geo backup policy. This is metadata used for the Azure portal experience. - :vartype kind: str - :ivar location: Backup policy location. - :vartype location: str - :param state: Required. The state of the geo backup policy. Possible values include: - "Disabled", "Enabled". - :type state: str or ~azure.mgmt.synapse.models.GeoBackupPolicyState - :ivar storage_type: The storage type of the geo backup policy. - :vartype storage_type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'readonly': True}, - 'location': {'readonly': True}, - 'state': {'required': True}, - 'storage_type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'storage_type': {'key': 'properties.storageType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoBackupPolicy, self).__init__(**kwargs) - self.kind = None - self.location = None - self.state = kwargs['state'] - self.storage_type = None - - -class GeoBackupPolicyListResult(msrest.serialization.Model): - """The response to a list geo backup policies request. - - :param value: The list of geo backup policies. - :type value: list[~azure.mgmt.synapse.models.GeoBackupPolicy] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[GeoBackupPolicy]'}, - } - - def __init__( - self, - **kwargs - ): - super(GeoBackupPolicyListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class GetSsisObjectMetadataRequest(msrest.serialization.Model): - """The request payload of get SSIS object metadata. - - :param metadata_path: Metadata path. - :type metadata_path: str - """ - - _attribute_map = { - 'metadata_path': {'key': 'metadataPath', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GetSsisObjectMetadataRequest, self).__init__(**kwargs) - self.metadata_path = kwargs.get('metadata_path', None) - - -class IntegrationRuntime(msrest.serialization.Model): - """Azure Synapse nested object which serves as a compute resource for activities. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ManagedIntegrationRuntime, SelfHostedIntegrationRuntime. - - All required parameters must be populated in order to send to Azure. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, any] - :param type: Required. Type of integration runtime.Constant filled by server. Possible values - include: "Managed", "SelfHosted". - :type type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeType - :param description: Integration runtime description. - :type description: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'type': {'key': 'type', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'Managed': 'ManagedIntegrationRuntime', 'SelfHosted': 'SelfHostedIntegrationRuntime'} - } - - def __init__( - self, - **kwargs - ): - super(IntegrationRuntime, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.type = 'IntegrationRuntime' # type: str - self.description = kwargs.get('description', None) - - -class IntegrationRuntimeAuthKeys(msrest.serialization.Model): - """The integration runtime authentication keys. - - :param auth_key1: The primary integration runtime authentication key. - :type auth_key1: str - :param auth_key2: The secondary integration runtime authentication key. - :type auth_key2: str - """ - - _attribute_map = { - 'auth_key1': {'key': 'authKey1', 'type': 'str'}, - 'auth_key2': {'key': 'authKey2', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IntegrationRuntimeAuthKeys, self).__init__(**kwargs) - self.auth_key1 = kwargs.get('auth_key1', None) - self.auth_key2 = kwargs.get('auth_key2', None) - - -class IntegrationRuntimeComputeProperties(msrest.serialization.Model): - """The compute resource properties for managed integration runtime. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, any] - :param location: The location for managed integration runtime. The supported regions could be - found on - https://docs.microsoft.com/en-us/azure/data-factory/data-factory-data-movement-activities. - :type location: str - :param node_size: The node size requirement to managed integration runtime. - :type node_size: str - :param number_of_nodes: The required number of nodes for managed integration runtime. - :type number_of_nodes: int - :param max_parallel_executions_per_node: Maximum parallel executions count per node for managed - integration runtime. - :type max_parallel_executions_per_node: int - :param data_flow_properties: Data flow properties for managed integration runtime. - :type data_flow_properties: ~azure.mgmt.synapse.models.IntegrationRuntimeDataFlowProperties - :param v_net_properties: VNet properties for managed integration runtime. - :type v_net_properties: ~azure.mgmt.synapse.models.IntegrationRuntimeVNetProperties - """ - - _validation = { - 'number_of_nodes': {'minimum': 1}, - 'max_parallel_executions_per_node': {'minimum': 1}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'node_size': {'key': 'nodeSize', 'type': 'str'}, - 'number_of_nodes': {'key': 'numberOfNodes', 'type': 'int'}, - 'max_parallel_executions_per_node': {'key': 'maxParallelExecutionsPerNode', 'type': 'int'}, - 'data_flow_properties': {'key': 'dataFlowProperties', 'type': 'IntegrationRuntimeDataFlowProperties'}, - 'v_net_properties': {'key': 'vNetProperties', 'type': 'IntegrationRuntimeVNetProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(IntegrationRuntimeComputeProperties, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.location = kwargs.get('location', None) - self.node_size = kwargs.get('node_size', None) - self.number_of_nodes = kwargs.get('number_of_nodes', None) - self.max_parallel_executions_per_node = kwargs.get('max_parallel_executions_per_node', None) - self.data_flow_properties = kwargs.get('data_flow_properties', None) - self.v_net_properties = kwargs.get('v_net_properties', None) - - -class IntegrationRuntimeConnectionInfo(msrest.serialization.Model): - """Connection information for encrypting the on-premises data source credentials. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, any] - :ivar service_token: The token generated in service. Callers use this token to authenticate to - integration runtime. - :vartype service_token: str - :ivar identity_cert_thumbprint: The integration runtime SSL certificate thumbprint. Click-Once - application uses it to do server validation. - :vartype identity_cert_thumbprint: str - :ivar host_service_uri: The on-premises integration runtime host URL. - :vartype host_service_uri: str - :ivar version: The integration runtime version. - :vartype version: str - :ivar public_key: The public key for encrypting a credential when transferring the credential - to the integration runtime. - :vartype public_key: str - :ivar is_identity_cert_exprired: Whether the identity certificate is expired. - :vartype is_identity_cert_exprired: bool - """ - - _validation = { - 'service_token': {'readonly': True}, - 'identity_cert_thumbprint': {'readonly': True}, - 'host_service_uri': {'readonly': True}, - 'version': {'readonly': True}, - 'public_key': {'readonly': True}, - 'is_identity_cert_exprired': {'readonly': True}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'service_token': {'key': 'serviceToken', 'type': 'str'}, - 'identity_cert_thumbprint': {'key': 'identityCertThumbprint', 'type': 'str'}, - 'host_service_uri': {'key': 'hostServiceUri', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'public_key': {'key': 'publicKey', 'type': 'str'}, - 'is_identity_cert_exprired': {'key': 'isIdentityCertExprired', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(IntegrationRuntimeConnectionInfo, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.service_token = None - self.identity_cert_thumbprint = None - self.host_service_uri = None - self.version = None - self.public_key = None - self.is_identity_cert_exprired = None - - -class IntegrationRuntimeCustomSetupScriptProperties(msrest.serialization.Model): - """Custom setup script properties for a managed dedicated integration runtime. - - :param blob_container_uri: The URI of the Azure blob container that contains the custom setup - script. - :type blob_container_uri: str - :param sas_token: The SAS token of the Azure blob container. - :type sas_token: ~azure.mgmt.synapse.models.SecureString - """ - - _attribute_map = { - 'blob_container_uri': {'key': 'blobContainerUri', 'type': 'str'}, - 'sas_token': {'key': 'sasToken', 'type': 'SecureString'}, - } - - def __init__( - self, - **kwargs - ): - super(IntegrationRuntimeCustomSetupScriptProperties, self).__init__(**kwargs) - self.blob_container_uri = kwargs.get('blob_container_uri', None) - self.sas_token = kwargs.get('sas_token', None) - - -class IntegrationRuntimeDataFlowProperties(msrest.serialization.Model): - """Data flow properties for managed integration runtime. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, any] - :param compute_type: Compute type of the cluster which will execute data flow job. Possible - values include: "General", "MemoryOptimized", "ComputeOptimized". - :type compute_type: str or ~azure.mgmt.synapse.models.DataFlowComputeType - :param core_count: Core count of the cluster which will execute data flow job. Supported values - are: 8, 16, 32, 48, 80, 144 and 272. - :type core_count: int - :param time_to_live: Time to live (in minutes) setting of the cluster which will execute data - flow job. - :type time_to_live: int - :param cleanup: Cluster will not be recycled and it will be used in next data flow activity run - until TTL (time to live) is reached if this is set as false. Default is true. - :type cleanup: bool - """ - - _validation = { - 'time_to_live': {'minimum': 0}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'compute_type': {'key': 'computeType', 'type': 'str'}, - 'core_count': {'key': 'coreCount', 'type': 'int'}, - 'time_to_live': {'key': 'timeToLive', 'type': 'int'}, - 'cleanup': {'key': 'cleanup', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(IntegrationRuntimeDataFlowProperties, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.compute_type = kwargs.get('compute_type', None) - self.core_count = kwargs.get('core_count', None) - self.time_to_live = kwargs.get('time_to_live', None) - self.cleanup = kwargs.get('cleanup', None) - - -class IntegrationRuntimeDataProxyProperties(msrest.serialization.Model): - """Data proxy properties for a managed dedicated integration runtime. - - :param connect_via: The self-hosted integration runtime reference. - :type connect_via: ~azure.mgmt.synapse.models.EntityReference - :param staging_linked_service: The staging linked service reference. - :type staging_linked_service: ~azure.mgmt.synapse.models.EntityReference - :param path: The path to contain the staged data in the Blob storage. - :type path: str - """ - - _attribute_map = { - 'connect_via': {'key': 'connectVia', 'type': 'EntityReference'}, - 'staging_linked_service': {'key': 'stagingLinkedService', 'type': 'EntityReference'}, - 'path': {'key': 'path', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IntegrationRuntimeDataProxyProperties, self).__init__(**kwargs) - self.connect_via = kwargs.get('connect_via', None) - self.staging_linked_service = kwargs.get('staging_linked_service', None) - self.path = kwargs.get('path', None) - - -class IntegrationRuntimeListResponse(msrest.serialization.Model): - """A list of integration runtime resources. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. List of integration runtimes. - :type value: list[~azure.mgmt.synapse.models.IntegrationRuntimeResource] - :param next_link: The link to the next page of results, if any remaining results exist. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[IntegrationRuntimeResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IntegrationRuntimeListResponse, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class IntegrationRuntimeMonitoringData(msrest.serialization.Model): - """Get monitoring data response. - - :param name: Integration runtime name. - :type name: str - :param nodes: Integration runtime node monitoring data. - :type nodes: list[~azure.mgmt.synapse.models.IntegrationRuntimeNodeMonitoringData] - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'nodes': {'key': 'nodes', 'type': '[IntegrationRuntimeNodeMonitoringData]'}, - } - - def __init__( - self, - **kwargs - ): - super(IntegrationRuntimeMonitoringData, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.nodes = kwargs.get('nodes', None) - - -class IntegrationRuntimeNodeIpAddress(msrest.serialization.Model): - """The IP address of self-hosted integration runtime node. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar ip_address: The IP address of self-hosted integration runtime node. - :vartype ip_address: str - """ - - _validation = { - 'ip_address': {'readonly': True}, - } - - _attribute_map = { - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IntegrationRuntimeNodeIpAddress, self).__init__(**kwargs) - self.ip_address = None - - -class IntegrationRuntimeNodeMonitoringData(msrest.serialization.Model): - """Monitoring data for integration runtime node. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, any] - :ivar node_name: Name of the integration runtime node. - :vartype node_name: str - :ivar available_memory_in_mb: Available memory (MB) on the integration runtime node. - :vartype available_memory_in_mb: int - :ivar cpu_utilization: CPU percentage on the integration runtime node. - :vartype cpu_utilization: int - :ivar concurrent_jobs_limit: Maximum concurrent jobs on the integration runtime node. - :vartype concurrent_jobs_limit: int - :ivar concurrent_jobs_running: The number of jobs currently running on the integration runtime - node. - :vartype concurrent_jobs_running: int - :ivar max_concurrent_jobs: The maximum concurrent jobs in this integration runtime. - :vartype max_concurrent_jobs: int - :ivar sent_bytes: Sent bytes on the integration runtime node. - :vartype sent_bytes: float - :ivar received_bytes: Received bytes on the integration runtime node. - :vartype received_bytes: float - """ - - _validation = { - 'node_name': {'readonly': True}, - 'available_memory_in_mb': {'readonly': True}, - 'cpu_utilization': {'readonly': True}, - 'concurrent_jobs_limit': {'readonly': True}, - 'concurrent_jobs_running': {'readonly': True}, - 'max_concurrent_jobs': {'readonly': True}, - 'sent_bytes': {'readonly': True}, - 'received_bytes': {'readonly': True}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'node_name': {'key': 'nodeName', 'type': 'str'}, - 'available_memory_in_mb': {'key': 'availableMemoryInMB', 'type': 'int'}, - 'cpu_utilization': {'key': 'cpuUtilization', 'type': 'int'}, - 'concurrent_jobs_limit': {'key': 'concurrentJobsLimit', 'type': 'int'}, - 'concurrent_jobs_running': {'key': 'concurrentJobsRunning', 'type': 'int'}, - 'max_concurrent_jobs': {'key': 'maxConcurrentJobs', 'type': 'int'}, - 'sent_bytes': {'key': 'sentBytes', 'type': 'float'}, - 'received_bytes': {'key': 'receivedBytes', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(IntegrationRuntimeNodeMonitoringData, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.node_name = None - self.available_memory_in_mb = None - self.cpu_utilization = None - self.concurrent_jobs_limit = None - self.concurrent_jobs_running = None - self.max_concurrent_jobs = None - self.sent_bytes = None - self.received_bytes = None - - -class IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint(msrest.serialization.Model): - """Azure-SSIS integration runtime outbound network dependency endpoints for one category. - - :param category: The category of outbound network dependency. - :type category: str - :param endpoints: The endpoints for outbound network dependency. - :type endpoints: - list[~azure.mgmt.synapse.models.IntegrationRuntimeOutboundNetworkDependenciesEndpoint] - """ - - _attribute_map = { - 'category': {'key': 'category', 'type': 'str'}, - 'endpoints': {'key': 'endpoints', 'type': '[IntegrationRuntimeOutboundNetworkDependenciesEndpoint]'}, - } - - def __init__( - self, - **kwargs - ): - super(IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint, self).__init__(**kwargs) - self.category = kwargs.get('category', None) - self.endpoints = kwargs.get('endpoints', None) - - -class IntegrationRuntimeOutboundNetworkDependenciesEndpoint(msrest.serialization.Model): - """The endpoint for Azure-SSIS integration runtime outbound network dependency. - - :param domain_name: The domain name of endpoint. - :type domain_name: str - :param endpoint_details: The details of endpoint. - :type endpoint_details: - list[~azure.mgmt.synapse.models.IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails] - """ - - _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'endpoint_details': {'key': 'endpointDetails', 'type': '[IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails]'}, - } - - def __init__( - self, - **kwargs - ): - super(IntegrationRuntimeOutboundNetworkDependenciesEndpoint, self).__init__(**kwargs) - self.domain_name = kwargs.get('domain_name', None) - self.endpoint_details = kwargs.get('endpoint_details', None) - - -class IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails(msrest.serialization.Model): - """The details of Azure-SSIS integration runtime outbound network dependency endpoint. - - :param port: The port of endpoint. - :type port: int - """ - - _attribute_map = { - 'port': {'key': 'port', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails, self).__init__(**kwargs) - self.port = kwargs.get('port', None) - - -class IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse(msrest.serialization.Model): - """Azure-SSIS integration runtime outbound network dependency endpoints. - - :param value: The list of outbound network dependency endpoints. - :type value: - list[~azure.mgmt.synapse.models.IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint]'}, - } - - def __init__( - self, - **kwargs - ): - super(IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class IntegrationRuntimeRegenerateKeyParameters(msrest.serialization.Model): - """Parameters to regenerate the authentication key. - - :param key_name: The name of the authentication key to regenerate. Possible values include: - "authKey1", "authKey2". - :type key_name: str or ~azure.mgmt.synapse.models.IntegrationRuntimeAuthKeyName - """ - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IntegrationRuntimeRegenerateKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs.get('key_name', None) - - -class SubResource(AzureEntityResource): - """Azure Synapse nested resource, which belongs to a workspace. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SubResource, self).__init__(**kwargs) - - -class IntegrationRuntimeResource(SubResource): - """Integration runtime resource type. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param properties: Required. Integration runtime properties. - :type properties: ~azure.mgmt.synapse.models.IntegrationRuntime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'IntegrationRuntime'}, - } - - def __init__( - self, - **kwargs - ): - super(IntegrationRuntimeResource, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class IntegrationRuntimeSsisCatalogInfo(msrest.serialization.Model): - """Catalog information for managed dedicated integration runtime. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, any] - :param catalog_server_endpoint: The catalog database server URL. - :type catalog_server_endpoint: str - :param catalog_admin_user_name: The administrator user name of catalog database. - :type catalog_admin_user_name: str - :param catalog_admin_password: The password of the administrator user account of the catalog - database. - :type catalog_admin_password: ~azure.mgmt.synapse.models.SecureString - :param catalog_pricing_tier: The pricing tier for the catalog database. The valid values could - be found in https://azure.microsoft.com/en-us/pricing/details/sql-database/. Possible values - include: "Basic", "Standard", "Premium", "PremiumRS". - :type catalog_pricing_tier: str or - ~azure.mgmt.synapse.models.IntegrationRuntimeSsisCatalogPricingTier - """ - - _validation = { - 'catalog_admin_user_name': {'max_length': 128, 'min_length': 1}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'catalog_server_endpoint': {'key': 'catalogServerEndpoint', 'type': 'str'}, - 'catalog_admin_user_name': {'key': 'catalogAdminUserName', 'type': 'str'}, - 'catalog_admin_password': {'key': 'catalogAdminPassword', 'type': 'SecureString'}, - 'catalog_pricing_tier': {'key': 'catalogPricingTier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IntegrationRuntimeSsisCatalogInfo, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.catalog_server_endpoint = kwargs.get('catalog_server_endpoint', None) - self.catalog_admin_user_name = kwargs.get('catalog_admin_user_name', None) - self.catalog_admin_password = kwargs.get('catalog_admin_password', None) - self.catalog_pricing_tier = kwargs.get('catalog_pricing_tier', None) - - -class IntegrationRuntimeSsisProperties(msrest.serialization.Model): - """SSIS properties for managed integration runtime. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, any] - :param catalog_info: Catalog information for managed dedicated integration runtime. - :type catalog_info: ~azure.mgmt.synapse.models.IntegrationRuntimeSsisCatalogInfo - :param license_type: License type for bringing your own license scenario. Possible values - include: "BasePrice", "LicenseIncluded". - :type license_type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeLicenseType - :param custom_setup_script_properties: Custom setup script properties for a managed dedicated - integration runtime. - :type custom_setup_script_properties: - ~azure.mgmt.synapse.models.IntegrationRuntimeCustomSetupScriptProperties - :param data_proxy_properties: Data proxy properties for a managed dedicated integration - runtime. - :type data_proxy_properties: ~azure.mgmt.synapse.models.IntegrationRuntimeDataProxyProperties - :param edition: The edition for the SSIS Integration Runtime. Possible values include: - "Standard", "Enterprise". - :type edition: str or ~azure.mgmt.synapse.models.IntegrationRuntimeEdition - :param express_custom_setup_properties: Custom setup without script properties for a SSIS - integration runtime. - :type express_custom_setup_properties: list[~azure.mgmt.synapse.models.CustomSetupBase] - """ - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'catalog_info': {'key': 'catalogInfo', 'type': 'IntegrationRuntimeSsisCatalogInfo'}, - 'license_type': {'key': 'licenseType', 'type': 'str'}, - 'custom_setup_script_properties': {'key': 'customSetupScriptProperties', 'type': 'IntegrationRuntimeCustomSetupScriptProperties'}, - 'data_proxy_properties': {'key': 'dataProxyProperties', 'type': 'IntegrationRuntimeDataProxyProperties'}, - 'edition': {'key': 'edition', 'type': 'str'}, - 'express_custom_setup_properties': {'key': 'expressCustomSetupProperties', 'type': '[CustomSetupBase]'}, - } - - def __init__( - self, - **kwargs - ): - super(IntegrationRuntimeSsisProperties, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.catalog_info = kwargs.get('catalog_info', None) - self.license_type = kwargs.get('license_type', None) - self.custom_setup_script_properties = kwargs.get('custom_setup_script_properties', None) - self.data_proxy_properties = kwargs.get('data_proxy_properties', None) - self.edition = kwargs.get('edition', None) - self.express_custom_setup_properties = kwargs.get('express_custom_setup_properties', None) - - -class IntegrationRuntimeStatus(msrest.serialization.Model): - """Integration runtime status. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ManagedIntegrationRuntimeStatus, SelfHostedIntegrationRuntimeStatus. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, any] - :param type: Required. Type of integration runtime.Constant filled by server. Possible values - include: "Managed", "SelfHosted". - :type type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeType - :ivar data_factory_name: The workspace name which the integration runtime belong to. - :vartype data_factory_name: str - :ivar state: The state of integration runtime. Possible values include: "Initial", "Stopped", - "Started", "Starting", "Stopping", "NeedRegistration", "Online", "Limited", "Offline", - "AccessDenied". - :vartype state: str or ~azure.mgmt.synapse.models.IntegrationRuntimeState - """ - - _validation = { - 'type': {'required': True}, - 'data_factory_name': {'readonly': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'type': {'key': 'type', 'type': 'str'}, - 'data_factory_name': {'key': 'dataFactoryName', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'Managed': 'ManagedIntegrationRuntimeStatus', 'SelfHosted': 'SelfHostedIntegrationRuntimeStatus'} - } - - def __init__( - self, - **kwargs - ): - super(IntegrationRuntimeStatus, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.type = 'IntegrationRuntimeStatus' # type: str - self.data_factory_name = None - self.state = None - - -class IntegrationRuntimeStatusResponse(msrest.serialization.Model): - """Integration runtime status response. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar name: The integration runtime name. - :vartype name: str - :param properties: Required. Integration runtime properties. - :type properties: ~azure.mgmt.synapse.models.IntegrationRuntimeStatus - """ - - _validation = { - 'name': {'readonly': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'IntegrationRuntimeStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(IntegrationRuntimeStatusResponse, self).__init__(**kwargs) - self.name = None - self.properties = kwargs['properties'] - - -class IntegrationRuntimeVNetProperties(msrest.serialization.Model): - """VNet properties for managed integration runtime. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, any] - :param v_net_id: The ID of the VNet that this integration runtime will join. - :type v_net_id: str - :param subnet: The name of the subnet this integration runtime will join. - :type subnet: str - :param public_i_ps: Resource IDs of the public IP addresses that this integration runtime will - use. - :type public_i_ps: list[str] - :param subnet_id: The ID of subnet, to which this Azure-SSIS integration runtime will be - joined. - :type subnet_id: str - """ - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'v_net_id': {'key': 'vNetId', 'type': 'str'}, - 'subnet': {'key': 'subnet', 'type': 'str'}, - 'public_i_ps': {'key': 'publicIPs', 'type': '[str]'}, - 'subnet_id': {'key': 'subnetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IntegrationRuntimeVNetProperties, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.v_net_id = kwargs.get('v_net_id', None) - self.subnet = kwargs.get('subnet', None) - self.public_i_ps = kwargs.get('public_i_ps', None) - self.subnet_id = kwargs.get('subnet_id', None) - - -class IotHubDataConnection(DataConnection): - """Class representing an iot hub data connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. - Possible values include: "EventHub", "EventGrid", "IotHub". - :type kind: str or ~azure.mgmt.synapse.models.DataConnectionKind - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.synapse.models.SystemData - :param iot_hub_resource_id: The resource ID of the Iot hub to be used to create a data - connection. - :type iot_hub_resource_id: str - :param consumer_group: The iot hub consumer group. - :type consumer_group: str - :param table_name: The table where the data should be ingested. Optionally the table - information can be added to each message. - :type table_name: str - :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the - mapping information can be added to each message. - :type mapping_rule_name: str - :param data_format: The data format of the message. Optionally the data format can be added to - each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", - "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", - "W3CLOGFILE". - :type data_format: str or ~azure.mgmt.synapse.models.IotHubDataFormat - :param event_system_properties: System properties of the iot hub. - :type event_system_properties: list[str] - :param shared_access_policy_name: The name of the share access policy. - :type shared_access_policy_name: str - :ivar provisioning_state: The provisioned state of the resource. Possible values include: - "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'iot_hub_resource_id': {'key': 'properties.iotHubResourceId', 'type': 'str'}, - 'consumer_group': {'key': 'properties.consumerGroup', 'type': 'str'}, - 'table_name': {'key': 'properties.tableName', 'type': 'str'}, - 'mapping_rule_name': {'key': 'properties.mappingRuleName', 'type': 'str'}, - 'data_format': {'key': 'properties.dataFormat', 'type': 'str'}, - 'event_system_properties': {'key': 'properties.eventSystemProperties', 'type': '[str]'}, - 'shared_access_policy_name': {'key': 'properties.sharedAccessPolicyName', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IotHubDataConnection, self).__init__(**kwargs) - self.kind = 'IotHub' # type: str - self.iot_hub_resource_id = kwargs.get('iot_hub_resource_id', None) - self.consumer_group = kwargs.get('consumer_group', None) - self.table_name = kwargs.get('table_name', None) - self.mapping_rule_name = kwargs.get('mapping_rule_name', None) - self.data_format = kwargs.get('data_format', None) - self.event_system_properties = kwargs.get('event_system_properties', None) - self.shared_access_policy_name = kwargs.get('shared_access_policy_name', None) - self.provisioning_state = None - - -class IpFirewallRuleInfo(ProxyResource): - """IP firewall rule. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param end_ip_address: The end IP address of the firewall rule. Must be IPv4 format. Must be - greater than or equal to startIpAddress. - :type end_ip_address: str - :ivar provisioning_state: Resource provisioning state. Possible values include: "Provisioning", - "Succeeded", "Deleting", "Failed", "DeleteError". - :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ProvisioningState - :param start_ip_address: The start IP address of the firewall rule. Must be IPv4 format. - :type start_ip_address: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'end_ip_address': {'key': 'properties.endIpAddress', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'start_ip_address': {'key': 'properties.startIpAddress', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IpFirewallRuleInfo, self).__init__(**kwargs) - self.end_ip_address = kwargs.get('end_ip_address', None) - self.provisioning_state = None - self.start_ip_address = kwargs.get('start_ip_address', None) - - -class IpFirewallRuleInfoListResult(msrest.serialization.Model): - """List of IP firewall rules. - - :param next_link: Link to next page of results. - :type next_link: str - :param value: List of IP firewall rules. - :type value: list[~azure.mgmt.synapse.models.IpFirewallRuleInfo] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[IpFirewallRuleInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(IpFirewallRuleInfoListResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) - - -class IpFirewallRuleProperties(msrest.serialization.Model): - """IP firewall rule properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param end_ip_address: The end IP address of the firewall rule. Must be IPv4 format. Must be - greater than or equal to startIpAddress. - :type end_ip_address: str - :ivar provisioning_state: Resource provisioning state. Possible values include: "Provisioning", - "Succeeded", "Deleting", "Failed", "DeleteError". - :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ProvisioningState - :param start_ip_address: The start IP address of the firewall rule. Must be IPv4 format. - :type start_ip_address: str - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'end_ip_address': {'key': 'endIpAddress', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'start_ip_address': {'key': 'startIpAddress', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IpFirewallRuleProperties, self).__init__(**kwargs) - self.end_ip_address = kwargs.get('end_ip_address', None) - self.provisioning_state = None - self.start_ip_address = kwargs.get('start_ip_address', None) - - -class KekIdentityProperties(msrest.serialization.Model): - """Key encryption key properties. - - :param user_assigned_identity: User assigned identity resource Id. - :type user_assigned_identity: str - :param use_system_assigned_identity: Boolean specifying whether to use system assigned identity - or not. - :type use_system_assigned_identity: any - """ - - _attribute_map = { - 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, - 'use_system_assigned_identity': {'key': 'useSystemAssignedIdentity', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(KekIdentityProperties, self).__init__(**kwargs) - self.user_assigned_identity = kwargs.get('user_assigned_identity', None) - self.use_system_assigned_identity = kwargs.get('use_system_assigned_identity', None) - - -class Key(ProxyResource): - """A workspace key. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param is_active_cmk: Used to activate the workspace after a customer managed key is provided. - :type is_active_cmk: bool - :param key_vault_url: The Key Vault Url of the workspace key. - :type key_vault_url: 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'}, - 'is_active_cmk': {'key': 'properties.isActiveCMK', 'type': 'bool'}, - 'key_vault_url': {'key': 'properties.keyVaultUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Key, self).__init__(**kwargs) - self.is_active_cmk = kwargs.get('is_active_cmk', None) - self.key_vault_url = kwargs.get('key_vault_url', None) - - -class KeyInfoListResult(msrest.serialization.Model): - """List of keys. - - :param next_link: Link to the next page of results. - :type next_link: str - :param value: List of keys. - :type value: list[~azure.mgmt.synapse.models.Key] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[Key]'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyInfoListResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) - - -class KustoPool(TrackedResource): - """Class representing a Kusto kusto pool. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param sku: Required. The SKU of the kusto pool. - :type sku: ~azure.mgmt.synapse.models.AzureSku - :ivar etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.synapse.models.SystemData - :ivar state: The state of the resource. Possible values include: "Creating", "Unavailable", - "Running", "Deleting", "Deleted", "Stopping", "Stopped", "Starting", "Updating". - :vartype state: str or ~azure.mgmt.synapse.models.State - :ivar provisioning_state: The provisioned state of the resource. Possible values include: - "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState - :ivar uri: The Kusto Pool URI. - :vartype uri: str - :ivar data_ingestion_uri: The Kusto Pool data ingestion URI. - :vartype data_ingestion_uri: str - :ivar state_reason: The reason for the Kusto Pool's current state. - :vartype state_reason: str - :param optimized_autoscale: Optimized auto scale definition. - :type optimized_autoscale: ~azure.mgmt.synapse.models.OptimizedAutoscale - :param enable_streaming_ingest: A boolean value that indicates if the streaming ingest is - enabled. - :type enable_streaming_ingest: bool - :param enable_purge: A boolean value that indicates if the purge operations are enabled. - :type enable_purge: bool - :ivar language_extensions: List of the Kusto Pool's language extensions. - :vartype language_extensions: ~azure.mgmt.synapse.models.LanguageExtensionsList - :param workspace_uid: The workspace unique identifier. - :type workspace_uid: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'required': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - 'state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'uri': {'readonly': True}, - 'data_ingestion_uri': {'readonly': True}, - 'state_reason': {'readonly': True}, - 'language_extensions': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'AzureSku'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'uri': {'key': 'properties.uri', 'type': 'str'}, - 'data_ingestion_uri': {'key': 'properties.dataIngestionUri', 'type': 'str'}, - 'state_reason': {'key': 'properties.stateReason', 'type': 'str'}, - 'optimized_autoscale': {'key': 'properties.optimizedAutoscale', 'type': 'OptimizedAutoscale'}, - 'enable_streaming_ingest': {'key': 'properties.enableStreamingIngest', 'type': 'bool'}, - 'enable_purge': {'key': 'properties.enablePurge', 'type': 'bool'}, - 'language_extensions': {'key': 'properties.languageExtensions', 'type': 'LanguageExtensionsList'}, - 'workspace_uid': {'key': 'properties.workspaceUID', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KustoPool, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.etag = None - self.system_data = None - self.state = None - self.provisioning_state = None - self.uri = None - self.data_ingestion_uri = None - self.state_reason = None - self.optimized_autoscale = kwargs.get('optimized_autoscale', None) - self.enable_streaming_ingest = kwargs.get('enable_streaming_ingest', False) - self.enable_purge = kwargs.get('enable_purge', False) - self.language_extensions = None - self.workspace_uid = kwargs.get('workspace_uid', None) - - -class KustoPoolCheckNameRequest(msrest.serialization.Model): - """The object sent for a kusto pool check name availability request. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Kusto Pool name. - :type name: str - :ivar type: The type of resource, Microsoft.Synapse/workspaces/kustoPools. Has constant value: - "Microsoft.Synapse/workspaces/kustoPools". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Synapse/workspaces/kustoPools" - - def __init__( - self, - **kwargs - ): - super(KustoPoolCheckNameRequest, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class KustoPoolListResult(msrest.serialization.Model): - """The list Kusto pools operation response. - - :param value: The list of Kusto pools. - :type value: list[~azure.mgmt.synapse.models.KustoPool] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[KustoPool]'}, - } - - def __init__( - self, - **kwargs - ): - super(KustoPoolListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class KustoPoolUpdate(Resource): - """Class representing an update to a Kusto kusto pool. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The SKU of the kusto pool. - :type sku: ~azure.mgmt.synapse.models.AzureSku - :ivar state: The state of the resource. Possible values include: "Creating", "Unavailable", - "Running", "Deleting", "Deleted", "Stopping", "Stopped", "Starting", "Updating". - :vartype state: str or ~azure.mgmt.synapse.models.State - :ivar provisioning_state: The provisioned state of the resource. Possible values include: - "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState - :ivar uri: The Kusto Pool URI. - :vartype uri: str - :ivar data_ingestion_uri: The Kusto Pool data ingestion URI. - :vartype data_ingestion_uri: str - :ivar state_reason: The reason for the Kusto Pool's current state. - :vartype state_reason: str - :param optimized_autoscale: Optimized auto scale definition. - :type optimized_autoscale: ~azure.mgmt.synapse.models.OptimizedAutoscale - :param enable_streaming_ingest: A boolean value that indicates if the streaming ingest is - enabled. - :type enable_streaming_ingest: bool - :param enable_purge: A boolean value that indicates if the purge operations are enabled. - :type enable_purge: bool - :ivar language_extensions: List of the Kusto Pool's language extensions. - :vartype language_extensions: ~azure.mgmt.synapse.models.LanguageExtensionsList - :param workspace_uid: The workspace unique identifier. - :type workspace_uid: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'uri': {'readonly': True}, - 'data_ingestion_uri': {'readonly': True}, - 'state_reason': {'readonly': True}, - 'language_extensions': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'sku': {'key': 'sku', 'type': 'AzureSku'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'uri': {'key': 'properties.uri', 'type': 'str'}, - 'data_ingestion_uri': {'key': 'properties.dataIngestionUri', 'type': 'str'}, - 'state_reason': {'key': 'properties.stateReason', 'type': 'str'}, - 'optimized_autoscale': {'key': 'properties.optimizedAutoscale', 'type': 'OptimizedAutoscale'}, - 'enable_streaming_ingest': {'key': 'properties.enableStreamingIngest', 'type': 'bool'}, - 'enable_purge': {'key': 'properties.enablePurge', 'type': 'bool'}, - 'language_extensions': {'key': 'properties.languageExtensions', 'type': 'LanguageExtensionsList'}, - 'workspace_uid': {'key': 'properties.workspaceUID', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KustoPoolUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.sku = kwargs.get('sku', None) - self.state = None - self.provisioning_state = None - self.uri = None - self.data_ingestion_uri = None - self.state_reason = None - self.optimized_autoscale = kwargs.get('optimized_autoscale', None) - self.enable_streaming_ingest = kwargs.get('enable_streaming_ingest', False) - self.enable_purge = kwargs.get('enable_purge', False) - self.language_extensions = None - self.workspace_uid = kwargs.get('workspace_uid', None) - - -class LanguageExtension(msrest.serialization.Model): - """The language extension object. - - :param language_extension_name: The language extension name. Possible values include: "PYTHON", - "R". - :type language_extension_name: str or ~azure.mgmt.synapse.models.LanguageExtensionName - """ - - _attribute_map = { - 'language_extension_name': {'key': 'languageExtensionName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LanguageExtension, self).__init__(**kwargs) - self.language_extension_name = kwargs.get('language_extension_name', None) - - -class LanguageExtensionsList(msrest.serialization.Model): - """The list of language extension objects. - - :param value: The list of language extensions. - :type value: list[~azure.mgmt.synapse.models.LanguageExtension] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[LanguageExtension]'}, - } - - def __init__( - self, - **kwargs - ): - super(LanguageExtensionsList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class LibraryInfo(msrest.serialization.Model): - """Library/package information of a Big Data pool powered by Apache Spark. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: Name of the library. - :type name: str - :param path: Storage blob path of library. - :type path: str - :param container_name: Storage blob container name. - :type container_name: str - :param uploaded_timestamp: The last update time of the library. - :type uploaded_timestamp: ~datetime.datetime - :param type: Type of the library. - :type type: str - :ivar provisioning_status: Provisioning status of the library/package. - :vartype provisioning_status: str - :ivar creator_id: Creator Id of the library/package. - :vartype creator_id: str - """ - - _validation = { - 'provisioning_status': {'readonly': True}, - 'creator_id': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'path': {'key': 'path', 'type': 'str'}, - 'container_name': {'key': 'containerName', 'type': 'str'}, - 'uploaded_timestamp': {'key': 'uploadedTimestamp', 'type': 'iso-8601'}, - 'type': {'key': 'type', 'type': 'str'}, - 'provisioning_status': {'key': 'provisioningStatus', 'type': 'str'}, - 'creator_id': {'key': 'creatorId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LibraryInfo, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.path = kwargs.get('path', None) - self.container_name = kwargs.get('container_name', None) - self.uploaded_timestamp = kwargs.get('uploaded_timestamp', None) - self.type = kwargs.get('type', None) - self.provisioning_status = None - self.creator_id = None - - -class LibraryListResponse(msrest.serialization.Model): - """A list of Library resources. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. List of Library. - :type value: list[~azure.mgmt.synapse.models.LibraryResource] - :param next_link: The link to the next page of results, if any remaining results exist. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[LibraryResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LibraryListResponse, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class LibraryRequirements(msrest.serialization.Model): - """Library requirements for a Big Data pool powered by Apache Spark. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar time: The last update time of the library requirements file. - :vartype time: ~datetime.datetime - :param content: The library requirements. - :type content: str - :param filename: The filename of the library requirements file. - :type filename: str - """ - - _validation = { - 'time': {'readonly': True}, - } - - _attribute_map = { - 'time': {'key': 'time', 'type': 'iso-8601'}, - 'content': {'key': 'content', 'type': 'str'}, - 'filename': {'key': 'filename', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LibraryRequirements, self).__init__(**kwargs) - self.time = None - self.content = kwargs.get('content', None) - self.filename = kwargs.get('filename', None) - - -class LibraryResource(SubResource): - """Library response details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param name_properties_name: Name of the library. - :type name_properties_name: str - :param path: Storage blob path of library. - :type path: str - :param container_name: Storage blob container name. - :type container_name: str - :param uploaded_timestamp: The last update time of the library. - :type uploaded_timestamp: ~datetime.datetime - :param type_properties_type: Type of the library. - :type type_properties_type: str - :ivar provisioning_status: Provisioning status of the library/package. - :vartype provisioning_status: str - :ivar creator_id: Creator Id of the library/package. - :vartype creator_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'provisioning_status': {'readonly': True}, - 'creator_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, - 'path': {'key': 'properties.path', 'type': 'str'}, - 'container_name': {'key': 'properties.containerName', 'type': 'str'}, - 'uploaded_timestamp': {'key': 'properties.uploadedTimestamp', 'type': 'iso-8601'}, - 'type_properties_type': {'key': 'properties.type', 'type': 'str'}, - 'provisioning_status': {'key': 'properties.provisioningStatus', 'type': 'str'}, - 'creator_id': {'key': 'properties.creatorId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LibraryResource, self).__init__(**kwargs) - self.name_properties_name = kwargs.get('name_properties_name', None) - self.path = kwargs.get('path', None) - self.container_name = kwargs.get('container_name', None) - self.uploaded_timestamp = kwargs.get('uploaded_timestamp', None) - self.type_properties_type = kwargs.get('type_properties_type', None) - self.provisioning_status = None - self.creator_id = None - - -class LinkedIntegrationRuntime(msrest.serialization.Model): - """The linked integration runtime information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the linked integration runtime. - :vartype name: str - :ivar subscription_id: The subscription ID for which the linked integration runtime belong to. - :vartype subscription_id: str - :ivar data_factory_name: The name of the workspace for which the linked integration runtime - belong to. - :vartype data_factory_name: str - :ivar data_factory_location: The location of the workspace for which the linked integration - runtime belong to. - :vartype data_factory_location: str - :ivar create_time: The creating time of the linked integration runtime. - :vartype create_time: ~datetime.datetime - """ - - _validation = { - 'name': {'readonly': True}, - 'subscription_id': {'readonly': True}, - 'data_factory_name': {'readonly': True}, - 'data_factory_location': {'readonly': True}, - 'create_time': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, - 'data_factory_name': {'key': 'dataFactoryName', 'type': 'str'}, - 'data_factory_location': {'key': 'dataFactoryLocation', 'type': 'str'}, - 'create_time': {'key': 'createTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(LinkedIntegrationRuntime, self).__init__(**kwargs) - self.name = None - self.subscription_id = None - self.data_factory_name = None - self.data_factory_location = None - self.create_time = None - - -class LinkedIntegrationRuntimeType(msrest.serialization.Model): - """The base definition of a linked integration runtime. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: LinkedIntegrationRuntimeKeyAuthorization, LinkedIntegrationRuntimeRbacAuthorization. - - All required parameters must be populated in order to send to Azure. - - :param authorization_type: Required. The authorization type for integration runtime - sharing.Constant filled by server. - :type authorization_type: str - """ - - _validation = { - 'authorization_type': {'required': True}, - } - - _attribute_map = { - 'authorization_type': {'key': 'authorizationType', 'type': 'str'}, - } - - _subtype_map = { - 'authorization_type': {'Key': 'LinkedIntegrationRuntimeKeyAuthorization', 'RBAC': 'LinkedIntegrationRuntimeRbacAuthorization'} - } - - def __init__( - self, - **kwargs - ): - super(LinkedIntegrationRuntimeType, self).__init__(**kwargs) - self.authorization_type = None # type: Optional[str] - - -class LinkedIntegrationRuntimeKeyAuthorization(LinkedIntegrationRuntimeType): - """The key authorization type integration runtime. - - All required parameters must be populated in order to send to Azure. - - :param authorization_type: Required. The authorization type for integration runtime - sharing.Constant filled by server. - :type authorization_type: str - :param key: Required. The key used for authorization. - :type key: ~azure.mgmt.synapse.models.SecureString - """ - - _validation = { - 'authorization_type': {'required': True}, - 'key': {'required': True}, - } - - _attribute_map = { - 'authorization_type': {'key': 'authorizationType', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'SecureString'}, - } - - def __init__( - self, - **kwargs - ): - super(LinkedIntegrationRuntimeKeyAuthorization, self).__init__(**kwargs) - self.authorization_type = 'Key' # type: str - self.key = kwargs['key'] - - -class LinkedIntegrationRuntimeRbacAuthorization(LinkedIntegrationRuntimeType): - """The role based access control (RBAC) authorization type integration runtime. - - All required parameters must be populated in order to send to Azure. - - :param authorization_type: Required. The authorization type for integration runtime - sharing.Constant filled by server. - :type authorization_type: str - :param resource_id: Required. The resource identifier of the integration runtime to be shared. - :type resource_id: str - """ - - _validation = { - 'authorization_type': {'required': True}, - 'resource_id': {'required': True}, - } - - _attribute_map = { - 'authorization_type': {'key': 'authorizationType', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LinkedIntegrationRuntimeRbacAuthorization, self).__init__(**kwargs) - self.authorization_type = 'RBAC' # type: str - self.resource_id = kwargs['resource_id'] - - -class ListResourceSkusResult(msrest.serialization.Model): - """List of available SKUs for a Kusto Pool. - - :param value: The collection of available SKUs for an existing resource. - :type value: list[~azure.mgmt.synapse.models.AzureResourceSku] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AzureResourceSku]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListResourceSkusResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class ListSqlPoolSecurityAlertPolicies(msrest.serialization.Model): - """A list of SQL pool security alert policies. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.synapse.models.SqlPoolSecurityAlertPolicy] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SqlPoolSecurityAlertPolicy]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ListSqlPoolSecurityAlertPolicies, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class MaintenanceWindowOptions(ProxyResource): - """Maintenance window options. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param is_enabled: Whether maintenance windows are enabled for the database. - :type is_enabled: bool - :param maintenance_window_cycles: Available maintenance cycles e.g. {Saturday, 0, 48\ *60}, - {Wednesday, 0, 24*\ 60}. - :type maintenance_window_cycles: list[~azure.mgmt.synapse.models.MaintenanceWindowTimeRange] - :param min_duration_in_minutes: Minimum duration of maintenance window. - :type min_duration_in_minutes: int - :param default_duration_in_minutes: Default duration for maintenance window. - :type default_duration_in_minutes: int - :param min_cycles: Minimum number of maintenance windows cycles to be set on the database. - :type min_cycles: int - :param time_granularity_in_minutes: Time granularity in minutes for maintenance windows. - :type time_granularity_in_minutes: int - :param allow_multiple_maintenance_windows_per_cycle: Whether we allow multiple maintenance - windows per cycle. - :type allow_multiple_maintenance_windows_per_cycle: bool - """ - - _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'}, - 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, - 'maintenance_window_cycles': {'key': 'properties.maintenanceWindowCycles', 'type': '[MaintenanceWindowTimeRange]'}, - 'min_duration_in_minutes': {'key': 'properties.minDurationInMinutes', 'type': 'int'}, - 'default_duration_in_minutes': {'key': 'properties.defaultDurationInMinutes', 'type': 'int'}, - 'min_cycles': {'key': 'properties.minCycles', 'type': 'int'}, - 'time_granularity_in_minutes': {'key': 'properties.timeGranularityInMinutes', 'type': 'int'}, - 'allow_multiple_maintenance_windows_per_cycle': {'key': 'properties.allowMultipleMaintenanceWindowsPerCycle', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(MaintenanceWindowOptions, self).__init__(**kwargs) - self.is_enabled = kwargs.get('is_enabled', None) - self.maintenance_window_cycles = kwargs.get('maintenance_window_cycles', None) - self.min_duration_in_minutes = kwargs.get('min_duration_in_minutes', None) - self.default_duration_in_minutes = kwargs.get('default_duration_in_minutes', None) - self.min_cycles = kwargs.get('min_cycles', None) - self.time_granularity_in_minutes = kwargs.get('time_granularity_in_minutes', None) - self.allow_multiple_maintenance_windows_per_cycle = kwargs.get('allow_multiple_maintenance_windows_per_cycle', None) - - -class MaintenanceWindows(ProxyResource): - """Maintenance windows. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param time_ranges: - :type time_ranges: list[~azure.mgmt.synapse.models.MaintenanceWindowTimeRange] - """ - - _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'}, - 'time_ranges': {'key': 'properties.timeRanges', 'type': '[MaintenanceWindowTimeRange]'}, - } - - def __init__( - self, - **kwargs - ): - super(MaintenanceWindows, self).__init__(**kwargs) - self.time_ranges = kwargs.get('time_ranges', None) - - -class MaintenanceWindowTimeRange(msrest.serialization.Model): - """Maintenance window time range. - - :param day_of_week: Day of maintenance window. Possible values include: "Sunday", "Monday", - "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday". - :type day_of_week: str or ~azure.mgmt.synapse.models.DayOfWeek - :param start_time: Start time minutes offset from 12am. - :type start_time: str - :param duration: Duration of maintenance window in minutes. - :type duration: str - """ - - _attribute_map = { - 'day_of_week': {'key': 'dayOfWeek', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'str'}, - 'duration': {'key': 'duration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MaintenanceWindowTimeRange, self).__init__(**kwargs) - self.day_of_week = kwargs.get('day_of_week', None) - self.start_time = kwargs.get('start_time', None) - self.duration = kwargs.get('duration', None) - - -class ManagedIdentity(msrest.serialization.Model): - """The workspace managed identity. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of the workspace managed identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the workspace managed identity. - :vartype tenant_id: str - :param type: The type of managed identity for the workspace. Possible values include: "None", - "SystemAssigned", "SystemAssigned,UserAssigned". - :type type: str or ~azure.mgmt.synapse.models.ResourceIdentityType - :param user_assigned_identities: The user assigned managed identities. - :type user_assigned_identities: dict[str, - ~azure.mgmt.synapse.models.UserAssignedManagedIdentity] - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedManagedIdentity}'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) - - -class ManagedIdentitySqlControlSettingsModel(ProxyResource): - """Sql Control Settings for workspace managed identity. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param grant_sql_control_to_managed_identity: Grant sql control to managed identity. - :type grant_sql_control_to_managed_identity: - ~azure.mgmt.synapse.models.ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity - """ - - _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'}, - 'grant_sql_control_to_managed_identity': {'key': 'properties.grantSqlControlToManagedIdentity', 'type': 'ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedIdentitySqlControlSettingsModel, self).__init__(**kwargs) - self.grant_sql_control_to_managed_identity = kwargs.get('grant_sql_control_to_managed_identity', None) - - -class ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity(msrest.serialization.Model): - """Grant sql control to managed identity. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param desired_state: Desired state. Possible values include: "Enabled", "Disabled". - :type desired_state: str or - ~azure.mgmt.synapse.models.ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentityDesiredState - :ivar actual_state: Actual state. Possible values include: "Enabling", "Enabled", "Disabling", - "Disabled", "Unknown". - :vartype actual_state: str or - ~azure.mgmt.synapse.models.ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentityActualState - """ - - _validation = { - 'actual_state': {'readonly': True}, - } - - _attribute_map = { - 'desired_state': {'key': 'desiredState', 'type': 'str'}, - 'actual_state': {'key': 'actualState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity, self).__init__(**kwargs) - self.desired_state = kwargs.get('desired_state', None) - self.actual_state = None - - -class ManagedIntegrationRuntime(IntegrationRuntime): - """Managed integration runtime, including managed elastic and managed dedicated integration runtimes. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, any] - :param type: Required. Type of integration runtime.Constant filled by server. Possible values - include: "Managed", "SelfHosted". - :type type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeType - :param description: Integration runtime description. - :type description: str - :ivar state: Integration runtime state, only valid for managed dedicated integration runtime. - Possible values include: "Initial", "Stopped", "Started", "Starting", "Stopping", - "NeedRegistration", "Online", "Limited", "Offline", "AccessDenied". - :vartype state: str or ~azure.mgmt.synapse.models.IntegrationRuntimeState - :param compute_properties: The compute resource for managed integration runtime. - :type compute_properties: ~azure.mgmt.synapse.models.IntegrationRuntimeComputeProperties - :param ssis_properties: SSIS properties for managed integration runtime. - :type ssis_properties: ~azure.mgmt.synapse.models.IntegrationRuntimeSsisProperties - """ - - _validation = { - 'type': {'required': True}, - 'state': {'readonly': True}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'type': {'key': 'type', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'compute_properties': {'key': 'typeProperties.computeProperties', 'type': 'IntegrationRuntimeComputeProperties'}, - 'ssis_properties': {'key': 'typeProperties.ssisProperties', 'type': 'IntegrationRuntimeSsisProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedIntegrationRuntime, self).__init__(**kwargs) - self.type = 'Managed' # type: str - self.state = None - self.compute_properties = kwargs.get('compute_properties', None) - self.ssis_properties = kwargs.get('ssis_properties', None) - - -class ManagedIntegrationRuntimeError(msrest.serialization.Model): - """Error definition for managed integration runtime. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, any] - :ivar time: The time when the error occurred. - :vartype time: ~datetime.datetime - :ivar code: Error code. - :vartype code: str - :ivar parameters: Managed integration runtime error parameters. - :vartype parameters: list[str] - :ivar message: Error message. - :vartype message: str - """ - - _validation = { - 'time': {'readonly': True}, - 'code': {'readonly': True}, - 'parameters': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'time': {'key': 'time', 'type': 'iso-8601'}, - 'code': {'key': 'code', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': '[str]'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedIntegrationRuntimeError, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.time = None - self.code = None - self.parameters = None - self.message = None - - -class ManagedIntegrationRuntimeNode(msrest.serialization.Model): - """Properties of integration runtime node. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, any] - :ivar node_id: The managed integration runtime node id. - :vartype node_id: str - :ivar status: The managed integration runtime node status. Possible values include: "Starting", - "Available", "Recycling", "Unavailable". - :vartype status: str or ~azure.mgmt.synapse.models.ManagedIntegrationRuntimeNodeStatus - :param errors: The errors that occurred on this integration runtime node. - :type errors: list[~azure.mgmt.synapse.models.ManagedIntegrationRuntimeError] - """ - - _validation = { - 'node_id': {'readonly': True}, - 'status': {'readonly': True}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'node_id': {'key': 'nodeId', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'errors': {'key': 'errors', 'type': '[ManagedIntegrationRuntimeError]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedIntegrationRuntimeNode, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.node_id = None - self.status = None - self.errors = kwargs.get('errors', None) - - -class ManagedIntegrationRuntimeOperationResult(msrest.serialization.Model): - """Properties of managed integration runtime operation result. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, any] - :ivar type: The operation type. Could be start or stop. - :vartype type: str - :ivar start_time: The start time of the operation. - :vartype start_time: ~datetime.datetime - :ivar result: The operation result. - :vartype result: str - :ivar error_code: The error code. - :vartype error_code: str - :ivar parameters: Managed integration runtime error parameters. - :vartype parameters: list[str] - :ivar activity_id: The activity id for the operation request. - :vartype activity_id: str - """ - - _validation = { - 'type': {'readonly': True}, - 'start_time': {'readonly': True}, - 'result': {'readonly': True}, - 'error_code': {'readonly': True}, - 'parameters': {'readonly': True}, - 'activity_id': {'readonly': True}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'type': {'key': 'type', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'result': {'key': 'result', 'type': 'str'}, - 'error_code': {'key': 'errorCode', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': '[str]'}, - 'activity_id': {'key': 'activityId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedIntegrationRuntimeOperationResult, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.type = None - self.start_time = None - self.result = None - self.error_code = None - self.parameters = None - self.activity_id = None - - -class ManagedIntegrationRuntimeStatus(IntegrationRuntimeStatus): - """Managed integration runtime status. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, any] - :param type: Required. Type of integration runtime.Constant filled by server. Possible values - include: "Managed", "SelfHosted". - :type type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeType - :ivar data_factory_name: The workspace name which the integration runtime belong to. - :vartype data_factory_name: str - :ivar state: The state of integration runtime. Possible values include: "Initial", "Stopped", - "Started", "Starting", "Stopping", "NeedRegistration", "Online", "Limited", "Offline", - "AccessDenied". - :vartype state: str or ~azure.mgmt.synapse.models.IntegrationRuntimeState - :ivar create_time: The time at which the integration runtime was created, in ISO8601 format. - :vartype create_time: ~datetime.datetime - :ivar nodes: The list of nodes for managed integration runtime. - :vartype nodes: list[~azure.mgmt.synapse.models.ManagedIntegrationRuntimeNode] - :ivar other_errors: The errors that occurred on this integration runtime. - :vartype other_errors: list[~azure.mgmt.synapse.models.ManagedIntegrationRuntimeError] - :ivar last_operation: The last operation result that occurred on this integration runtime. - :vartype last_operation: ~azure.mgmt.synapse.models.ManagedIntegrationRuntimeOperationResult - """ - - _validation = { - 'type': {'required': True}, - 'data_factory_name': {'readonly': True}, - 'state': {'readonly': True}, - 'create_time': {'readonly': True}, - 'nodes': {'readonly': True}, - 'other_errors': {'readonly': True}, - 'last_operation': {'readonly': True}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'type': {'key': 'type', 'type': 'str'}, - 'data_factory_name': {'key': 'dataFactoryName', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'create_time': {'key': 'typeProperties.createTime', 'type': 'iso-8601'}, - 'nodes': {'key': 'typeProperties.nodes', 'type': '[ManagedIntegrationRuntimeNode]'}, - 'other_errors': {'key': 'typeProperties.otherErrors', 'type': '[ManagedIntegrationRuntimeError]'}, - 'last_operation': {'key': 'typeProperties.lastOperation', 'type': 'ManagedIntegrationRuntimeOperationResult'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedIntegrationRuntimeStatus, self).__init__(**kwargs) - self.type = 'Managed' # type: str - self.create_time = None - self.nodes = None - self.other_errors = None - self.last_operation = None - - -class ManagedVirtualNetworkSettings(msrest.serialization.Model): - """Managed Virtual Network Settings. - - :param prevent_data_exfiltration: Prevent Data Exfiltration. - :type prevent_data_exfiltration: bool - :param linked_access_check_on_target_resource: Linked Access Check On Target Resource. - :type linked_access_check_on_target_resource: bool - :param allowed_aad_tenant_ids_for_linking: Allowed Aad Tenant Ids For Linking. - :type allowed_aad_tenant_ids_for_linking: list[str] - """ - - _attribute_map = { - 'prevent_data_exfiltration': {'key': 'preventDataExfiltration', 'type': 'bool'}, - 'linked_access_check_on_target_resource': {'key': 'linkedAccessCheckOnTargetResource', 'type': 'bool'}, - 'allowed_aad_tenant_ids_for_linking': {'key': 'allowedAadTenantIdsForLinking', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedVirtualNetworkSettings, self).__init__(**kwargs) - self.prevent_data_exfiltration = kwargs.get('prevent_data_exfiltration', None) - self.linked_access_check_on_target_resource = kwargs.get('linked_access_check_on_target_resource', None) - self.allowed_aad_tenant_ids_for_linking = kwargs.get('allowed_aad_tenant_ids_for_linking', None) - - -class MetadataSyncConfig(ProxyResource): - """Configuration for metadata sync. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param enabled: Indicates whether the metadata sync is enabled or disabled. - :type enabled: bool - :param sync_interval_in_minutes: The Sync Interval in minutes. - :type sync_interval_in_minutes: int - """ - - _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'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, - 'sync_interval_in_minutes': {'key': 'properties.syncIntervalInMinutes', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(MetadataSyncConfig, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.sync_interval_in_minutes = kwargs.get('sync_interval_in_minutes', None) - - -class Operation(msrest.serialization.Model): - """A REST API operation. - - :param name: This is of the format {provider}/{resource}/{operation}. - :type name: str - :param display: The object that describes the operation. - :type display: ~azure.mgmt.synapse.models.OperationDisplay - :param origin: The intended executor of the operation. - :type origin: str - :param properties: Any object. - :type properties: any - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.properties = kwargs.get('properties', None) - - -class OperationDisplay(msrest.serialization.Model): - """The object that describes the operation. - - :param provider: Friendly name of the resource provider. - :type provider: str - :param operation: For example: read, write, delete. - :type operation: str - :param resource: The resource type on which the operation is performed. - :type resource: str - :param description: The friendly name of the operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.operation = kwargs.get('operation', None) - self.resource = kwargs.get('resource', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: The list of operations supported by the resource provider. - :type value: list[~azure.mgmt.synapse.models.Operation] - :ivar next_link: The URL to get the next set of operation list results if there are any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class OperationMetaLogSpecification(msrest.serialization.Model): - """What is this?. - - :param display_name: Log display name. - :type display_name: str - :param blob_duration: Time range the log covers. - :type blob_duration: str - :param name: Log unique name. - :type name: str - """ - - _attribute_map = { - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationMetaLogSpecification, self).__init__(**kwargs) - self.display_name = kwargs.get('display_name', None) - self.blob_duration = kwargs.get('blob_duration', None) - self.name = kwargs.get('name', None) - - -class OperationMetaMetricDimensionSpecification(msrest.serialization.Model): - """What is this?. - - :param display_name: Dimension display name. - :type display_name: str - :param name: Dimension unique name. - :type name: str - :param to_be_exported_for_shoebox: Whether this metric should be exported for Shoebox. - :type to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationMetaMetricDimensionSpecification, self).__init__(**kwargs) - self.display_name = kwargs.get('display_name', None) - self.name = kwargs.get('name', None) - self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) - - -class OperationMetaMetricSpecification(msrest.serialization.Model): - """What is this?. - - :param source_mdm_namespace: The source MDM namespace. - :type source_mdm_namespace: str - :param display_name: Metric display name. - :type display_name: str - :param name: Metric unique name. - :type name: str - :param aggregation_type: Metric aggregation type. - :type aggregation_type: str - :param display_description: Metric description. - :type display_description: str - :param source_mdm_account: The source MDM account. - :type source_mdm_account: str - :param enable_regional_mdm_account: Whether the regional MDM account is enabled. - :type enable_regional_mdm_account: bool - :param unit: Metric units. - :type unit: str - :param dimensions: Metric dimensions. - :type dimensions: list[~azure.mgmt.synapse.models.OperationMetaMetricDimensionSpecification] - :param supports_instance_level_aggregation: Whether the metric supports instance-level - aggregation. - :type supports_instance_level_aggregation: bool - :param metric_filter_pattern: Metric filter. - :type metric_filter_pattern: str - """ - - _attribute_map = { - 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'source_mdm_account': {'key': 'sourceMdmAccount', 'type': 'str'}, - 'enable_regional_mdm_account': {'key': 'enableRegionalMdmAccount', 'type': 'bool'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[OperationMetaMetricDimensionSpecification]'}, - 'supports_instance_level_aggregation': {'key': 'supportsInstanceLevelAggregation', 'type': 'bool'}, - 'metric_filter_pattern': {'key': 'metricFilterPattern', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationMetaMetricSpecification, self).__init__(**kwargs) - self.source_mdm_namespace = kwargs.get('source_mdm_namespace', None) - self.display_name = kwargs.get('display_name', None) - self.name = kwargs.get('name', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.display_description = kwargs.get('display_description', None) - self.source_mdm_account = kwargs.get('source_mdm_account', None) - self.enable_regional_mdm_account = kwargs.get('enable_regional_mdm_account', None) - self.unit = kwargs.get('unit', None) - self.dimensions = kwargs.get('dimensions', None) - self.supports_instance_level_aggregation = kwargs.get('supports_instance_level_aggregation', None) - self.metric_filter_pattern = kwargs.get('metric_filter_pattern', None) - - -class OperationMetaServiceSpecification(msrest.serialization.Model): - """What is this?. - - :param metric_specifications: Service metric specifications. - :type metric_specifications: list[~azure.mgmt.synapse.models.OperationMetaMetricSpecification] - :param log_specifications: Service log specifications. - :type log_specifications: list[~azure.mgmt.synapse.models.OperationMetaLogSpecification] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[OperationMetaMetricSpecification]'}, - 'log_specifications': {'key': 'logSpecifications', 'type': '[OperationMetaLogSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationMetaServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - self.log_specifications = kwargs.get('log_specifications', None) - - -class OperationResource(msrest.serialization.Model): - """An operation. - - :param id: Operation ID. - :type id: str - :param name: Operation name. - :type name: str - :param status: Operation status. Possible values include: "InProgress", "Succeeded", "Failed", - "Canceled". - :type status: str or ~azure.mgmt.synapse.models.OperationStatus - :param properties: Operation properties. - :type properties: any - :param error: Errors from the operation. - :type error: ~azure.mgmt.synapse.models.ErrorDetail - :param start_time: Operation start time. - :type start_time: ~datetime.datetime - :param end_time: Operation start time. - :type end_time: ~datetime.datetime - :param percent_complete: Completion percentage of the operation. - :type percent_complete: float - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'object'}, - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'percent_complete': {'key': 'percentComplete', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationResource, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.status = kwargs.get('status', None) - self.properties = kwargs.get('properties', None) - self.error = kwargs.get('error', None) - self.start_time = kwargs.get('start_time', None) - self.end_time = kwargs.get('end_time', None) - self.percent_complete = kwargs.get('percent_complete', None) - - -class OptimizedAutoscale(msrest.serialization.Model): - """A class that contains the optimized auto scale definition. - - All required parameters must be populated in order to send to Azure. - - :param version: Required. The version of the template defined, for instance 1. - :type version: int - :param is_enabled: Required. A boolean value that indicate if the optimized autoscale feature - is enabled or not. - :type is_enabled: bool - :param minimum: Required. Minimum allowed instances count. - :type minimum: int - :param maximum: Required. Maximum allowed instances count. - :type maximum: int - """ - - _validation = { - 'version': {'required': True}, - 'is_enabled': {'required': True}, - 'minimum': {'required': True}, - 'maximum': {'required': True}, - } - - _attribute_map = { - 'version': {'key': 'version', 'type': 'int'}, - 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, - 'minimum': {'key': 'minimum', 'type': 'int'}, - 'maximum': {'key': 'maximum', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(OptimizedAutoscale, self).__init__(**kwargs) - self.version = kwargs['version'] - self.is_enabled = kwargs['is_enabled'] - self.minimum = kwargs['minimum'] - self.maximum = kwargs['maximum'] - - -class PrivateEndpoint(msrest.serialization.Model): - """Private endpoint details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource id of the private endpoint. - :vartype id: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = None - - -class PrivateEndpointConnection(ProxyResource): - """A private endpoint connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param private_endpoint: The private endpoint which the connection belongs to. - :type private_endpoint: ~azure.mgmt.synapse.models.PrivateEndpoint - :param private_link_service_connection_state: Connection state of the private endpoint - connection. - :type private_link_service_connection_state: - ~azure.mgmt.synapse.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -class PrivateEndpointConnectionForPrivateLinkHubBasicAutoGenerated(msrest.serialization.Model): - """PrivateEndpointConnectionForPrivateLinkHubBasicAutoGenerated. - - :param id: - :type id: str - :param properties: Properties of a private endpoint connection. - :type properties: ~azure.mgmt.synapse.models.PrivateEndpointConnectionProperties - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionForPrivateLinkHubBasicAutoGenerated, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.properties = kwargs.get('properties', None) - - -class PrivateEndpointConnectionForPrivateLinkHub(PrivateEndpointConnectionForPrivateLinkHubBasicAutoGenerated): - """PrivateEndpointConnectionForPrivateLinkHub. - - :param id: - :type id: str - :param properties: Properties of a private endpoint connection. - :type properties: ~azure.mgmt.synapse.models.PrivateEndpointConnectionProperties - :param name: - :type name: str - :param type: - :type type: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionProperties'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionForPrivateLinkHub, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - - -class PrivateEndpointConnectionForPrivateLinkHubBasic(msrest.serialization.Model): - """Private Endpoint Connection For Private Link Hub - Basic. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: identifier. - :vartype id: str - :param private_endpoint: The private endpoint which the connection belongs to. - :type private_endpoint: ~azure.mgmt.synapse.models.PrivateEndpoint - :param private_link_service_connection_state: Connection state of the private endpoint - connection. - :type private_link_service_connection_state: - ~azure.mgmt.synapse.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionForPrivateLinkHubBasic, self).__init__(**kwargs) - self.id = None - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -class PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse(msrest.serialization.Model): - """PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse. - - :param value: - :type value: list[~azure.mgmt.synapse.models.PrivateEndpointConnectionForPrivateLinkHub] - :param next_link: - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnectionForPrivateLinkHub]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PrivateEndpointConnectionList(msrest.serialization.Model): - """A list of private endpoint connections. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.synapse.models.PrivateEndpointConnection] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class PrivateEndpointConnectionProperties(msrest.serialization.Model): - """Properties of a private endpoint connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param private_endpoint: The private endpoint which the connection belongs to. - :type private_endpoint: ~azure.mgmt.synapse.models.PrivateEndpoint - :param private_link_service_connection_state: Connection state of the private endpoint - connection. - :type private_link_service_connection_state: - ~azure.mgmt.synapse.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. - :vartype provisioning_state: str - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'private_endpoint': {'key': 'privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionProperties, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = None - - -class PrivateLinkHub(TrackedResource): - """A privateLinkHub. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param provisioning_state: PrivateLinkHub provisioning state. - :type provisioning_state: str - :ivar private_endpoint_connections: List of private endpoint connections. - :vartype private_endpoint_connections: - list[~azure.mgmt.synapse.models.PrivateEndpointConnectionForPrivateLinkHubBasic] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'private_endpoint_connections': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnectionForPrivateLinkHubBasic]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkHub, self).__init__(**kwargs) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.private_endpoint_connections = None - - -class PrivateLinkHubInfoListResult(msrest.serialization.Model): - """List of privateLinkHubs. - - :param next_link: Link to the next page of results. - :type next_link: str - :param value: List of privateLinkHubs. - :type value: list[~azure.mgmt.synapse.models.PrivateLinkHub] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[PrivateLinkHub]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkHubInfoListResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) - - -class PrivateLinkHubPatchInfo(msrest.serialization.Model): - """PrivateLinkHub patch details. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkHubPatchInfo, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class PrivateLinkResource(ProxyResource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar properties: The private link resource properties. - :vartype properties: ~azure.mgmt.synapse.models.PrivateLinkResourceProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'properties': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'PrivateLinkResourceProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.properties = None - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.synapse.models.PrivateLinkResource] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class PrivateLinkResourceProperties(msrest.serialization.Model): - """Properties of a private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :ivar required_zone_names: Required DNS zone names of the the private link resource. - :vartype required_zone_names: list[str] - """ - - _validation = { - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - 'required_zone_names': {'readonly': True}, - } - - _attribute_map = { - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceProperties, self).__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = None - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """Connection state details of the private endpoint. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param status: The private link service connection status. - :type status: str - :param description: The private link service connection description. - :type description: str - :ivar actions_required: The actions required for private link service connection. - :vartype actions_required: str - """ - - _validation = { - 'actions_required': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.actions_required = None - - -class PurviewConfiguration(msrest.serialization.Model): - """Purview Configuration. - - :param purview_resource_id: Purview Resource ID. - :type purview_resource_id: str - """ - - _attribute_map = { - 'purview_resource_id': {'key': 'purviewResourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PurviewConfiguration, self).__init__(**kwargs) - self.purview_resource_id = kwargs.get('purview_resource_id', None) - - -class QueryInterval(msrest.serialization.Model): - """A database query. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar interval_start_time: The start time of the measurement interval (ISO8601 format). - :vartype interval_start_time: ~datetime.datetime - :ivar execution_count: The number of times the query was executed during this interval. - :vartype execution_count: int - :ivar metrics: The list of query metrics during this interval. - :vartype metrics: list[~azure.mgmt.synapse.models.QueryMetric] - """ - - _validation = { - 'interval_start_time': {'readonly': True}, - 'execution_count': {'readonly': True}, - 'metrics': {'readonly': True}, - } - - _attribute_map = { - 'interval_start_time': {'key': 'intervalStartTime', 'type': 'iso-8601'}, - 'execution_count': {'key': 'executionCount', 'type': 'int'}, - 'metrics': {'key': 'metrics', 'type': '[QueryMetric]'}, - } - - def __init__( - self, - **kwargs - ): - super(QueryInterval, self).__init__(**kwargs) - self.interval_start_time = None - self.execution_count = None - self.metrics = None - - -class QueryMetric(msrest.serialization.Model): - """A database query. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the metric. - :vartype name: str - :ivar display_name: The name of the metric for display in user interface. - :vartype display_name: str - :ivar unit: The unit of measurement. Possible values include: "percentage", "KB", - "microseconds". - :vartype unit: str or ~azure.mgmt.synapse.models.QueryMetricUnit - :ivar value: The measured value. - :vartype value: float - """ - - _validation = { - 'name': {'readonly': True}, - 'display_name': {'readonly': True}, - 'unit': {'readonly': True}, - 'value': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(QueryMetric, self).__init__(**kwargs) - self.name = None - self.display_name = None - self.unit = None - self.value = None - - -class QueryStatistic(msrest.serialization.Model): - """A database query. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar query_id: The id of the query. - :vartype query_id: str - :ivar intervals: The list of query intervals. - :vartype intervals: list[~azure.mgmt.synapse.models.QueryInterval] - """ - - _validation = { - 'query_id': {'readonly': True}, - 'intervals': {'readonly': True}, - } - - _attribute_map = { - 'query_id': {'key': 'queryId', 'type': 'str'}, - 'intervals': {'key': 'intervals', 'type': '[QueryInterval]'}, - } - - def __init__( - self, - **kwargs - ): - super(QueryStatistic, self).__init__(**kwargs) - self.query_id = None - self.intervals = None - - -class ReadWriteDatabase(Database): - """Class representing a read write database. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the database.Constant filled by server. Possible values - include: "ReadWrite", "ReadOnlyFollowing". - :type kind: str or ~azure.mgmt.synapse.models.Kind - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.synapse.models.SystemData - :ivar provisioning_state: The provisioned state of the resource. Possible values include: - "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState - :param soft_delete_period: The time the data should be kept before it stops being accessible to - queries in TimeSpan. - :type soft_delete_period: ~datetime.timedelta - :param hot_cache_period: The time the data should be kept in cache for fast queries in - TimeSpan. - :type hot_cache_period: ~datetime.timedelta - :ivar statistics: The statistics of the database. - :vartype statistics: ~azure.mgmt.synapse.models.DatabaseStatistics - :ivar is_followed: Indicates whether the database is followed. - :vartype is_followed: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'statistics': {'readonly': True}, - 'is_followed': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'soft_delete_period': {'key': 'properties.softDeletePeriod', 'type': 'duration'}, - 'hot_cache_period': {'key': 'properties.hotCachePeriod', 'type': 'duration'}, - 'statistics': {'key': 'properties.statistics', 'type': 'DatabaseStatistics'}, - 'is_followed': {'key': 'properties.isFollowed', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ReadWriteDatabase, self).__init__(**kwargs) - self.kind = 'ReadWrite' # type: str - self.provisioning_state = None - self.soft_delete_period = kwargs.get('soft_delete_period', None) - self.hot_cache_period = kwargs.get('hot_cache_period', None) - self.statistics = None - self.is_followed = None - - -class RecommendedSensitivityLabelUpdate(ProxyResource): - """A recommended sensitivity label update operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param op: Possible values include: "enable", "disable". - :type op: str or ~azure.mgmt.synapse.models.RecommendedSensitivityLabelUpdateKind - :param schema: Schema name of the column to update. - :type schema: str - :param table: Table name of the column to update. - :type table: str - :param column: Column name to update. - :type column: 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'}, - 'op': {'key': 'properties.op', 'type': 'str'}, - 'schema': {'key': 'properties.schema', 'type': 'str'}, - 'table': {'key': 'properties.table', 'type': 'str'}, - 'column': {'key': 'properties.column', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RecommendedSensitivityLabelUpdate, self).__init__(**kwargs) - self.op = kwargs.get('op', None) - self.schema = kwargs.get('schema', None) - self.table = kwargs.get('table', None) - self.column = kwargs.get('column', None) - - -class RecommendedSensitivityLabelUpdateList(msrest.serialization.Model): - """A list of recommended sensitivity label update operations. - - :param operations: - :type operations: list[~azure.mgmt.synapse.models.RecommendedSensitivityLabelUpdate] - """ - - _attribute_map = { - 'operations': {'key': 'operations', 'type': '[RecommendedSensitivityLabelUpdate]'}, - } - - def __init__( - self, - **kwargs - ): - super(RecommendedSensitivityLabelUpdateList, self).__init__(**kwargs) - self.operations = kwargs.get('operations', None) - - -class RecoverableSqlPool(ProxyResource): - """A recoverable sql pool. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar edition: The edition of the database. - :vartype edition: str - :ivar service_level_objective: The service level objective name of the database. - :vartype service_level_objective: str - :ivar elastic_pool_name: The elastic pool name of the database. - :vartype elastic_pool_name: str - :ivar last_available_backup_date: The last available backup date of the database (ISO8601 - format). - :vartype last_available_backup_date: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'edition': {'readonly': True}, - 'service_level_objective': {'readonly': True}, - 'elastic_pool_name': {'readonly': True}, - 'last_available_backup_date': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'edition': {'key': 'properties.edition', 'type': 'str'}, - 'service_level_objective': {'key': 'properties.serviceLevelObjective', 'type': 'str'}, - 'elastic_pool_name': {'key': 'properties.elasticPoolName', 'type': 'str'}, - 'last_available_backup_date': {'key': 'properties.lastAvailableBackupDate', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoverableSqlPool, self).__init__(**kwargs) - self.edition = None - self.service_level_objective = None - self.elastic_pool_name = None - self.last_available_backup_date = None - - -class RecoverableSqlPoolListResult(msrest.serialization.Model): - """The response to a list recoverable sql pools request. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: A list of recoverable sql pool. - :vartype value: list[~azure.mgmt.synapse.models.RecoverableSqlPool] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RecoverableSqlPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RecoverableSqlPoolListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ReplaceAllFirewallRulesOperationResponse(msrest.serialization.Model): - """An existing operation for replacing the firewall rules. - - :param operation_id: The operation ID. - :type operation_id: str - """ - - _attribute_map = { - 'operation_id': {'key': 'operationId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplaceAllFirewallRulesOperationResponse, self).__init__(**kwargs) - self.operation_id = kwargs.get('operation_id', None) - - -class ReplaceAllIpFirewallRulesRequest(msrest.serialization.Model): - """Replace all IP firewall rules request. - - :param ip_firewall_rules: IP firewall rule properties. - :type ip_firewall_rules: dict[str, ~azure.mgmt.synapse.models.IpFirewallRuleProperties] - """ - - _attribute_map = { - 'ip_firewall_rules': {'key': 'ipFirewallRules', 'type': '{IpFirewallRuleProperties}'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplaceAllIpFirewallRulesRequest, self).__init__(**kwargs) - self.ip_firewall_rules = kwargs.get('ip_firewall_rules', None) - - -class ReplicationLink(ProxyResource): - """Represents a Sql pool replication link. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar location: Location of the workspace that contains this firewall rule. - :vartype location: str - :ivar is_termination_allowed: Legacy value indicating whether termination is allowed. - Currently always returns true. - :vartype is_termination_allowed: bool - :ivar replication_mode: Replication mode of this replication link. - :vartype replication_mode: str - :ivar partner_server: The name of the workspace hosting the partner Sql pool. - :vartype partner_server: str - :ivar partner_database: The name of the partner Sql pool. - :vartype partner_database: str - :ivar partner_location: The Azure Region of the partner Sql pool. - :vartype partner_location: str - :ivar role: The role of the Sql pool in the replication link. Possible values include: - "Primary", "Secondary", "NonReadableSecondary", "Source", "Copy". - :vartype role: str or ~azure.mgmt.synapse.models.ReplicationRole - :ivar partner_role: The role of the partner Sql pool in the replication link. Possible values - include: "Primary", "Secondary", "NonReadableSecondary", "Source", "Copy". - :vartype partner_role: str or ~azure.mgmt.synapse.models.ReplicationRole - :ivar start_time: The start time for the replication link. - :vartype start_time: ~datetime.datetime - :ivar percent_complete: The percentage of seeding complete for the replication link. - :vartype percent_complete: int - :ivar replication_state: The replication state for the replication link. Possible values - include: "PENDING", "SEEDING", "CATCH_UP", "SUSPENDED". - :vartype replication_state: str or ~azure.mgmt.synapse.models.ReplicationState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'is_termination_allowed': {'readonly': True}, - 'replication_mode': {'readonly': True}, - 'partner_server': {'readonly': True}, - 'partner_database': {'readonly': True}, - 'partner_location': {'readonly': True}, - 'role': {'readonly': True}, - 'partner_role': {'readonly': True}, - 'start_time': {'readonly': True}, - 'percent_complete': {'readonly': True}, - 'replication_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'is_termination_allowed': {'key': 'properties.isTerminationAllowed', 'type': 'bool'}, - 'replication_mode': {'key': 'properties.replicationMode', 'type': 'str'}, - 'partner_server': {'key': 'properties.partnerServer', 'type': 'str'}, - 'partner_database': {'key': 'properties.partnerDatabase', 'type': 'str'}, - 'partner_location': {'key': 'properties.partnerLocation', 'type': 'str'}, - 'role': {'key': 'properties.role', 'type': 'str'}, - 'partner_role': {'key': 'properties.partnerRole', 'type': 'str'}, - 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, - 'percent_complete': {'key': 'properties.percentComplete', 'type': 'int'}, - 'replication_state': {'key': 'properties.replicationState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationLink, self).__init__(**kwargs) - self.location = None - self.is_termination_allowed = None - self.replication_mode = None - self.partner_server = None - self.partner_database = None - self.partner_location = None - self.role = None - self.partner_role = None - self.start_time = None - self.percent_complete = None - self.replication_state = None - - -class ReplicationLinkListResult(msrest.serialization.Model): - """Represents the response to a List Sql pool replication link request. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: The list of Sql pool replication links housed in the Sql pool. - :type value: list[~azure.mgmt.synapse.models.ReplicationLink] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ReplicationLink]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationLinkListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class ResourceMoveDefinition(msrest.serialization.Model): - """Contains the information necessary to perform a resource move (rename). - - All required parameters must be populated in order to send to Azure. - - :param id: Required. The target ID for the resource. - :type id: str - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceMoveDefinition, self).__init__(**kwargs) - self.id = kwargs['id'] - - -class RestorableDroppedSqlPool(ProxyResource): - """A restorable dropped Sql pool. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar location: The geo-location where the resource lives. - :vartype location: str - :ivar database_name: The name of the database. - :vartype database_name: str - :ivar edition: The edition of the database. - :vartype edition: str - :ivar max_size_bytes: The max size in bytes of the database. - :vartype max_size_bytes: str - :ivar service_level_objective: The service level objective name of the database. - :vartype service_level_objective: str - :ivar elastic_pool_name: The elastic pool name of the database. - :vartype elastic_pool_name: str - :ivar creation_date: The creation date of the database (ISO8601 format). - :vartype creation_date: ~datetime.datetime - :ivar deletion_date: The deletion date of the database (ISO8601 format). - :vartype deletion_date: ~datetime.datetime - :ivar earliest_restore_date: The earliest restore date of the database (ISO8601 format). - :vartype earliest_restore_date: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'database_name': {'readonly': True}, - 'edition': {'readonly': True}, - 'max_size_bytes': {'readonly': True}, - 'service_level_objective': {'readonly': True}, - 'elastic_pool_name': {'readonly': True}, - 'creation_date': {'readonly': True}, - 'deletion_date': {'readonly': True}, - 'earliest_restore_date': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'database_name': {'key': 'properties.databaseName', 'type': 'str'}, - 'edition': {'key': 'properties.edition', 'type': 'str'}, - 'max_size_bytes': {'key': 'properties.maxSizeBytes', 'type': 'str'}, - 'service_level_objective': {'key': 'properties.serviceLevelObjective', 'type': 'str'}, - 'elastic_pool_name': {'key': 'properties.elasticPoolName', 'type': 'str'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'deletion_date': {'key': 'properties.deletionDate', 'type': 'iso-8601'}, - 'earliest_restore_date': {'key': 'properties.earliestRestoreDate', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorableDroppedSqlPool, self).__init__(**kwargs) - self.location = None - self.database_name = None - self.edition = None - self.max_size_bytes = None - self.service_level_objective = None - self.elastic_pool_name = None - self.creation_date = None - self.deletion_date = None - self.earliest_restore_date = None - - -class RestorableDroppedSqlPoolListResult(msrest.serialization.Model): - """The response to a list restorable dropped Sql pools request. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. A list of restorable dropped Sql pools. - :type value: list[~azure.mgmt.synapse.models.RestorableDroppedSqlPool] - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RestorableDroppedSqlPool]'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorableDroppedSqlPoolListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - - -class RestorePoint(ProxyResource): - """Database restore points. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar location: Resource location. - :vartype location: str - :ivar restore_point_type: The type of restore point. Possible values include: "CONTINUOUS", - "DISCRETE". - :vartype restore_point_type: str or ~azure.mgmt.synapse.models.RestorePointType - :ivar earliest_restore_date: The earliest time to which this database can be restored. - :vartype earliest_restore_date: ~datetime.datetime - :ivar restore_point_creation_date: The time the backup was taken. - :vartype restore_point_creation_date: ~datetime.datetime - :ivar restore_point_label: The label of restore point for backup request by user. - :vartype restore_point_label: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'restore_point_type': {'readonly': True}, - 'earliest_restore_date': {'readonly': True}, - 'restore_point_creation_date': {'readonly': True}, - 'restore_point_label': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'restore_point_type': {'key': 'properties.restorePointType', 'type': 'str'}, - 'earliest_restore_date': {'key': 'properties.earliestRestoreDate', 'type': 'iso-8601'}, - 'restore_point_creation_date': {'key': 'properties.restorePointCreationDate', 'type': 'iso-8601'}, - 'restore_point_label': {'key': 'properties.restorePointLabel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePoint, self).__init__(**kwargs) - self.location = None - self.restore_point_type = None - self.earliest_restore_date = None - self.restore_point_creation_date = None - self.restore_point_label = None - - -class RestorePointListResult(msrest.serialization.Model): - """A list of long term retention backups. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.synapse.models.RestorePoint] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[RestorePoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RestorePointListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SecretBase(msrest.serialization.Model): - """The base definition of a secret type. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: SecureString. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Type of the secret.Constant filled by server. - :type type: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'SecureString': 'SecureString'} - } - - def __init__( - self, - **kwargs - ): - super(SecretBase, self).__init__(**kwargs) - self.type = None # type: Optional[str] - - -class SecureString(SecretBase): - """Azure Synapse secure string definition. The string value will be masked with asterisks '*' during Get or List API calls. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Type of the secret.Constant filled by server. - :type type: str - :param value: Required. Value of secure string. - :type value: str - """ - - _validation = { - 'type': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SecureString, self).__init__(**kwargs) - self.type = 'SecureString' # type: str - self.value = kwargs['value'] - - -class SelfHostedIntegrationRuntime(IntegrationRuntime): - """Self-hosted integration runtime. - - All required parameters must be populated in order to send to Azure. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, any] - :param type: Required. Type of integration runtime.Constant filled by server. Possible values - include: "Managed", "SelfHosted". - :type type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeType - :param description: Integration runtime description. - :type description: str - :param linked_info: Linked integration runtime type from data factory. - :type linked_info: ~azure.mgmt.synapse.models.LinkedIntegrationRuntimeType - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'type': {'key': 'type', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'linked_info': {'key': 'typeProperties.linkedInfo', 'type': 'LinkedIntegrationRuntimeType'}, - } - - def __init__( - self, - **kwargs - ): - super(SelfHostedIntegrationRuntime, self).__init__(**kwargs) - self.type = 'SelfHosted' # type: str - self.linked_info = kwargs.get('linked_info', None) - - -class SelfHostedIntegrationRuntimeNode(msrest.serialization.Model): - """Properties of Self-hosted integration runtime node. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, any] - :ivar node_name: Name of the integration runtime node. - :vartype node_name: str - :ivar machine_name: Machine name of the integration runtime node. - :vartype machine_name: str - :ivar host_service_uri: URI for the host machine of the integration runtime. - :vartype host_service_uri: str - :ivar status: Status of the integration runtime node. Possible values include: - "NeedRegistration", "Online", "Limited", "Offline", "Upgrading", "Initializing", - "InitializeFailed". - :vartype status: str or ~azure.mgmt.synapse.models.SelfHostedIntegrationRuntimeNodeStatus - :ivar capabilities: The integration runtime capabilities dictionary. - :vartype capabilities: dict[str, str] - :ivar version_status: Status of the integration runtime node version. - :vartype version_status: str - :ivar version: Version of the integration runtime node. - :vartype version: str - :ivar register_time: The time at which the integration runtime node was registered in ISO8601 - format. - :vartype register_time: ~datetime.datetime - :ivar last_connect_time: The most recent time at which the integration runtime was connected in - ISO8601 format. - :vartype last_connect_time: ~datetime.datetime - :ivar expiry_time: The time at which the integration runtime will expire in ISO8601 format. - :vartype expiry_time: ~datetime.datetime - :ivar last_start_time: The time the node last started up. - :vartype last_start_time: ~datetime.datetime - :ivar last_stop_time: The integration runtime node last stop time. - :vartype last_stop_time: ~datetime.datetime - :ivar last_update_result: The result of the last integration runtime node update. Possible - values include: "None", "Succeed", "Fail". - :vartype last_update_result: str or ~azure.mgmt.synapse.models.IntegrationRuntimeUpdateResult - :ivar last_start_update_time: The last time for the integration runtime node update start. - :vartype last_start_update_time: ~datetime.datetime - :ivar last_end_update_time: The last time for the integration runtime node update end. - :vartype last_end_update_time: ~datetime.datetime - :ivar is_active_dispatcher: Indicates whether this node is the active dispatcher for - integration runtime requests. - :vartype is_active_dispatcher: bool - :ivar concurrent_jobs_limit: Maximum concurrent jobs on the integration runtime node. - :vartype concurrent_jobs_limit: int - :ivar max_concurrent_jobs: The maximum concurrent jobs in this integration runtime. - :vartype max_concurrent_jobs: int - """ - - _validation = { - 'node_name': {'readonly': True}, - 'machine_name': {'readonly': True}, - 'host_service_uri': {'readonly': True}, - 'status': {'readonly': True}, - 'capabilities': {'readonly': True}, - 'version_status': {'readonly': True}, - 'version': {'readonly': True}, - 'register_time': {'readonly': True}, - 'last_connect_time': {'readonly': True}, - 'expiry_time': {'readonly': True}, - 'last_start_time': {'readonly': True}, - 'last_stop_time': {'readonly': True}, - 'last_update_result': {'readonly': True}, - 'last_start_update_time': {'readonly': True}, - 'last_end_update_time': {'readonly': True}, - 'is_active_dispatcher': {'readonly': True}, - 'concurrent_jobs_limit': {'readonly': True}, - 'max_concurrent_jobs': {'readonly': True}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'node_name': {'key': 'nodeName', 'type': 'str'}, - 'machine_name': {'key': 'machineName', 'type': 'str'}, - 'host_service_uri': {'key': 'hostServiceUri', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'capabilities': {'key': 'capabilities', 'type': '{str}'}, - 'version_status': {'key': 'versionStatus', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - 'register_time': {'key': 'registerTime', 'type': 'iso-8601'}, - 'last_connect_time': {'key': 'lastConnectTime', 'type': 'iso-8601'}, - 'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'}, - 'last_start_time': {'key': 'lastStartTime', 'type': 'iso-8601'}, - 'last_stop_time': {'key': 'lastStopTime', 'type': 'iso-8601'}, - 'last_update_result': {'key': 'lastUpdateResult', 'type': 'str'}, - 'last_start_update_time': {'key': 'lastStartUpdateTime', 'type': 'iso-8601'}, - 'last_end_update_time': {'key': 'lastEndUpdateTime', 'type': 'iso-8601'}, - 'is_active_dispatcher': {'key': 'isActiveDispatcher', 'type': 'bool'}, - 'concurrent_jobs_limit': {'key': 'concurrentJobsLimit', 'type': 'int'}, - 'max_concurrent_jobs': {'key': 'maxConcurrentJobs', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(SelfHostedIntegrationRuntimeNode, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.node_name = None - self.machine_name = None - self.host_service_uri = None - self.status = None - self.capabilities = None - self.version_status = None - self.version = None - self.register_time = None - self.last_connect_time = None - self.expiry_time = None - self.last_start_time = None - self.last_stop_time = None - self.last_update_result = None - self.last_start_update_time = None - self.last_end_update_time = None - self.is_active_dispatcher = None - self.concurrent_jobs_limit = None - self.max_concurrent_jobs = None - - -class SelfHostedIntegrationRuntimeStatus(IntegrationRuntimeStatus): - """Self-hosted integration runtime status. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param additional_properties: Unmatched properties from the message are deserialized to this - collection. - :type additional_properties: dict[str, any] - :param type: Required. Type of integration runtime.Constant filled by server. Possible values - include: "Managed", "SelfHosted". - :type type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeType - :ivar data_factory_name: The workspace name which the integration runtime belong to. - :vartype data_factory_name: str - :ivar state: The state of integration runtime. Possible values include: "Initial", "Stopped", - "Started", "Starting", "Stopping", "NeedRegistration", "Online", "Limited", "Offline", - "AccessDenied". - :vartype state: str or ~azure.mgmt.synapse.models.IntegrationRuntimeState - :ivar create_time: The time at which the integration runtime was created, in ISO8601 format. - :vartype create_time: ~datetime.datetime - :ivar task_queue_id: The task queue id of the integration runtime. - :vartype task_queue_id: str - :ivar node_communication_channel_encryption_mode: The node communication Channel encryption - mode. - :vartype node_communication_channel_encryption_mode: str - :ivar internal_channel_encryption: It is used to set the encryption mode for node-node - communication channel (when more than 2 self-hosted integration runtime nodes exist). Possible - values include: "NotSet", "SslEncrypted", "NotEncrypted". - :vartype internal_channel_encryption: str or - ~azure.mgmt.synapse.models.IntegrationRuntimeInternalChannelEncryptionMode - :ivar version: Version of the integration runtime. - :vartype version: str - :param nodes: The list of nodes for this integration runtime. - :type nodes: list[~azure.mgmt.synapse.models.SelfHostedIntegrationRuntimeNode] - :ivar scheduled_update_date: The date at which the integration runtime will be scheduled to - update, in ISO8601 format. - :vartype scheduled_update_date: ~datetime.datetime - :ivar update_delay_offset: The time in the date scheduled by service to update the integration - runtime, e.g., PT03H is 3 hours. - :vartype update_delay_offset: str - :ivar local_time_zone_offset: The local time zone offset in hours. - :vartype local_time_zone_offset: str - :ivar capabilities: Object with additional information about integration runtime capabilities. - :vartype capabilities: dict[str, str] - :ivar service_urls: The URLs for the services used in integration runtime backend service. - :vartype service_urls: list[str] - :ivar auto_update: Whether Self-hosted integration runtime auto update has been turned on. - Possible values include: "On", "Off". - :vartype auto_update: str or ~azure.mgmt.synapse.models.IntegrationRuntimeAutoUpdate - :ivar version_status: Status of the integration runtime version. - :vartype version_status: str - :param links: The list of linked integration runtimes that are created to share with this - integration runtime. - :type links: list[~azure.mgmt.synapse.models.LinkedIntegrationRuntime] - :ivar pushed_version: The version that the integration runtime is going to update to. - :vartype pushed_version: str - :ivar latest_version: The latest version on download center. - :vartype latest_version: str - :ivar auto_update_eta: The estimated time when the self-hosted integration runtime will be - updated. - :vartype auto_update_eta: ~datetime.datetime - """ - - _validation = { - 'type': {'required': True}, - 'data_factory_name': {'readonly': True}, - 'state': {'readonly': True}, - 'create_time': {'readonly': True}, - 'task_queue_id': {'readonly': True}, - 'node_communication_channel_encryption_mode': {'readonly': True}, - 'internal_channel_encryption': {'readonly': True}, - 'version': {'readonly': True}, - 'scheduled_update_date': {'readonly': True}, - 'update_delay_offset': {'readonly': True}, - 'local_time_zone_offset': {'readonly': True}, - 'capabilities': {'readonly': True}, - 'service_urls': {'readonly': True}, - 'auto_update': {'readonly': True}, - 'version_status': {'readonly': True}, - 'pushed_version': {'readonly': True}, - 'latest_version': {'readonly': True}, - 'auto_update_eta': {'readonly': True}, - } - - _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'type': {'key': 'type', 'type': 'str'}, - 'data_factory_name': {'key': 'dataFactoryName', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'create_time': {'key': 'typeProperties.createTime', 'type': 'iso-8601'}, - 'task_queue_id': {'key': 'typeProperties.taskQueueId', 'type': 'str'}, - 'node_communication_channel_encryption_mode': {'key': 'typeProperties.nodeCommunicationChannelEncryptionMode', 'type': 'str'}, - 'internal_channel_encryption': {'key': 'typeProperties.internalChannelEncryption', 'type': 'str'}, - 'version': {'key': 'typeProperties.version', 'type': 'str'}, - 'nodes': {'key': 'typeProperties.nodes', 'type': '[SelfHostedIntegrationRuntimeNode]'}, - 'scheduled_update_date': {'key': 'typeProperties.scheduledUpdateDate', 'type': 'iso-8601'}, - 'update_delay_offset': {'key': 'typeProperties.updateDelayOffset', 'type': 'str'}, - 'local_time_zone_offset': {'key': 'typeProperties.localTimeZoneOffset', 'type': 'str'}, - 'capabilities': {'key': 'typeProperties.capabilities', 'type': '{str}'}, - 'service_urls': {'key': 'typeProperties.serviceUrls', 'type': '[str]'}, - 'auto_update': {'key': 'typeProperties.autoUpdate', 'type': 'str'}, - 'version_status': {'key': 'typeProperties.versionStatus', 'type': 'str'}, - 'links': {'key': 'typeProperties.links', 'type': '[LinkedIntegrationRuntime]'}, - 'pushed_version': {'key': 'typeProperties.pushedVersion', 'type': 'str'}, - 'latest_version': {'key': 'typeProperties.latestVersion', 'type': 'str'}, - 'auto_update_eta': {'key': 'typeProperties.autoUpdateETA', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SelfHostedIntegrationRuntimeStatus, self).__init__(**kwargs) - self.type = 'SelfHosted' # type: str - self.create_time = None - self.task_queue_id = None - self.node_communication_channel_encryption_mode = None - self.internal_channel_encryption = None - self.version = None - self.nodes = kwargs.get('nodes', None) - self.scheduled_update_date = None - self.update_delay_offset = None - self.local_time_zone_offset = None - self.capabilities = None - self.service_urls = None - self.auto_update = None - self.version_status = None - self.links = kwargs.get('links', None) - self.pushed_version = None - self.latest_version = None - self.auto_update_eta = None - - -class SensitivityLabel(ProxyResource): - """A sensitivity label. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar managed_by: managed by. - :vartype managed_by: str - :ivar schema_name: The schema name. - :vartype schema_name: str - :ivar table_name: The table name. - :vartype table_name: str - :ivar column_name: The column name. - :vartype column_name: str - :param label_name: The label name. - :type label_name: str - :param label_id: The label ID. - :type label_id: str - :param information_type: The information type. - :type information_type: str - :param information_type_id: The information type ID. - :type information_type_id: str - :ivar is_disabled: Is sensitivity recommendation disabled. Applicable for recommended - sensitivity label only. Specifies whether the sensitivity recommendation on this column is - disabled (dismissed) or not. - :vartype is_disabled: bool - :param rank: Possible values include: "None", "Low", "Medium", "High", "Critical". - :type rank: str or ~azure.mgmt.synapse.models.SensitivityLabelRank - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'managed_by': {'readonly': True}, - 'schema_name': {'readonly': True}, - 'table_name': {'readonly': True}, - 'column_name': {'readonly': True}, - 'is_disabled': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'schema_name': {'key': 'properties.schemaName', 'type': 'str'}, - 'table_name': {'key': 'properties.tableName', 'type': 'str'}, - 'column_name': {'key': 'properties.columnName', 'type': 'str'}, - 'label_name': {'key': 'properties.labelName', 'type': 'str'}, - 'label_id': {'key': 'properties.labelId', 'type': 'str'}, - 'information_type': {'key': 'properties.informationType', 'type': 'str'}, - 'information_type_id': {'key': 'properties.informationTypeId', 'type': 'str'}, - 'is_disabled': {'key': 'properties.isDisabled', 'type': 'bool'}, - 'rank': {'key': 'properties.rank', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SensitivityLabel, self).__init__(**kwargs) - self.managed_by = None - self.schema_name = None - self.table_name = None - self.column_name = None - self.label_name = kwargs.get('label_name', None) - self.label_id = kwargs.get('label_id', None) - self.information_type = kwargs.get('information_type', None) - self.information_type_id = kwargs.get('information_type_id', None) - self.is_disabled = None - self.rank = kwargs.get('rank', None) - - -class SensitivityLabelListResult(msrest.serialization.Model): - """A list of sensitivity labels. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.synapse.models.SensitivityLabel] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SensitivityLabel]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SensitivityLabelListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SensitivityLabelUpdate(ProxyResource): - """A sensitivity label update operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param op: Possible values include: "set", "remove". - :type op: str or ~azure.mgmt.synapse.models.SensitivityLabelUpdateKind - :param schema: Schema name of the column to update. - :type schema: str - :param table: Table name of the column to update. - :type table: str - :param column: Column name to update. - :type column: str - :param sensitivity_label: The sensitivity label information to apply on a column. - :type sensitivity_label: ~azure.mgmt.synapse.models.SensitivityLabel - """ - - _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'}, - 'op': {'key': 'properties.op', 'type': 'str'}, - 'schema': {'key': 'properties.schema', 'type': 'str'}, - 'table': {'key': 'properties.table', 'type': 'str'}, - 'column': {'key': 'properties.column', 'type': 'str'}, - 'sensitivity_label': {'key': 'properties.sensitivityLabel', 'type': 'SensitivityLabel'}, - } - - def __init__( - self, - **kwargs - ): - super(SensitivityLabelUpdate, self).__init__(**kwargs) - self.op = kwargs.get('op', None) - self.schema = kwargs.get('schema', None) - self.table = kwargs.get('table', None) - self.column = kwargs.get('column', None) - self.sensitivity_label = kwargs.get('sensitivity_label', None) - - -class SensitivityLabelUpdateList(msrest.serialization.Model): - """A list of sensitivity label update operations. - - :param operations: - :type operations: list[~azure.mgmt.synapse.models.SensitivityLabelUpdate] - """ - - _attribute_map = { - 'operations': {'key': 'operations', 'type': '[SensitivityLabelUpdate]'}, - } - - def __init__( - self, - **kwargs - ): - super(SensitivityLabelUpdateList, self).__init__(**kwargs) - self.operations = kwargs.get('operations', None) - - -class ServerBlobAuditingPolicy(ProxyResource): - """A server blob auditing policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param state: Specifies the state of the policy. If state is Enabled, storageEndpoint or - isAzureMonitorTargetEnabled are required. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyState - :param storage_endpoint: Specifies the blob storage endpoint (e.g. - https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or - isAzureMonitorTargetEnabled is required. - :type storage_endpoint: str - :param storage_account_access_key: Specifies the identifier key of the auditing storage - account. - If state is Enabled and storageEndpoint is specified, not specifying the - storageAccountAccessKey will use SQL server system-assigned managed identity to access the - storage. - Prerequisites for using managed identity authentication: - - - #. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). - #. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data - Contributor' RBAC role to the server identity. - For more information, see `Auditing to storage using Managed Identity authentication - `_. - :type storage_account_access_key: str - :param retention_days: Specifies the number of days to keep in the audit logs in the storage - account. - :type retention_days: int - :param audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit. - - The recommended set of action groups to use is the following combination - this will audit all - the queries and stored procedures executed against the database, as well as successful and - failed logins: - - BATCH_COMPLETED_GROUP, - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - FAILED_DATABASE_AUTHENTICATION_GROUP. - - This above combination is also the set that is configured by default when enabling auditing - from the Azure portal. - - The supported action groups to audit are (note: choose only specific groups that cover your - auditing needs. Using unnecessary groups could lead to very large quantities of audit records): - - APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - BACKUP_RESTORE_GROUP - DATABASE_LOGOUT_GROUP - DATABASE_OBJECT_CHANGE_GROUP - DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - DATABASE_OPERATION_GROUP - DATABASE_PERMISSION_CHANGE_GROUP - DATABASE_PRINCIPAL_CHANGE_GROUP - DATABASE_PRINCIPAL_IMPERSONATION_GROUP - DATABASE_ROLE_MEMBER_CHANGE_GROUP - FAILED_DATABASE_AUTHENTICATION_GROUP - SCHEMA_OBJECT_ACCESS_GROUP - SCHEMA_OBJECT_CHANGE_GROUP - SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - USER_CHANGE_PASSWORD_GROUP - BATCH_STARTED_GROUP - BATCH_COMPLETED_GROUP - - These are groups that cover all sql statements and stored procedures executed against the - database, and should not be used in combination with other groups as this will result in - duplicate audit logs. - - For more information, see `Database-Level Audit Action Groups - `_. - - For Database auditing policy, specific Actions can also be specified (note that Actions cannot - be specified for Server auditing policy). The supported actions to audit are: - SELECT - UPDATE - INSERT - DELETE - EXECUTE - RECEIVE - REFERENCES - - The general form for defining an action to be audited is: - {action} ON {object} BY {principal} - - Note that :code:`` in the above format can refer to an object like a table, view, or - stored procedure, or an entire database or schema. For the latter cases, the forms - DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. - - For example: - SELECT on dbo.myTable by public - SELECT on DATABASE::myDatabase by public - SELECT on SCHEMA::mySchema by public - - For more information, see `Database-Level Audit Actions - `_. - :type audit_actions_and_groups: list[str] - :param storage_account_subscription_id: Specifies the blob storage subscription Id. - :type storage_account_subscription_id: str - :param is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is the - storage's secondary key. - :type is_storage_secondary_key_in_use: bool - :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure - Monitor. - In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and - 'isAzureMonitorTargetEnabled' as true. - - When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' - diagnostic logs category on the database should be also created. - Note that for server level audit you should use the 'master' database as {databaseName}. - - Diagnostic Settings URI format: - PUT - https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview - - For more information, see `Diagnostic Settings REST API - `_ - or `Diagnostic Settings PowerShell `_. - :type is_azure_monitor_target_enabled: bool - :param queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before - audit actions are forced to be processed. - The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. - :type queue_delay_ms: int - """ - - _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'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, - 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, - 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, - 'audit_actions_and_groups': {'key': 'properties.auditActionsAndGroups', 'type': '[str]'}, - 'storage_account_subscription_id': {'key': 'properties.storageAccountSubscriptionId', 'type': 'str'}, - 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, - 'is_azure_monitor_target_enabled': {'key': 'properties.isAzureMonitorTargetEnabled', 'type': 'bool'}, - 'queue_delay_ms': {'key': 'properties.queueDelayMs', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerBlobAuditingPolicy, self).__init__(**kwargs) - self.state = kwargs.get('state', None) - self.storage_endpoint = kwargs.get('storage_endpoint', None) - self.storage_account_access_key = kwargs.get('storage_account_access_key', None) - self.retention_days = kwargs.get('retention_days', None) - self.audit_actions_and_groups = kwargs.get('audit_actions_and_groups', None) - self.storage_account_subscription_id = kwargs.get('storage_account_subscription_id', None) - self.is_storage_secondary_key_in_use = kwargs.get('is_storage_secondary_key_in_use', None) - self.is_azure_monitor_target_enabled = kwargs.get('is_azure_monitor_target_enabled', None) - self.queue_delay_ms = kwargs.get('queue_delay_ms', None) - - -class ServerBlobAuditingPolicyListResult(msrest.serialization.Model): - """A list of server auditing settings. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.synapse.models.ServerBlobAuditingPolicy] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ServerBlobAuditingPolicy]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerBlobAuditingPolicyListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ServerSecurityAlertPolicy(ProxyResource): - """Workspace managed Sql server security alert policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param state: Specifies the state of the policy, whether it is enabled or disabled or a policy - has not been applied yet on the specific server. Possible values include: "New", "Enabled", - "Disabled". - :type state: str or ~azure.mgmt.synapse.models.SecurityAlertPolicyState - :param disabled_alerts: Specifies an array of alerts that are disabled. Allowed values are: - Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. - :type disabled_alerts: list[str] - :param email_addresses: Specifies an array of e-mail addresses to which the alert is sent. - :type email_addresses: list[str] - :param email_account_admins: Specifies that the alert is sent to the account administrators. - :type email_account_admins: bool - :param storage_endpoint: Specifies the blob storage endpoint (e.g. - https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection - audit logs. - :type storage_endpoint: str - :param storage_account_access_key: Specifies the identifier key of the Threat Detection audit - storage account. - :type storage_account_access_key: str - :param retention_days: Specifies the number of days to keep in the Threat Detection audit logs. - :type retention_days: int - :ivar creation_time: Specifies the UTC creation time of the policy. - :vartype creation_time: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'creation_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'disabled_alerts': {'key': 'properties.disabledAlerts', 'type': '[str]'}, - 'email_addresses': {'key': 'properties.emailAddresses', 'type': '[str]'}, - 'email_account_admins': {'key': 'properties.emailAccountAdmins', 'type': 'bool'}, - 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, - 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, - 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerSecurityAlertPolicy, self).__init__(**kwargs) - self.state = kwargs.get('state', None) - self.disabled_alerts = kwargs.get('disabled_alerts', None) - self.email_addresses = kwargs.get('email_addresses', None) - self.email_account_admins = kwargs.get('email_account_admins', None) - self.storage_endpoint = kwargs.get('storage_endpoint', None) - self.storage_account_access_key = kwargs.get('storage_account_access_key', None) - self.retention_days = kwargs.get('retention_days', None) - self.creation_time = None - - -class ServerSecurityAlertPolicyListResult(msrest.serialization.Model): - """A list of the workspace managed sql server's security alert policies. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.synapse.models.ServerSecurityAlertPolicy] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ServerSecurityAlertPolicy]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerSecurityAlertPolicyListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ServerUsage(msrest.serialization.Model): - """Represents server metrics. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the server usage metric. - :vartype name: str - :ivar resource_name: The name of the resource. - :vartype resource_name: str - :ivar display_name: The metric display name. - :vartype display_name: str - :ivar current_value: The current value of the metric. - :vartype current_value: float - :ivar limit: The current limit of the metric. - :vartype limit: float - :ivar unit: The units of the metric. - :vartype unit: str - :ivar next_reset_time: The next reset time for the metric (ISO8601 format). - :vartype next_reset_time: ~datetime.datetime - """ - - _validation = { - 'name': {'readonly': True}, - 'resource_name': {'readonly': True}, - 'display_name': {'readonly': True}, - 'current_value': {'readonly': True}, - 'limit': {'readonly': True}, - 'unit': {'readonly': True}, - 'next_reset_time': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'resource_name': {'key': 'resourceName', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'float'}, - 'limit': {'key': 'limit', 'type': 'float'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'next_reset_time': {'key': 'nextResetTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerUsage, self).__init__(**kwargs) - self.name = None - self.resource_name = None - self.display_name = None - self.current_value = None - self.limit = None - self.unit = None - self.next_reset_time = None - - -class ServerUsageListResult(msrest.serialization.Model): - """Represents the response to a list server metrics request. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of server metrics for the server. - :type value: list[~azure.mgmt.synapse.models.ServerUsage] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ServerUsage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerUsageListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = None - - -class ServerVulnerabilityAssessment(ProxyResource): - """A server vulnerability assessment. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param storage_container_path: A blob storage container path to hold the scan results (e.g. - https://myStorage.blob.core.windows.net/VaScans/). - :type storage_container_path: str - :param storage_container_sas_key: A shared access signature (SAS Key) that has read and write - access to the blob container specified in 'storageContainerPath' parameter. If - 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. - :type storage_container_sas_key: str - :param storage_account_access_key: Specifies the identifier key of the storage account for - vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, - storageAccountAccessKey is required. - :type storage_account_access_key: str - :param recurring_scans: The recurring scans settings. - :type recurring_scans: - ~azure.mgmt.synapse.models.VulnerabilityAssessmentRecurringScansProperties - """ - - _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'}, - 'storage_container_path': {'key': 'properties.storageContainerPath', 'type': 'str'}, - 'storage_container_sas_key': {'key': 'properties.storageContainerSasKey', 'type': 'str'}, - 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, - 'recurring_scans': {'key': 'properties.recurringScans', 'type': 'VulnerabilityAssessmentRecurringScansProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerVulnerabilityAssessment, self).__init__(**kwargs) - self.storage_container_path = kwargs.get('storage_container_path', None) - self.storage_container_sas_key = kwargs.get('storage_container_sas_key', None) - self.storage_account_access_key = kwargs.get('storage_account_access_key', None) - self.recurring_scans = kwargs.get('recurring_scans', None) - - -class ServerVulnerabilityAssessmentListResult(msrest.serialization.Model): - """A list of the server's vulnerability assessments. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.synapse.models.ServerVulnerabilityAssessment] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ServerVulnerabilityAssessment]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerVulnerabilityAssessmentListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class Sku(msrest.serialization.Model): - """SQL pool SKU. - - :param tier: The service tier. - :type tier: str - :param name: The SKU name. - :type name: str - :param capacity: If the SKU supports scale out/in then the capacity integer should be included. - If scale out/in is not possible for the resource this may be omitted. - :type capacity: int - """ - - _attribute_map = { - 'tier': {'key': 'tier', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.tier = kwargs.get('tier', None) - self.name = kwargs.get('name', None) - self.capacity = kwargs.get('capacity', None) - - -class SkuDescription(msrest.serialization.Model): - """The Kusto SKU description of given resource type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_type: The resource type. - :vartype resource_type: str - :ivar name: The name of the SKU. - :vartype name: str - :ivar size: The size of the SKU. - :vartype size: str - :ivar locations: The set of locations that the SKU is available. - :vartype locations: list[str] - :ivar location_info: Locations and zones. - :vartype location_info: list[~azure.mgmt.synapse.models.SkuLocationInfoItem] - :ivar restrictions: The restrictions because of which SKU cannot be used. - :vartype restrictions: list[any] - """ - - _validation = { - 'resource_type': {'readonly': True}, - 'name': {'readonly': True}, - 'size': {'readonly': True}, - 'locations': {'readonly': True}, - 'location_info': {'readonly': True}, - 'restrictions': {'readonly': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'location_info': {'key': 'locationInfo', 'type': '[SkuLocationInfoItem]'}, - 'restrictions': {'key': 'restrictions', 'type': '[object]'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuDescription, self).__init__(**kwargs) - self.resource_type = None - self.name = None - self.size = None - self.locations = None - self.location_info = None - self.restrictions = None - - -class SkuDescriptionList(msrest.serialization.Model): - """The list of the SKU descriptions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: SKU descriptions. - :vartype value: list[~azure.mgmt.synapse.models.SkuDescription] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SkuDescription]'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuDescriptionList, self).__init__(**kwargs) - self.value = None - - -class SkuLocationInfoItem(msrest.serialization.Model): - """The locations and zones info for SKU. - - All required parameters must be populated in order to send to Azure. - - :param location: Required. The available location of the SKU. - :type location: str - :param zones: The available zone of the SKU. - :type zones: list[str] - """ - - _validation = { - 'location': {'required': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuLocationInfoItem, self).__init__(**kwargs) - self.location = kwargs['location'] - self.zones = kwargs.get('zones', None) - - -class SparkConfigProperties(msrest.serialization.Model): - """SparkConfig Properties for a Big Data pool powered by Apache Spark. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar time: The last update time of the spark config properties file. - :vartype time: ~datetime.datetime - :param content: The spark config properties. - :type content: str - :param filename: The filename of the spark config properties file. - :type filename: str - :param configuration_type: The type of the spark config properties file. Possible values - include: "File", "Artifact". - :type configuration_type: str or ~azure.mgmt.synapse.models.ConfigurationType - """ - - _validation = { - 'time': {'readonly': True}, - } - - _attribute_map = { - 'time': {'key': 'time', 'type': 'iso-8601'}, - 'content': {'key': 'content', 'type': 'str'}, - 'filename': {'key': 'filename', 'type': 'str'}, - 'configuration_type': {'key': 'configurationType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SparkConfigProperties, self).__init__(**kwargs) - self.time = None - self.content = kwargs.get('content', None) - self.filename = kwargs.get('filename', None) - self.configuration_type = kwargs.get('configuration_type', None) - - -class SparkConfigurationListResponse(msrest.serialization.Model): - """A list of SparkConfiguration resources. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. List of SparkConfiguration. - :type value: list[~azure.mgmt.synapse.models.SparkConfigurationResource] - :param next_link: The link to the next page of results, if any remaining results exist. - :type next_link: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SparkConfigurationResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SparkConfigurationListResponse, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = kwargs.get('next_link', None) - - -class SparkConfigurationResource(SubResource): - """SparkConfiguration response details. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar etag: Resource Etag. - :vartype etag: str - :param description: Description about the SparkConfiguration. - :type description: str - :param configs: Required. SparkConfiguration configs. - :type configs: dict[str, str] - :param annotations: Annotations for SparkConfiguration. - :type annotations: list[str] - :param notes: additional Notes. - :type notes: str - :param created_by: The identity that created the resource. - :type created_by: str - :param created: The timestamp of resource creation. - :type created: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'configs': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'configs': {'key': 'properties.configs', 'type': '{str}'}, - 'annotations': {'key': 'properties.annotations', 'type': '[str]'}, - 'notes': {'key': 'properties.notes', 'type': 'str'}, - 'created_by': {'key': 'properties.createdBy', 'type': 'str'}, - 'created': {'key': 'properties.created', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SparkConfigurationResource, self).__init__(**kwargs) - self.description = kwargs.get('description', None) - self.configs = kwargs['configs'] - self.annotations = kwargs.get('annotations', None) - self.notes = kwargs.get('notes', None) - self.created_by = kwargs.get('created_by', None) - self.created = kwargs.get('created', None) - - -class SqlPool(TrackedResource): - """A SQL Analytics pool. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param sku: SQL pool SKU. - :type sku: ~azure.mgmt.synapse.models.Sku - :param max_size_bytes: Maximum size in bytes. - :type max_size_bytes: long - :param collation: Collation mode. - :type collation: str - :param source_database_id: Source database to create from. - :type source_database_id: str - :param recoverable_database_id: Backup database to restore from. - :type recoverable_database_id: str - :param provisioning_state: Resource state. - :type provisioning_state: str - :param status: Resource status. - :type status: str - :param restore_point_in_time: Snapshot time to restore. - :type restore_point_in_time: ~datetime.datetime - :param create_mode: Specifies the mode of sql pool creation. - - Default: regular sql pool creation. - - PointInTimeRestore: Creates a sql pool by restoring a point in time backup of an existing sql - pool. sourceDatabaseId must be specified as the resource ID of the existing sql pool, and - restorePointInTime must be specified. - - Recovery: Creates a sql pool by a geo-replicated backup. sourceDatabaseId must be specified - as the recoverableDatabaseId to restore. - - Restore: Creates a sql pool by restoring a backup of a deleted sql pool. SourceDatabaseId - should be the sql pool's original resource ID. SourceDatabaseId and sourceDatabaseDeletionDate - must be specified. Possible values include: "Default", "PointInTimeRestore", "Recovery", - "Restore". - :type create_mode: str or ~azure.mgmt.synapse.models.CreateMode - :param creation_date: Date the SQL pool was created. - :type creation_date: ~datetime.datetime - :param storage_account_type: The storage account type used to store backups for this sql pool. - Possible values include: "GRS", "LRS", "ZRS". - :type storage_account_type: str or ~azure.mgmt.synapse.models.StorageAccountType - :param source_database_deletion_date: Specifies the time that the sql pool was deleted. - :type source_database_deletion_date: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'max_size_bytes': {'key': 'properties.maxSizeBytes', 'type': 'long'}, - 'collation': {'key': 'properties.collation', 'type': 'str'}, - 'source_database_id': {'key': 'properties.sourceDatabaseId', 'type': 'str'}, - 'recoverable_database_id': {'key': 'properties.recoverableDatabaseId', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'restore_point_in_time': {'key': 'properties.restorePointInTime', 'type': 'iso-8601'}, - 'create_mode': {'key': 'properties.createMode', 'type': 'str'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'storage_account_type': {'key': 'properties.storageAccountType', 'type': 'str'}, - 'source_database_deletion_date': {'key': 'properties.sourceDatabaseDeletionDate', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlPool, self).__init__(**kwargs) - self.sku = kwargs.get('sku', None) - self.max_size_bytes = kwargs.get('max_size_bytes', None) - self.collation = kwargs.get('collation', None) - self.source_database_id = kwargs.get('source_database_id', None) - self.recoverable_database_id = kwargs.get('recoverable_database_id', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.status = kwargs.get('status', None) - self.restore_point_in_time = kwargs.get('restore_point_in_time', None) - self.create_mode = kwargs.get('create_mode', None) - self.creation_date = kwargs.get('creation_date', None) - self.storage_account_type = kwargs.get('storage_account_type', None) - self.source_database_deletion_date = kwargs.get('source_database_deletion_date', None) - - -class SqlPoolBlobAuditingPolicy(ProxyResource): - """A Sql pool blob auditing policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar kind: Resource kind. - :vartype kind: str - :param state: Specifies the state of the policy. If state is Enabled, storageEndpoint or - isAzureMonitorTargetEnabled are required. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyState - :param storage_endpoint: Specifies the blob storage endpoint (e.g. - https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. - :type storage_endpoint: str - :param storage_account_access_key: Specifies the identifier key of the auditing storage - account. If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is - required. - :type storage_account_access_key: str - :param retention_days: Specifies the number of days to keep in the audit logs in the storage - account. - :type retention_days: int - :param audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit. - - The recommended set of action groups to use is the following combination - this will audit all - the queries and stored procedures executed against the database, as well as successful and - failed logins: - - BATCH_COMPLETED_GROUP, - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, - FAILED_DATABASE_AUTHENTICATION_GROUP. - - This above combination is also the set that is configured by default when enabling auditing - from the Azure portal. - - The supported action groups to audit are (note: choose only specific groups that cover your - auditing needs. Using unnecessary groups could lead to very large quantities of audit records): - - APPLICATION_ROLE_CHANGE_PASSWORD_GROUP - BACKUP_RESTORE_GROUP - DATABASE_LOGOUT_GROUP - DATABASE_OBJECT_CHANGE_GROUP - DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP - DATABASE_OBJECT_PERMISSION_CHANGE_GROUP - DATABASE_OPERATION_GROUP - DATABASE_PERMISSION_CHANGE_GROUP - DATABASE_PRINCIPAL_CHANGE_GROUP - DATABASE_PRINCIPAL_IMPERSONATION_GROUP - DATABASE_ROLE_MEMBER_CHANGE_GROUP - FAILED_DATABASE_AUTHENTICATION_GROUP - SCHEMA_OBJECT_ACCESS_GROUP - SCHEMA_OBJECT_CHANGE_GROUP - SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP - SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP - SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP - USER_CHANGE_PASSWORD_GROUP - BATCH_STARTED_GROUP - BATCH_COMPLETED_GROUP - - These are groups that cover all sql statements and stored procedures executed against the - database, and should not be used in combination with other groups as this will result in - duplicate audit logs. - - For more information, see `Database-Level Audit Action Groups - `_. - - For Database auditing policy, specific Actions can also be specified (note that Actions cannot - be specified for Server auditing policy). The supported actions to audit are: - SELECT - UPDATE - INSERT - DELETE - EXECUTE - RECEIVE - REFERENCES - - The general form for defining an action to be audited is: - {action} ON {object} BY {principal} - - Note that :code:`` in the above format can refer to an object like a table, view, or - stored procedure, or an entire database or schema. For the latter cases, the forms - DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. - - For example: - SELECT on dbo.myTable by public - SELECT on DATABASE::myDatabase by public - SELECT on SCHEMA::mySchema by public - - For more information, see `Database-Level Audit Actions - `_. - :type audit_actions_and_groups: list[str] - :param storage_account_subscription_id: Specifies the blob storage subscription Id. - :type storage_account_subscription_id: str - :param is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is the - storage's secondary key. - :type is_storage_secondary_key_in_use: bool - :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure - Monitor. - In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and - 'isAzureMonitorTargetEnabled' as true. - - When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' - diagnostic logs category on the database should be also created. - Note that for server level audit you should use the 'master' database as {databaseName}. - - Diagnostic Settings URI format: - PUT - https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview - - For more information, see `Diagnostic Settings REST API - `_ - or `Diagnostic Settings PowerShell `_. - :type is_azure_monitor_target_enabled: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, - 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, - 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, - 'audit_actions_and_groups': {'key': 'properties.auditActionsAndGroups', 'type': '[str]'}, - 'storage_account_subscription_id': {'key': 'properties.storageAccountSubscriptionId', 'type': 'str'}, - 'is_storage_secondary_key_in_use': {'key': 'properties.isStorageSecondaryKeyInUse', 'type': 'bool'}, - 'is_azure_monitor_target_enabled': {'key': 'properties.isAzureMonitorTargetEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlPoolBlobAuditingPolicy, self).__init__(**kwargs) - self.kind = None - self.state = kwargs.get('state', None) - self.storage_endpoint = kwargs.get('storage_endpoint', None) - self.storage_account_access_key = kwargs.get('storage_account_access_key', None) - self.retention_days = kwargs.get('retention_days', None) - self.audit_actions_and_groups = kwargs.get('audit_actions_and_groups', None) - self.storage_account_subscription_id = kwargs.get('storage_account_subscription_id', None) - self.is_storage_secondary_key_in_use = kwargs.get('is_storage_secondary_key_in_use', None) - self.is_azure_monitor_target_enabled = kwargs.get('is_azure_monitor_target_enabled', None) - - -class SqlPoolBlobAuditingPolicyListResult(msrest.serialization.Model): - """A list of Sql pool auditing settings. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.synapse.models.SqlPoolBlobAuditingPolicy] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SqlPoolBlobAuditingPolicy]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlPoolBlobAuditingPolicyListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SqlPoolBlobAuditingPolicySqlPoolOperationListResult(msrest.serialization.Model): - """The response to a list Sql pool operations request. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.synapse.models.SqlPoolOperation] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SqlPoolOperation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlPoolBlobAuditingPolicySqlPoolOperationListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SqlPoolColumn(ProxyResource): - """A Sql pool column resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param column_type: The column data type. Possible values include: "image", "text", - "uniqueidentifier", "date", "time", "datetime2", "datetimeoffset", "tinyint", "smallint", - "int", "smalldatetime", "real", "money", "datetime", "float", "sql_variant", "ntext", "bit", - "decimal", "numeric", "smallmoney", "bigint", "hierarchyid", "geometry", "geography", - "varbinary", "varchar", "binary", "char", "timestamp", "nvarchar", "nchar", "xml", "sysname". - :type column_type: str or ~azure.mgmt.synapse.models.ColumnDataType - :ivar is_computed: Indicates whether column value is computed or not. - :vartype is_computed: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'is_computed': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'column_type': {'key': 'properties.columnType', 'type': 'str'}, - 'is_computed': {'key': 'properties.isComputed', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlPoolColumn, self).__init__(**kwargs) - self.column_type = kwargs.get('column_type', None) - self.is_computed = None - - -class SqlPoolColumnListResult(msrest.serialization.Model): - """A list of Sql pool columns. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.synapse.models.SqlPoolColumn] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SqlPoolColumn]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlPoolColumnListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SqlPoolConnectionPolicy(ProxyResource): - """A Sql pool connection policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar kind: Resource kind. - :vartype kind: str - :ivar location: Resource location. - :vartype location: str - :param security_enabled_access: The state of security access. - :type security_enabled_access: str - :param proxy_dns_name: The fully qualified host name of the auditing proxy. - :type proxy_dns_name: str - :param proxy_port: The port number of the auditing proxy. - :type proxy_port: str - :param visibility: The visibility of the auditing proxy. - :type visibility: str - :param use_server_default: Whether server default is enabled or disabled. - :type use_server_default: str - :param redirection_state: The state of proxy redirection. - :type redirection_state: str - :param state: The connection policy state. - :type state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'readonly': True}, - 'location': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'security_enabled_access': {'key': 'properties.securityEnabledAccess', 'type': 'str'}, - 'proxy_dns_name': {'key': 'properties.proxyDnsName', 'type': 'str'}, - 'proxy_port': {'key': 'properties.proxyPort', 'type': 'str'}, - 'visibility': {'key': 'properties.visibility', 'type': 'str'}, - 'use_server_default': {'key': 'properties.useServerDefault', 'type': 'str'}, - 'redirection_state': {'key': 'properties.redirectionState', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlPoolConnectionPolicy, self).__init__(**kwargs) - self.kind = None - self.location = None - self.security_enabled_access = kwargs.get('security_enabled_access', None) - self.proxy_dns_name = kwargs.get('proxy_dns_name', None) - self.proxy_port = kwargs.get('proxy_port', None) - self.visibility = kwargs.get('visibility', None) - self.use_server_default = kwargs.get('use_server_default', None) - self.redirection_state = kwargs.get('redirection_state', None) - self.state = kwargs.get('state', None) - - -class SqlPoolInfoListResult(msrest.serialization.Model): - """List of SQL pools. - - :param next_link: Link to the next page of results. - :type next_link: str - :param value: List of SQL pools. - :type value: list[~azure.mgmt.synapse.models.SqlPool] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[SqlPool]'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlPoolInfoListResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) - - -class SqlPoolOperation(ProxyResource): - """A Sql pool operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar database_name: The name of the Sql pool the operation is being performed on. - :vartype database_name: str - :ivar operation: The name of operation. - :vartype operation: str - :ivar operation_friendly_name: The friendly name of operation. - :vartype operation_friendly_name: str - :ivar percent_complete: The percentage of the operation completed. - :vartype percent_complete: int - :ivar server_name: The name of the server. - :vartype server_name: str - :ivar start_time: The operation start time. - :vartype start_time: ~datetime.datetime - :ivar state: The operation state. Possible values include: "Pending", "InProgress", - "Succeeded", "Failed", "CancelInProgress", "Cancelled". - :vartype state: str or ~azure.mgmt.synapse.models.ManagementOperationState - :ivar error_code: The operation error code. - :vartype error_code: int - :ivar error_description: The operation error description. - :vartype error_description: str - :ivar error_severity: The operation error severity. - :vartype error_severity: int - :ivar is_user_error: Whether or not the error is a user error. - :vartype is_user_error: bool - :ivar estimated_completion_time: The estimated completion time of the operation. - :vartype estimated_completion_time: ~datetime.datetime - :ivar description: The operation description. - :vartype description: str - :ivar is_cancellable: Whether the operation can be cancelled. - :vartype is_cancellable: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'database_name': {'readonly': True}, - 'operation': {'readonly': True}, - 'operation_friendly_name': {'readonly': True}, - 'percent_complete': {'readonly': True}, - 'server_name': {'readonly': True}, - 'start_time': {'readonly': True}, - 'state': {'readonly': True}, - 'error_code': {'readonly': True}, - 'error_description': {'readonly': True}, - 'error_severity': {'readonly': True}, - 'is_user_error': {'readonly': True}, - 'estimated_completion_time': {'readonly': True}, - 'description': {'readonly': True}, - 'is_cancellable': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'database_name': {'key': 'properties.databaseName', 'type': 'str'}, - 'operation': {'key': 'properties.operation', 'type': 'str'}, - 'operation_friendly_name': {'key': 'properties.operationFriendlyName', 'type': 'str'}, - 'percent_complete': {'key': 'properties.percentComplete', 'type': 'int'}, - 'server_name': {'key': 'properties.serverName', 'type': 'str'}, - 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'error_code': {'key': 'properties.errorCode', 'type': 'int'}, - 'error_description': {'key': 'properties.errorDescription', 'type': 'str'}, - 'error_severity': {'key': 'properties.errorSeverity', 'type': 'int'}, - 'is_user_error': {'key': 'properties.isUserError', 'type': 'bool'}, - 'estimated_completion_time': {'key': 'properties.estimatedCompletionTime', 'type': 'iso-8601'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'is_cancellable': {'key': 'properties.isCancellable', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlPoolOperation, self).__init__(**kwargs) - self.database_name = None - self.operation = None - self.operation_friendly_name = None - self.percent_complete = None - self.server_name = None - self.start_time = None - self.state = None - self.error_code = None - self.error_description = None - self.error_severity = None - self.is_user_error = None - self.estimated_completion_time = None - self.description = None - self.is_cancellable = None - - -class SqlPoolPatchInfo(msrest.serialization.Model): - """A SQL Analytics pool patch info. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: The geo-location where the resource lives. - :type location: str - :param sku: SQL pool SKU. - :type sku: ~azure.mgmt.synapse.models.Sku - :param max_size_bytes: Maximum size in bytes. - :type max_size_bytes: long - :param collation: Collation mode. - :type collation: str - :param source_database_id: Source database to create from. - :type source_database_id: str - :param recoverable_database_id: Backup database to restore from. - :type recoverable_database_id: str - :param provisioning_state: Resource state. - :type provisioning_state: str - :param status: Resource status. - :type status: str - :param restore_point_in_time: Snapshot time to restore. - :type restore_point_in_time: ~datetime.datetime - :param create_mode: Specifies the mode of sql pool creation. - - Default: regular sql pool creation. - - PointInTimeRestore: Creates a sql pool by restoring a point in time backup of an existing sql - pool. sourceDatabaseId must be specified as the resource ID of the existing sql pool, and - restorePointInTime must be specified. - - Recovery: Creates a sql pool by a geo-replicated backup. sourceDatabaseId must be specified - as the recoverableDatabaseId to restore. - - Restore: Creates a sql pool by restoring a backup of a deleted sql pool. SourceDatabaseId - should be the sql pool's original resource ID. SourceDatabaseId and sourceDatabaseDeletionDate - must be specified. Possible values include: "Default", "PointInTimeRestore", "Recovery", - "Restore". - :type create_mode: str or ~azure.mgmt.synapse.models.CreateMode - :param creation_date: Date the SQL pool was created. - :type creation_date: ~datetime.datetime - :param storage_account_type: The storage account type used to store backups for this sql pool. - Possible values include: "GRS", "LRS", "ZRS". - :type storage_account_type: str or ~azure.mgmt.synapse.models.StorageAccountType - :param source_database_deletion_date: Specifies the time that the sql pool was deleted. - :type source_database_deletion_date: ~datetime.datetime - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'max_size_bytes': {'key': 'properties.maxSizeBytes', 'type': 'long'}, - 'collation': {'key': 'properties.collation', 'type': 'str'}, - 'source_database_id': {'key': 'properties.sourceDatabaseId', 'type': 'str'}, - 'recoverable_database_id': {'key': 'properties.recoverableDatabaseId', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'restore_point_in_time': {'key': 'properties.restorePointInTime', 'type': 'iso-8601'}, - 'create_mode': {'key': 'properties.createMode', 'type': 'str'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'storage_account_type': {'key': 'properties.storageAccountType', 'type': 'str'}, - 'source_database_deletion_date': {'key': 'properties.sourceDatabaseDeletionDate', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlPoolPatchInfo, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs.get('location', None) - self.sku = kwargs.get('sku', None) - self.max_size_bytes = kwargs.get('max_size_bytes', None) - self.collation = kwargs.get('collation', None) - self.source_database_id = kwargs.get('source_database_id', None) - self.recoverable_database_id = kwargs.get('recoverable_database_id', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.status = kwargs.get('status', None) - self.restore_point_in_time = kwargs.get('restore_point_in_time', None) - self.create_mode = kwargs.get('create_mode', None) - self.creation_date = kwargs.get('creation_date', None) - self.storage_account_type = kwargs.get('storage_account_type', None) - self.source_database_deletion_date = kwargs.get('source_database_deletion_date', None) - - -class SqlPoolSchema(ProxyResource): - """A Sql pool schema resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlPoolSchema, self).__init__(**kwargs) - - -class SqlPoolSchemaListResult(msrest.serialization.Model): - """A list of Sql pool schemas. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.synapse.models.SqlPoolSchema] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SqlPoolSchema]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlPoolSchemaListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SqlPoolSecurityAlertPolicy(ProxyResource): - """A Sql pool security alert policy. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param state: Specifies the state of the policy, whether it is enabled or disabled or a policy - has not been applied yet on the specific Sql pool. Possible values include: "New", "Enabled", - "Disabled". - :type state: str or ~azure.mgmt.synapse.models.SecurityAlertPolicyState - :param disabled_alerts: Specifies an array of alerts that are disabled. Allowed values are: - Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. - :type disabled_alerts: list[str] - :param email_addresses: Specifies an array of e-mail addresses to which the alert is sent. - :type email_addresses: list[str] - :param email_account_admins: Specifies that the alert is sent to the account administrators. - :type email_account_admins: bool - :param storage_endpoint: Specifies the blob storage endpoint (e.g. - https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection - audit logs. - :type storage_endpoint: str - :param storage_account_access_key: Specifies the identifier key of the Threat Detection audit - storage account. - :type storage_account_access_key: str - :param retention_days: Specifies the number of days to keep in the Threat Detection audit logs. - :type retention_days: int - :ivar creation_time: Specifies the UTC creation time of the policy. - :vartype creation_time: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'creation_time': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'disabled_alerts': {'key': 'properties.disabledAlerts', 'type': '[str]'}, - 'email_addresses': {'key': 'properties.emailAddresses', 'type': '[str]'}, - 'email_account_admins': {'key': 'properties.emailAccountAdmins', 'type': 'bool'}, - 'storage_endpoint': {'key': 'properties.storageEndpoint', 'type': 'str'}, - 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, - 'retention_days': {'key': 'properties.retentionDays', 'type': 'int'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlPoolSecurityAlertPolicy, self).__init__(**kwargs) - self.state = kwargs.get('state', None) - self.disabled_alerts = kwargs.get('disabled_alerts', None) - self.email_addresses = kwargs.get('email_addresses', None) - self.email_account_admins = kwargs.get('email_account_admins', None) - self.storage_endpoint = kwargs.get('storage_endpoint', None) - self.storage_account_access_key = kwargs.get('storage_account_access_key', None) - self.retention_days = kwargs.get('retention_days', None) - self.creation_time = None - - -class SqlPoolTable(ProxyResource): - """A Sql pool table resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlPoolTable, self).__init__(**kwargs) - - -class SqlPoolTableListResult(msrest.serialization.Model): - """A list of Sql pool tables. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.synapse.models.SqlPoolTable] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SqlPoolTable]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlPoolTableListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SqlPoolUsage(msrest.serialization.Model): - """The Sql pool usages. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the usage metric. - :vartype name: str - :ivar resource_name: The name of the resource. - :vartype resource_name: str - :ivar display_name: The usage metric display name. - :vartype display_name: str - :ivar current_value: The current value of the usage metric. - :vartype current_value: float - :ivar limit: The current limit of the usage metric. - :vartype limit: float - :ivar unit: The units of the usage metric. - :vartype unit: str - :ivar next_reset_time: The next reset time for the usage metric (ISO8601 format). - :vartype next_reset_time: ~datetime.datetime - """ - - _validation = { - 'name': {'readonly': True}, - 'resource_name': {'readonly': True}, - 'display_name': {'readonly': True}, - 'current_value': {'readonly': True}, - 'limit': {'readonly': True}, - 'unit': {'readonly': True}, - 'next_reset_time': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'resource_name': {'key': 'resourceName', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'current_value': {'key': 'currentValue', 'type': 'float'}, - 'limit': {'key': 'limit', 'type': 'float'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'next_reset_time': {'key': 'nextResetTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlPoolUsage, self).__init__(**kwargs) - self.name = None - self.resource_name = None - self.display_name = None - self.current_value = None - self.limit = None - self.unit = None - self.next_reset_time = None - - -class SqlPoolUsageListResult(msrest.serialization.Model): - """The response to a list Sql pool usages request. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of usages for the Sql pool. - :type value: list[~azure.mgmt.synapse.models.SqlPoolUsage] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SqlPoolUsage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlPoolUsageListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = None - - -class SqlPoolVulnerabilityAssessment(ProxyResource): - """A Sql pool vulnerability assessment. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param storage_container_path: A blob storage container path to hold the scan results (e.g. - https://myStorage.blob.core.windows.net/VaScans/). It is required if server level - vulnerability assessment policy doesn't set. - :type storage_container_path: str - :param storage_container_sas_key: A shared access signature (SAS Key) that has write access to - the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' - isn't specified, StorageContainerSasKey is required. - :type storage_container_sas_key: str - :param storage_account_access_key: Specifies the identifier key of the storage account for - vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, - storageAccountAccessKey is required. - :type storage_account_access_key: str - :param recurring_scans: The recurring scans settings. - :type recurring_scans: - ~azure.mgmt.synapse.models.VulnerabilityAssessmentRecurringScansProperties - """ - - _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'}, - 'storage_container_path': {'key': 'properties.storageContainerPath', 'type': 'str'}, - 'storage_container_sas_key': {'key': 'properties.storageContainerSasKey', 'type': 'str'}, - 'storage_account_access_key': {'key': 'properties.storageAccountAccessKey', 'type': 'str'}, - 'recurring_scans': {'key': 'properties.recurringScans', 'type': 'VulnerabilityAssessmentRecurringScansProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlPoolVulnerabilityAssessment, self).__init__(**kwargs) - self.storage_container_path = kwargs.get('storage_container_path', None) - self.storage_container_sas_key = kwargs.get('storage_container_sas_key', None) - self.storage_account_access_key = kwargs.get('storage_account_access_key', None) - self.recurring_scans = kwargs.get('recurring_scans', None) - - -class SqlPoolVulnerabilityAssessmentListResult(msrest.serialization.Model): - """A list of the Sql pool's vulnerability assessments. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessment] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SqlPoolVulnerabilityAssessment]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlPoolVulnerabilityAssessmentListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SqlPoolVulnerabilityAssessmentRuleBaseline(ProxyResource): - """A Sql pool vulnerability assessment rule baseline. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param baseline_results: The rule baseline result. - :type baseline_results: - list[~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessmentRuleBaselineItem] - """ - - _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'}, - 'baseline_results': {'key': 'properties.baselineResults', 'type': '[SqlPoolVulnerabilityAssessmentRuleBaselineItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlPoolVulnerabilityAssessmentRuleBaseline, self).__init__(**kwargs) - self.baseline_results = kwargs.get('baseline_results', None) - - -class SqlPoolVulnerabilityAssessmentRuleBaselineItem(msrest.serialization.Model): - """Properties for an Sql pool vulnerability assessment rule baseline's result. - - All required parameters must be populated in order to send to Azure. - - :param result: Required. The rule baseline result. - :type result: list[str] - """ - - _validation = { - 'result': {'required': True}, - } - - _attribute_map = { - 'result': {'key': 'result', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlPoolVulnerabilityAssessmentRuleBaselineItem, self).__init__(**kwargs) - self.result = kwargs['result'] - - -class SqlPoolVulnerabilityAssessmentScansExport(ProxyResource): - """A Sql pool Vulnerability Assessment scan export resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar exported_report_location: Location of the exported report (e.g. - https://myStorage.blob.core.windows.net/VaScans/scans/serverName/databaseName/scan_scanId.xlsx). - :vartype exported_report_location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'exported_report_location': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'exported_report_location': {'key': 'properties.exportedReportLocation', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SqlPoolVulnerabilityAssessmentScansExport, self).__init__(**kwargs) - self.exported_report_location = None - - -class SsisObjectMetadata(msrest.serialization.Model): - """SSIS object metadata. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: SsisEnvironment, SsisFolder, SsisPackage, SsisProject. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Type of metadata.Constant filled by server. Possible values include: - "Folder", "Project", "Package", "Environment". - :type type: str or ~azure.mgmt.synapse.models.SsisObjectMetadataType - :param id: Metadata id. - :type id: long - :param name: Metadata name. - :type name: str - :param description: Metadata description. - :type description: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'long'}, - 'name': {'key': 'name', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'Environment': 'SsisEnvironment', 'Folder': 'SsisFolder', 'Package': 'SsisPackage', 'Project': 'SsisProject'} - } - - def __init__( - self, - **kwargs - ): - super(SsisObjectMetadata, self).__init__(**kwargs) - self.type = None # type: Optional[str] - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.description = kwargs.get('description', None) - - -class SsisEnvironment(SsisObjectMetadata): - """Ssis environment. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Type of metadata.Constant filled by server. Possible values include: - "Folder", "Project", "Package", "Environment". - :type type: str or ~azure.mgmt.synapse.models.SsisObjectMetadataType - :param id: Metadata id. - :type id: long - :param name: Metadata name. - :type name: str - :param description: Metadata description. - :type description: str - :param folder_id: Folder id which contains environment. - :type folder_id: long - :param variables: Variable in environment. - :type variables: list[~azure.mgmt.synapse.models.SsisVariable] - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'long'}, - 'name': {'key': 'name', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'folder_id': {'key': 'folderId', 'type': 'long'}, - 'variables': {'key': 'variables', 'type': '[SsisVariable]'}, - } - - def __init__( - self, - **kwargs - ): - super(SsisEnvironment, self).__init__(**kwargs) - self.type = 'Environment' # type: str - self.folder_id = kwargs.get('folder_id', None) - self.variables = kwargs.get('variables', None) - - -class SsisEnvironmentReference(msrest.serialization.Model): - """Ssis environment reference. - - :param id: Environment reference id. - :type id: long - :param environment_folder_name: Environment folder name. - :type environment_folder_name: str - :param environment_name: Environment name. - :type environment_name: str - :param reference_type: Reference type. - :type reference_type: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'long'}, - 'environment_folder_name': {'key': 'environmentFolderName', 'type': 'str'}, - 'environment_name': {'key': 'environmentName', 'type': 'str'}, - 'reference_type': {'key': 'referenceType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SsisEnvironmentReference, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.environment_folder_name = kwargs.get('environment_folder_name', None) - self.environment_name = kwargs.get('environment_name', None) - self.reference_type = kwargs.get('reference_type', None) - - -class SsisFolder(SsisObjectMetadata): - """Ssis folder. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Type of metadata.Constant filled by server. Possible values include: - "Folder", "Project", "Package", "Environment". - :type type: str or ~azure.mgmt.synapse.models.SsisObjectMetadataType - :param id: Metadata id. - :type id: long - :param name: Metadata name. - :type name: str - :param description: Metadata description. - :type description: str - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'long'}, - 'name': {'key': 'name', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SsisFolder, self).__init__(**kwargs) - self.type = 'Folder' # type: str - - -class SsisObjectMetadataListResponse(msrest.serialization.Model): - """A list of SSIS object metadata. - - :param value: List of SSIS object metadata. - :type value: list[~azure.mgmt.synapse.models.SsisObjectMetadata] - :param next_link: The link to the next page of results, if any remaining results exist. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SsisObjectMetadata]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SsisObjectMetadataListResponse, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class SsisObjectMetadataStatusResponse(msrest.serialization.Model): - """The status of the operation. - - :param status: The status of the operation. - :type status: str - :param name: The operation name. - :type name: str - :param properties: The operation properties. - :type properties: str - :param error: The operation error message. - :type error: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'str'}, - 'error': {'key': 'error', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SsisObjectMetadataStatusResponse, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.name = kwargs.get('name', None) - self.properties = kwargs.get('properties', None) - self.error = kwargs.get('error', None) - - -class SsisPackage(SsisObjectMetadata): - """Ssis Package. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Type of metadata.Constant filled by server. Possible values include: - "Folder", "Project", "Package", "Environment". - :type type: str or ~azure.mgmt.synapse.models.SsisObjectMetadataType - :param id: Metadata id. - :type id: long - :param name: Metadata name. - :type name: str - :param description: Metadata description. - :type description: str - :param folder_id: Folder id which contains package. - :type folder_id: long - :param project_version: Project version which contains package. - :type project_version: long - :param project_id: Project id which contains package. - :type project_id: long - :param parameters: Parameters in package. - :type parameters: list[~azure.mgmt.synapse.models.SsisParameter] - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'long'}, - 'name': {'key': 'name', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'folder_id': {'key': 'folderId', 'type': 'long'}, - 'project_version': {'key': 'projectVersion', 'type': 'long'}, - 'project_id': {'key': 'projectId', 'type': 'long'}, - 'parameters': {'key': 'parameters', 'type': '[SsisParameter]'}, - } - - def __init__( - self, - **kwargs - ): - super(SsisPackage, self).__init__(**kwargs) - self.type = 'Package' # type: str - self.folder_id = kwargs.get('folder_id', None) - self.project_version = kwargs.get('project_version', None) - self.project_id = kwargs.get('project_id', None) - self.parameters = kwargs.get('parameters', None) - - -class SsisParameter(msrest.serialization.Model): - """Ssis parameter. - - :param id: Parameter id. - :type id: long - :param name: Parameter name. - :type name: str - :param description: Parameter description. - :type description: str - :param data_type: Parameter type. - :type data_type: str - :param required: Whether parameter is required. - :type required: bool - :param sensitive: Whether parameter is sensitive. - :type sensitive: bool - :param design_default_value: Design default value of parameter. - :type design_default_value: str - :param default_value: Default value of parameter. - :type default_value: str - :param sensitive_default_value: Default sensitive value of parameter. - :type sensitive_default_value: str - :param value_type: Parameter value type. - :type value_type: str - :param value_set: Parameter value set. - :type value_set: bool - :param variable: Parameter reference variable. - :type variable: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'long'}, - 'name': {'key': 'name', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'data_type': {'key': 'dataType', 'type': 'str'}, - 'required': {'key': 'required', 'type': 'bool'}, - 'sensitive': {'key': 'sensitive', 'type': 'bool'}, - 'design_default_value': {'key': 'designDefaultValue', 'type': 'str'}, - 'default_value': {'key': 'defaultValue', 'type': 'str'}, - 'sensitive_default_value': {'key': 'sensitiveDefaultValue', 'type': 'str'}, - 'value_type': {'key': 'valueType', 'type': 'str'}, - 'value_set': {'key': 'valueSet', 'type': 'bool'}, - 'variable': {'key': 'variable', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SsisParameter, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.description = kwargs.get('description', None) - self.data_type = kwargs.get('data_type', None) - self.required = kwargs.get('required', None) - self.sensitive = kwargs.get('sensitive', None) - self.design_default_value = kwargs.get('design_default_value', None) - self.default_value = kwargs.get('default_value', None) - self.sensitive_default_value = kwargs.get('sensitive_default_value', None) - self.value_type = kwargs.get('value_type', None) - self.value_set = kwargs.get('value_set', None) - self.variable = kwargs.get('variable', None) - - -class SsisProject(SsisObjectMetadata): - """Ssis project. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Type of metadata.Constant filled by server. Possible values include: - "Folder", "Project", "Package", "Environment". - :type type: str or ~azure.mgmt.synapse.models.SsisObjectMetadataType - :param id: Metadata id. - :type id: long - :param name: Metadata name. - :type name: str - :param description: Metadata description. - :type description: str - :param folder_id: Folder id which contains project. - :type folder_id: long - :param version: Project version. - :type version: long - :param environment_refs: Environment reference in project. - :type environment_refs: list[~azure.mgmt.synapse.models.SsisEnvironmentReference] - :param parameters: Parameters in project. - :type parameters: list[~azure.mgmt.synapse.models.SsisParameter] - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'long'}, - 'name': {'key': 'name', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'folder_id': {'key': 'folderId', 'type': 'long'}, - 'version': {'key': 'version', 'type': 'long'}, - 'environment_refs': {'key': 'environmentRefs', 'type': '[SsisEnvironmentReference]'}, - 'parameters': {'key': 'parameters', 'type': '[SsisParameter]'}, - } - - def __init__( - self, - **kwargs - ): - super(SsisProject, self).__init__(**kwargs) - self.type = 'Project' # type: str - self.folder_id = kwargs.get('folder_id', None) - self.version = kwargs.get('version', None) - self.environment_refs = kwargs.get('environment_refs', None) - self.parameters = kwargs.get('parameters', None) - - -class SsisVariable(msrest.serialization.Model): - """Ssis variable. - - :param id: Variable id. - :type id: long - :param name: Variable name. - :type name: str - :param description: Variable description. - :type description: str - :param data_type: Variable type. - :type data_type: str - :param sensitive: Whether variable is sensitive. - :type sensitive: bool - :param value: Variable value. - :type value: str - :param sensitive_value: Variable sensitive value. - :type sensitive_value: str - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'long'}, - 'name': {'key': 'name', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'data_type': {'key': 'dataType', 'type': 'str'}, - 'sensitive': {'key': 'sensitive', 'type': 'bool'}, - 'value': {'key': 'value', 'type': 'str'}, - 'sensitive_value': {'key': 'sensitiveValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SsisVariable, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.description = kwargs.get('description', None) - self.data_type = kwargs.get('data_type', None) - self.sensitive = kwargs.get('sensitive', None) - self.value = kwargs.get('value', None) - self.sensitive_value = kwargs.get('sensitive_value', None) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.synapse.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.synapse.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class TableLevelSharingProperties(msrest.serialization.Model): - """Tables that will be included and excluded in the follower database. - - :param tables_to_include: List of tables to include in the follower database. - :type tables_to_include: list[str] - :param tables_to_exclude: List of tables to exclude from the follower database. - :type tables_to_exclude: list[str] - :param external_tables_to_include: List of external tables to include in the follower database. - :type external_tables_to_include: list[str] - :param external_tables_to_exclude: List of external tables exclude from the follower database. - :type external_tables_to_exclude: list[str] - :param materialized_views_to_include: List of materialized views to include in the follower - database. - :type materialized_views_to_include: list[str] - :param materialized_views_to_exclude: List of materialized views exclude from the follower - database. - :type materialized_views_to_exclude: list[str] - """ - - _attribute_map = { - 'tables_to_include': {'key': 'tablesToInclude', 'type': '[str]'}, - 'tables_to_exclude': {'key': 'tablesToExclude', 'type': '[str]'}, - 'external_tables_to_include': {'key': 'externalTablesToInclude', 'type': '[str]'}, - 'external_tables_to_exclude': {'key': 'externalTablesToExclude', 'type': '[str]'}, - 'materialized_views_to_include': {'key': 'materializedViewsToInclude', 'type': '[str]'}, - 'materialized_views_to_exclude': {'key': 'materializedViewsToExclude', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(TableLevelSharingProperties, self).__init__(**kwargs) - self.tables_to_include = kwargs.get('tables_to_include', None) - self.tables_to_exclude = kwargs.get('tables_to_exclude', None) - self.external_tables_to_include = kwargs.get('external_tables_to_include', None) - self.external_tables_to_exclude = kwargs.get('external_tables_to_exclude', None) - self.materialized_views_to_include = kwargs.get('materialized_views_to_include', None) - self.materialized_views_to_exclude = kwargs.get('materialized_views_to_exclude', None) - - -class TopQueries(msrest.serialization.Model): - """A database query. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar aggregation_function: The function that is used to aggregate each query's metrics. - Possible values include: "min", "max", "avg", "sum". - :vartype aggregation_function: str or ~azure.mgmt.synapse.models.QueryAggregationFunction - :ivar execution_type: The execution type that is used to filter the query instances that are - returned. Possible values include: "any", "regular", "irregular", "aborted", "exception". - :vartype execution_type: str or ~azure.mgmt.synapse.models.QueryExecutionType - :ivar interval_type: The duration of the interval (ISO8601 duration format). - :vartype interval_type: str - :ivar number_of_top_queries: The number of requested queries. - :vartype number_of_top_queries: int - :ivar observation_start_time: The start time for queries that are returned (ISO8601 format). - :vartype observation_start_time: ~datetime.datetime - :ivar observation_end_time: The end time for queries that are returned (ISO8601 format). - :vartype observation_end_time: ~datetime.datetime - :ivar observed_metric: The type of metric to use for ordering the top metrics. Possible values - include: "cpu", "io", "logio", "duration", "executionCount". - :vartype observed_metric: str or ~azure.mgmt.synapse.models.QueryObservedMetricType - :ivar queries: The list of queries. - :vartype queries: list[~azure.mgmt.synapse.models.QueryStatistic] - """ - - _validation = { - 'aggregation_function': {'readonly': True}, - 'execution_type': {'readonly': True}, - 'interval_type': {'readonly': True}, - 'number_of_top_queries': {'readonly': True}, - 'observation_start_time': {'readonly': True}, - 'observation_end_time': {'readonly': True}, - 'observed_metric': {'readonly': True}, - 'queries': {'readonly': True}, - } - - _attribute_map = { - 'aggregation_function': {'key': 'aggregationFunction', 'type': 'str'}, - 'execution_type': {'key': 'executionType', 'type': 'str'}, - 'interval_type': {'key': 'intervalType', 'type': 'str'}, - 'number_of_top_queries': {'key': 'numberOfTopQueries', 'type': 'int'}, - 'observation_start_time': {'key': 'observationStartTime', 'type': 'iso-8601'}, - 'observation_end_time': {'key': 'observationEndTime', 'type': 'iso-8601'}, - 'observed_metric': {'key': 'observedMetric', 'type': 'str'}, - 'queries': {'key': 'queries', 'type': '[QueryStatistic]'}, - } - - def __init__( - self, - **kwargs - ): - super(TopQueries, self).__init__(**kwargs) - self.aggregation_function = None - self.execution_type = None - self.interval_type = None - self.number_of_top_queries = None - self.observation_start_time = None - self.observation_end_time = None - self.observed_metric = None - self.queries = None - - -class TopQueriesListResult(msrest.serialization.Model): - """Represents the response to a get top queries request. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The list of top queries. - :type value: list[~azure.mgmt.synapse.models.TopQueries] - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[TopQueries]'}, - } - - def __init__( - self, - **kwargs - ): - super(TopQueriesListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - - -class TransparentDataEncryption(ProxyResource): - """Represents a Sql pool transparent data encryption configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar location: Resource location. - :vartype location: str - :param status: The status of the database transparent data encryption. Possible values include: - "Enabled", "Disabled". - :type status: str or ~azure.mgmt.synapse.models.TransparentDataEncryptionStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TransparentDataEncryption, self).__init__(**kwargs) - self.location = None - self.status = kwargs.get('status', None) - - -class TransparentDataEncryptionListResult(msrest.serialization.Model): - """A list of transparent data encryption configurations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.synapse.models.TransparentDataEncryption] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[TransparentDataEncryption]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TransparentDataEncryptionListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class UpdateIntegrationRuntimeNodeRequest(msrest.serialization.Model): - """Update integration runtime node request. - - :param concurrent_jobs_limit: The number of concurrent jobs permitted to run on the integration - runtime node. Values between 1 and maxConcurrentJobs(inclusive) are allowed. - :type concurrent_jobs_limit: int - """ - - _validation = { - 'concurrent_jobs_limit': {'minimum': 1}, - } - - _attribute_map = { - 'concurrent_jobs_limit': {'key': 'concurrentJobsLimit', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateIntegrationRuntimeNodeRequest, self).__init__(**kwargs) - self.concurrent_jobs_limit = kwargs.get('concurrent_jobs_limit', None) - - -class UpdateIntegrationRuntimeRequest(msrest.serialization.Model): - """Update integration runtime request. - - :param auto_update: Enables or disables the auto-update feature of the self-hosted integration - runtime. See https://go.microsoft.com/fwlink/?linkid=854189. Possible values include: "On", - "Off". - :type auto_update: str or ~azure.mgmt.synapse.models.IntegrationRuntimeAutoUpdate - :param update_delay_offset: The time offset (in hours) in the day, e.g., PT03H is 3 hours. The - integration runtime auto update will happen on that time. - :type update_delay_offset: str - """ - - _attribute_map = { - 'auto_update': {'key': 'autoUpdate', 'type': 'str'}, - 'update_delay_offset': {'key': 'updateDelayOffset', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpdateIntegrationRuntimeRequest, self).__init__(**kwargs) - self.auto_update = kwargs.get('auto_update', None) - self.update_delay_offset = kwargs.get('update_delay_offset', None) - - -class UserAssignedManagedIdentity(msrest.serialization.Model): - """User Assigned Managed Identity. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar client_id: The client ID. - :vartype client_id: str - :ivar principal_id: The principal ID. - :vartype principal_id: str - """ - - _validation = { - 'client_id': {'readonly': True}, - 'principal_id': {'readonly': True}, - } - - _attribute_map = { - 'client_id': {'key': 'clientId', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserAssignedManagedIdentity, self).__init__(**kwargs) - self.client_id = None - self.principal_id = None - - -class VirtualNetworkProfile(msrest.serialization.Model): - """Virtual Network Profile. - - :param compute_subnet_id: Subnet ID used for computes in workspace. - :type compute_subnet_id: str - """ - - _attribute_map = { - 'compute_subnet_id': {'key': 'computeSubnetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkProfile, self).__init__(**kwargs) - self.compute_subnet_id = kwargs.get('compute_subnet_id', None) - - -class VulnerabilityAssessmentRecurringScansProperties(msrest.serialization.Model): - """Properties of a Vulnerability Assessment recurring scans. - - :param is_enabled: Recurring scans state. - :type is_enabled: bool - :param email_subscription_admins: Specifies that the schedule scan notification will be is sent - to the subscription administrators. - :type email_subscription_admins: bool - :param emails: Specifies an array of e-mail addresses to which the scan notification is sent. - :type emails: list[str] - """ - - _attribute_map = { - 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, - 'email_subscription_admins': {'key': 'emailSubscriptionAdmins', 'type': 'bool'}, - 'emails': {'key': 'emails', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(VulnerabilityAssessmentRecurringScansProperties, self).__init__(**kwargs) - self.is_enabled = kwargs.get('is_enabled', None) - self.email_subscription_admins = kwargs.get('email_subscription_admins', True) - self.emails = kwargs.get('emails', None) - - -class VulnerabilityAssessmentScanError(msrest.serialization.Model): - """Properties of a vulnerability assessment scan error. - - 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 - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VulnerabilityAssessmentScanError, self).__init__(**kwargs) - self.code = None - self.message = None - - -class VulnerabilityAssessmentScanRecord(ProxyResource): - """A vulnerability assessment scan record. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar scan_id: The scan ID. - :vartype scan_id: str - :ivar trigger_type: The scan trigger type. Possible values include: "OnDemand", "Recurring". - :vartype trigger_type: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentScanTriggerType - :ivar state: The scan status. Possible values include: "Passed", "Failed", "FailedToRun", - "InProgress". - :vartype state: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentScanState - :ivar start_time: The scan start time (UTC). - :vartype start_time: ~datetime.datetime - :ivar end_time: The scan end time (UTC). - :vartype end_time: ~datetime.datetime - :ivar errors: The scan errors. - :vartype errors: list[~azure.mgmt.synapse.models.VulnerabilityAssessmentScanError] - :ivar storage_container_path: The scan results storage container path. - :vartype storage_container_path: str - :ivar number_of_failed_security_checks: The number of failed security checks. - :vartype number_of_failed_security_checks: int - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'scan_id': {'readonly': True}, - 'trigger_type': {'readonly': True}, - 'state': {'readonly': True}, - 'start_time': {'readonly': True}, - 'end_time': {'readonly': True}, - 'errors': {'readonly': True}, - 'storage_container_path': {'readonly': True}, - 'number_of_failed_security_checks': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'scan_id': {'key': 'properties.scanId', 'type': 'str'}, - 'trigger_type': {'key': 'properties.triggerType', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'}, - 'errors': {'key': 'properties.errors', 'type': '[VulnerabilityAssessmentScanError]'}, - 'storage_container_path': {'key': 'properties.storageContainerPath', 'type': 'str'}, - 'number_of_failed_security_checks': {'key': 'properties.numberOfFailedSecurityChecks', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(VulnerabilityAssessmentScanRecord, self).__init__(**kwargs) - self.scan_id = None - self.trigger_type = None - self.state = None - self.start_time = None - self.end_time = None - self.errors = None - self.storage_container_path = None - self.number_of_failed_security_checks = None - - -class VulnerabilityAssessmentScanRecordListResult(msrest.serialization.Model): - """A list of vulnerability assessment scan records. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.synapse.models.VulnerabilityAssessmentScanRecord] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VulnerabilityAssessmentScanRecord]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VulnerabilityAssessmentScanRecordListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class WorkloadClassifier(ProxyResource): - """Workload classifier operations for a data warehouse. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param member_name: The workload classifier member name. - :type member_name: str - :param label: The workload classifier label. - :type label: str - :param context: The workload classifier context. - :type context: str - :param start_time: The workload classifier start time for classification. - :type start_time: str - :param end_time: The workload classifier end time for classification. - :type end_time: str - :param importance: The workload classifier importance. - :type importance: 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'}, - 'member_name': {'key': 'properties.memberName', 'type': 'str'}, - 'label': {'key': 'properties.label', 'type': 'str'}, - 'context': {'key': 'properties.context', 'type': 'str'}, - 'start_time': {'key': 'properties.startTime', 'type': 'str'}, - 'end_time': {'key': 'properties.endTime', 'type': 'str'}, - 'importance': {'key': 'properties.importance', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadClassifier, self).__init__(**kwargs) - self.member_name = kwargs.get('member_name', None) - self.label = kwargs.get('label', None) - self.context = kwargs.get('context', None) - self.start_time = kwargs.get('start_time', None) - self.end_time = kwargs.get('end_time', None) - self.importance = kwargs.get('importance', None) - - -class WorkloadClassifierListResult(msrest.serialization.Model): - """A list of workload classifiers for a workload group. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.synapse.models.WorkloadClassifier] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[WorkloadClassifier]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadClassifierListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class WorkloadGroup(ProxyResource): - """Workload group operations for a sql pool. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param min_resource_percent: The workload group minimum percentage resource. - :type min_resource_percent: int - :param max_resource_percent: The workload group cap percentage resource. - :type max_resource_percent: int - :param min_resource_percent_per_request: The workload group request minimum grant percentage. - :type min_resource_percent_per_request: float - :param max_resource_percent_per_request: The workload group request maximum grant percentage. - :type max_resource_percent_per_request: float - :param importance: The workload group importance level. - :type importance: str - :param query_execution_timeout: The workload group query execution timeout. - :type query_execution_timeout: int - """ - - _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'}, - 'min_resource_percent': {'key': 'properties.minResourcePercent', 'type': 'int'}, - 'max_resource_percent': {'key': 'properties.maxResourcePercent', 'type': 'int'}, - 'min_resource_percent_per_request': {'key': 'properties.minResourcePercentPerRequest', 'type': 'float'}, - 'max_resource_percent_per_request': {'key': 'properties.maxResourcePercentPerRequest', 'type': 'float'}, - 'importance': {'key': 'properties.importance', 'type': 'str'}, - 'query_execution_timeout': {'key': 'properties.queryExecutionTimeout', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadGroup, self).__init__(**kwargs) - self.min_resource_percent = kwargs.get('min_resource_percent', None) - self.max_resource_percent = kwargs.get('max_resource_percent', None) - self.min_resource_percent_per_request = kwargs.get('min_resource_percent_per_request', None) - self.max_resource_percent_per_request = kwargs.get('max_resource_percent_per_request', None) - self.importance = kwargs.get('importance', None) - self.query_execution_timeout = kwargs.get('query_execution_timeout', None) - - -class WorkloadGroupListResult(msrest.serialization.Model): - """A list of workload groups. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.synapse.models.WorkloadGroup] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[WorkloadGroup]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkloadGroupListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class Workspace(TrackedResource): - """A workspace. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param identity: Identity of the workspace. - :type identity: ~azure.mgmt.synapse.models.ManagedIdentity - :param default_data_lake_storage: Workspace default data lake storage account details. - :type default_data_lake_storage: ~azure.mgmt.synapse.models.DataLakeStorageAccountDetails - :param sql_administrator_login_password: SQL administrator login password. - :type sql_administrator_login_password: str - :param managed_resource_group_name: Workspace managed resource group. The resource group name - uniquely identifies the resource group within the user subscriptionId. The resource group name - must be no longer than 90 characters long, and must be alphanumeric characters - (Char.IsLetterOrDigit()) and '-', '_', '(', ')' and'.'. Note that the name cannot end with '.'. - :type managed_resource_group_name: str - :ivar provisioning_state: Resource provisioning state. - :vartype provisioning_state: str - :param sql_administrator_login: Login for workspace SQL active directory administrator. - :type sql_administrator_login: str - :param virtual_network_profile: Virtual Network profile. - :type virtual_network_profile: ~azure.mgmt.synapse.models.VirtualNetworkProfile - :param connectivity_endpoints: Connectivity endpoints. - :type connectivity_endpoints: dict[str, str] - :param managed_virtual_network: Setting this to 'default' will ensure that all compute for this - workspace is in a virtual network managed on behalf of the user. - :type managed_virtual_network: str - :param private_endpoint_connections: Private endpoint connections to the workspace. - :type private_endpoint_connections: list[~azure.mgmt.synapse.models.PrivateEndpointConnection] - :param encryption: The encryption details of the workspace. - :type encryption: ~azure.mgmt.synapse.models.EncryptionDetails - :ivar workspace_uid: The workspace unique identifier. - :vartype workspace_uid: str - :ivar extra_properties: Workspace level configs and feature flags. - :vartype extra_properties: dict[str, any] - :param managed_virtual_network_settings: Managed Virtual Network Settings. - :type managed_virtual_network_settings: - ~azure.mgmt.synapse.models.ManagedVirtualNetworkSettings - :param workspace_repository_configuration: Git integration settings. - :type workspace_repository_configuration: - ~azure.mgmt.synapse.models.WorkspaceRepositoryConfiguration - :param purview_configuration: Purview Configuration. - :type purview_configuration: ~azure.mgmt.synapse.models.PurviewConfiguration - :ivar adla_resource_id: The ADLA resource ID. - :vartype adla_resource_id: str - :param public_network_access: Enable or Disable public network access to workspace. Possible - values include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.synapse.models.WorkspacePublicNetworkAccess - :param csp_workspace_admin_properties: Initial workspace AAD admin properties for a CSP - subscription. - :type csp_workspace_admin_properties: ~azure.mgmt.synapse.models.CspWorkspaceAdminProperties - :ivar settings: Workspace settings. - :vartype settings: dict[str, any] - :param azure_ad_only_authentication: Enable or Disable AzureADOnlyAuthentication on All - Workspace subresource. - :type azure_ad_only_authentication: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'workspace_uid': {'readonly': True}, - 'extra_properties': {'readonly': True}, - 'adla_resource_id': {'readonly': True}, - 'settings': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, - 'default_data_lake_storage': {'key': 'properties.defaultDataLakeStorage', 'type': 'DataLakeStorageAccountDetails'}, - 'sql_administrator_login_password': {'key': 'properties.sqlAdministratorLoginPassword', 'type': 'str'}, - 'managed_resource_group_name': {'key': 'properties.managedResourceGroupName', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'sql_administrator_login': {'key': 'properties.sqlAdministratorLogin', 'type': 'str'}, - 'virtual_network_profile': {'key': 'properties.virtualNetworkProfile', 'type': 'VirtualNetworkProfile'}, - 'connectivity_endpoints': {'key': 'properties.connectivityEndpoints', 'type': '{str}'}, - 'managed_virtual_network': {'key': 'properties.managedVirtualNetwork', 'type': 'str'}, - 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionDetails'}, - 'workspace_uid': {'key': 'properties.workspaceUID', 'type': 'str'}, - 'extra_properties': {'key': 'properties.extraProperties', 'type': '{object}'}, - 'managed_virtual_network_settings': {'key': 'properties.managedVirtualNetworkSettings', 'type': 'ManagedVirtualNetworkSettings'}, - 'workspace_repository_configuration': {'key': 'properties.workspaceRepositoryConfiguration', 'type': 'WorkspaceRepositoryConfiguration'}, - 'purview_configuration': {'key': 'properties.purviewConfiguration', 'type': 'PurviewConfiguration'}, - 'adla_resource_id': {'key': 'properties.adlaResourceId', 'type': 'str'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'csp_workspace_admin_properties': {'key': 'properties.cspWorkspaceAdminProperties', 'type': 'CspWorkspaceAdminProperties'}, - 'settings': {'key': 'properties.settings', 'type': '{object}'}, - 'azure_ad_only_authentication': {'key': 'properties.azureADOnlyAuthentication', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Workspace, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.default_data_lake_storage = kwargs.get('default_data_lake_storage', None) - self.sql_administrator_login_password = kwargs.get('sql_administrator_login_password', None) - self.managed_resource_group_name = kwargs.get('managed_resource_group_name', None) - self.provisioning_state = None - self.sql_administrator_login = kwargs.get('sql_administrator_login', None) - self.virtual_network_profile = kwargs.get('virtual_network_profile', None) - self.connectivity_endpoints = kwargs.get('connectivity_endpoints', None) - self.managed_virtual_network = kwargs.get('managed_virtual_network', None) - self.private_endpoint_connections = kwargs.get('private_endpoint_connections', None) - self.encryption = kwargs.get('encryption', None) - self.workspace_uid = None - self.extra_properties = None - self.managed_virtual_network_settings = kwargs.get('managed_virtual_network_settings', None) - self.workspace_repository_configuration = kwargs.get('workspace_repository_configuration', None) - self.purview_configuration = kwargs.get('purview_configuration', None) - self.adla_resource_id = None - self.public_network_access = kwargs.get('public_network_access', None) - self.csp_workspace_admin_properties = kwargs.get('csp_workspace_admin_properties', None) - self.settings = None - self.azure_ad_only_authentication = kwargs.get('azure_ad_only_authentication', None) - - -class WorkspaceAadAdminInfo(ProxyResource): - """Workspace active directory administrator. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tenant_id: Tenant ID of the workspace active directory administrator. - :type tenant_id: str - :param login: Login of the workspace active directory administrator. - :type login: str - :param administrator_type: Workspace active directory administrator type. - :type administrator_type: str - :param sid: Object ID of the workspace active directory administrator. - :type sid: 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'}, - 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, - 'login': {'key': 'properties.login', 'type': 'str'}, - 'administrator_type': {'key': 'properties.administratorType', 'type': 'str'}, - 'sid': {'key': 'properties.sid', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkspaceAadAdminInfo, self).__init__(**kwargs) - self.tenant_id = kwargs.get('tenant_id', None) - self.login = kwargs.get('login', None) - self.administrator_type = kwargs.get('administrator_type', None) - self.sid = kwargs.get('sid', None) - - -class WorkspaceInfoListResult(msrest.serialization.Model): - """List of workspaces. - - :param next_link: Link to the next page of results. - :type next_link: str - :param value: List of workspaces. - :type value: list[~azure.mgmt.synapse.models.Workspace] - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[Workspace]'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkspaceInfoListResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) - - -class WorkspaceKeyDetails(msrest.serialization.Model): - """Details of the customer managed key associated with the workspace. - - :param name: Workspace Key sub-resource name. - :type name: str - :param key_vault_url: Workspace Key sub-resource key vault url. - :type key_vault_url: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'key_vault_url': {'key': 'keyVaultUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkspaceKeyDetails, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.key_vault_url = kwargs.get('key_vault_url', None) - - -class WorkspacePatchInfo(msrest.serialization.Model): - """Workspace patch details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param identity: The identity of the workspace. - :type identity: ~azure.mgmt.synapse.models.ManagedIdentity - :param sql_administrator_login_password: SQL administrator login password. - :type sql_administrator_login_password: str - :param managed_virtual_network_settings: Managed Virtual Network Settings. - :type managed_virtual_network_settings: - ~azure.mgmt.synapse.models.ManagedVirtualNetworkSettings - :param workspace_repository_configuration: Git integration settings. - :type workspace_repository_configuration: - ~azure.mgmt.synapse.models.WorkspaceRepositoryConfiguration - :param purview_configuration: Purview Configuration. - :type purview_configuration: ~azure.mgmt.synapse.models.PurviewConfiguration - :ivar provisioning_state: Resource provisioning state. - :vartype provisioning_state: str - :param encryption: The encryption details of the workspace. - :type encryption: ~azure.mgmt.synapse.models.EncryptionDetails - :param public_network_access: Enable or Disable public network access to workspace. Possible - values include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.synapse.models.WorkspacePublicNetworkAccess - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, - 'sql_administrator_login_password': {'key': 'properties.sqlAdministratorLoginPassword', 'type': 'str'}, - 'managed_virtual_network_settings': {'key': 'properties.managedVirtualNetworkSettings', 'type': 'ManagedVirtualNetworkSettings'}, - 'workspace_repository_configuration': {'key': 'properties.workspaceRepositoryConfiguration', 'type': 'WorkspaceRepositoryConfiguration'}, - 'purview_configuration': {'key': 'properties.purviewConfiguration', 'type': 'PurviewConfiguration'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'encryption': {'key': 'properties.encryption', 'type': 'EncryptionDetails'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkspacePatchInfo, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.sql_administrator_login_password = kwargs.get('sql_administrator_login_password', None) - self.managed_virtual_network_settings = kwargs.get('managed_virtual_network_settings', None) - self.workspace_repository_configuration = kwargs.get('workspace_repository_configuration', None) - self.purview_configuration = kwargs.get('purview_configuration', None) - self.provisioning_state = None - self.encryption = kwargs.get('encryption', None) - self.public_network_access = kwargs.get('public_network_access', None) - - -class WorkspaceRepositoryConfiguration(msrest.serialization.Model): - """Git integration settings. - - :param type: Type of workspace repositoryID configuration. Example WorkspaceVSTSConfiguration, - WorkspaceGitHubConfiguration. - :type type: str - :param host_name: GitHub Enterprise host name. For example: https://github.mydomain.com. - :type host_name: str - :param account_name: Account name. - :type account_name: str - :param project_name: VSTS project name. - :type project_name: str - :param repository_name: Repository name. - :type repository_name: str - :param collaboration_branch: Collaboration branch. - :type collaboration_branch: str - :param root_folder: Root folder to use in the repository. - :type root_folder: str - :param last_commit_id: The last commit ID. - :type last_commit_id: str - :param tenant_id: The VSTS tenant ID. - :type tenant_id: str - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'host_name': {'key': 'hostName', 'type': 'str'}, - 'account_name': {'key': 'accountName', 'type': 'str'}, - 'project_name': {'key': 'projectName', 'type': 'str'}, - 'repository_name': {'key': 'repositoryName', 'type': 'str'}, - 'collaboration_branch': {'key': 'collaborationBranch', 'type': 'str'}, - 'root_folder': {'key': 'rootFolder', 'type': 'str'}, - 'last_commit_id': {'key': 'lastCommitId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkspaceRepositoryConfiguration, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.host_name = kwargs.get('host_name', None) - self.account_name = kwargs.get('account_name', None) - self.project_name = kwargs.get('project_name', None) - self.repository_name = kwargs.get('repository_name', None) - self.collaboration_branch = kwargs.get('collaboration_branch', None) - self.root_folder = kwargs.get('root_folder', None) - self.last_commit_id = kwargs.get('last_commit_id', None) - self.tenant_id = kwargs.get('tenant_id', None) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_models_py3.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_models_py3.py index d5ff5c616784f..86f24e689f6a1 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_models_py3.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_models_py3.py @@ -46,6 +46,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -83,6 +85,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -99,29 +103,29 @@ class AttachedDatabaseConfiguration(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: Resource location. - :type location: str + :ivar location: Resource location. + :vartype location: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.synapse.models.SystemData :ivar provisioning_state: The provisioned state of the resource. Possible values include: "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState - :param database_name: The name of the database which you would like to attach, use * if you - want to follow all current and future databases. - :type database_name: str - :param kusto_pool_resource_id: The resource id of the kusto pool where the databases you would + :ivar database_name: The name of the database which you would like to attach, use * if you want + to follow all current and future databases. + :vartype database_name: str + :ivar kusto_pool_resource_id: The resource id of the kusto pool where the databases you would like to attach reside. - :type kusto_pool_resource_id: str + :vartype kusto_pool_resource_id: str :ivar attached_database_names: The list of databases from the clusterResourceId which are currently attached to the kusto pool. :vartype attached_database_names: list[str] - :param default_principals_modification_kind: The default principals modification kind. Possible + :ivar default_principals_modification_kind: The default principals modification kind. Possible values include: "Union", "Replace", "None". - :type default_principals_modification_kind: str or + :vartype default_principals_modification_kind: str or ~azure.mgmt.synapse.models.DefaultPrincipalsModificationKind - :param table_level_sharing_properties: Table level sharing specifications. - :type table_level_sharing_properties: ~azure.mgmt.synapse.models.TableLevelSharingProperties + :ivar table_level_sharing_properties: Table level sharing specifications. + :vartype table_level_sharing_properties: ~azure.mgmt.synapse.models.TableLevelSharingProperties """ _validation = { @@ -157,6 +161,23 @@ def __init__( table_level_sharing_properties: Optional["TableLevelSharingProperties"] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword database_name: The name of the database which you would like to attach, use * if you + want to follow all current and future databases. + :paramtype database_name: str + :keyword kusto_pool_resource_id: The resource id of the kusto pool where the databases you + would like to attach reside. + :paramtype kusto_pool_resource_id: str + :keyword default_principals_modification_kind: The default principals modification kind. + Possible values include: "Union", "Replace", "None". + :paramtype default_principals_modification_kind: str or + ~azure.mgmt.synapse.models.DefaultPrincipalsModificationKind + :keyword table_level_sharing_properties: Table level sharing specifications. + :paramtype table_level_sharing_properties: + ~azure.mgmt.synapse.models.TableLevelSharingProperties + """ super(AttachedDatabaseConfiguration, self).__init__(**kwargs) self.location = location self.system_data = None @@ -171,8 +192,8 @@ def __init__( class AttachedDatabaseConfigurationListResult(msrest.serialization.Model): """The list attached database configurations operation response. - :param value: The list of attached database configurations. - :type value: list[~azure.mgmt.synapse.models.AttachedDatabaseConfiguration] + :ivar value: The list of attached database configurations. + :vartype value: list[~azure.mgmt.synapse.models.AttachedDatabaseConfiguration] """ _attribute_map = { @@ -185,6 +206,10 @@ def __init__( value: Optional[List["AttachedDatabaseConfiguration"]] = None, **kwargs ): + """ + :keyword value: The list of attached database configurations. + :paramtype value: list[~azure.mgmt.synapse.models.AttachedDatabaseConfiguration] + """ super(AttachedDatabaseConfigurationListResult, self).__init__(**kwargs) self.value = value @@ -192,11 +217,11 @@ def __init__( class AutoPauseProperties(msrest.serialization.Model): """Auto-pausing properties of a Big Data pool powered by Apache Spark. - :param delay_in_minutes: Number of minutes of idle time before the Big Data pool is + :ivar delay_in_minutes: Number of minutes of idle time before the Big Data pool is automatically paused. - :type delay_in_minutes: int - :param enabled: Whether auto-pausing is enabled for the Big Data pool. - :type enabled: bool + :vartype delay_in_minutes: int + :ivar enabled: Whether auto-pausing is enabled for the Big Data pool. + :vartype enabled: bool """ _attribute_map = { @@ -211,6 +236,13 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword delay_in_minutes: Number of minutes of idle time before the Big Data pool is + automatically paused. + :paramtype delay_in_minutes: int + :keyword enabled: Whether auto-pausing is enabled for the Big Data pool. + :paramtype enabled: bool + """ super(AutoPauseProperties, self).__init__(**kwargs) self.delay_in_minutes = delay_in_minutes self.enabled = enabled @@ -219,12 +251,12 @@ def __init__( class AutoScaleProperties(msrest.serialization.Model): """Auto-scaling properties of a Big Data pool powered by Apache Spark. - :param min_node_count: The minimum number of nodes the Big Data pool can support. - :type min_node_count: int - :param enabled: Whether automatic scaling is enabled for the Big Data pool. - :type enabled: bool - :param max_node_count: The maximum number of nodes the Big Data pool can support. - :type max_node_count: int + :ivar min_node_count: The minimum number of nodes the Big Data pool can support. + :vartype min_node_count: int + :ivar enabled: Whether automatic scaling is enabled for the Big Data pool. + :vartype enabled: bool + :ivar max_node_count: The maximum number of nodes the Big Data pool can support. + :vartype max_node_count: int """ _attribute_map = { @@ -241,6 +273,14 @@ def __init__( max_node_count: Optional[int] = None, **kwargs ): + """ + :keyword min_node_count: The minimum number of nodes the Big Data pool can support. + :paramtype min_node_count: int + :keyword enabled: Whether automatic scaling is enabled for the Big Data pool. + :paramtype enabled: bool + :keyword max_node_count: The maximum number of nodes the Big Data pool can support. + :paramtype max_node_count: int + """ super(AutoScaleProperties, self).__init__(**kwargs) self.min_node_count = min_node_count self.enabled = enabled @@ -250,16 +290,16 @@ def __init__( class AvailableRpOperation(msrest.serialization.Model): """An operation that is available in this resource provider. - :param display: Display properties of the operation. - :type display: ~azure.mgmt.synapse.models.AvailableRpOperationDisplayInfo - :param is_data_action: Whether this operation is a data action. - :type is_data_action: str - :param name: Operation name. - :type name: str - :param origin: Operation origin. - :type origin: str - :param service_specification: Operation service specification. - :type service_specification: ~azure.mgmt.synapse.models.OperationMetaServiceSpecification + :ivar display: Display properties of the operation. + :vartype display: ~azure.mgmt.synapse.models.AvailableRpOperationDisplayInfo + :ivar is_data_action: Whether this operation is a data action. + :vartype is_data_action: str + :ivar name: Operation name. + :vartype name: str + :ivar origin: Operation origin. + :vartype origin: str + :ivar service_specification: Operation service specification. + :vartype service_specification: ~azure.mgmt.synapse.models.OperationMetaServiceSpecification """ _attribute_map = { @@ -280,6 +320,18 @@ def __init__( service_specification: Optional["OperationMetaServiceSpecification"] = None, **kwargs ): + """ + :keyword display: Display properties of the operation. + :paramtype display: ~azure.mgmt.synapse.models.AvailableRpOperationDisplayInfo + :keyword is_data_action: Whether this operation is a data action. + :paramtype is_data_action: str + :keyword name: Operation name. + :paramtype name: str + :keyword origin: Operation origin. + :paramtype origin: str + :keyword service_specification: Operation service specification. + :paramtype service_specification: ~azure.mgmt.synapse.models.OperationMetaServiceSpecification + """ super(AvailableRpOperation, self).__init__(**kwargs) self.display = display self.is_data_action = is_data_action @@ -291,14 +343,14 @@ def __init__( class AvailableRpOperationDisplayInfo(msrest.serialization.Model): """Description of an available operation. - :param description: Operation description. - :type description: str - :param resource: Resource type. - :type resource: str - :param provider: Resource provider name. - :type provider: str - :param operation: Operation name. - :type operation: str + :ivar description: Operation description. + :vartype description: str + :ivar resource: Resource type. + :vartype resource: str + :ivar provider: Resource provider name. + :vartype provider: str + :ivar operation: Operation name. + :vartype operation: str """ _attribute_map = { @@ -317,6 +369,16 @@ def __init__( operation: Optional[str] = None, **kwargs ): + """ + :keyword description: Operation description. + :paramtype description: str + :keyword resource: Resource type. + :paramtype resource: str + :keyword provider: Resource provider name. + :paramtype provider: str + :keyword operation: Operation name. + :paramtype operation: str + """ super(AvailableRpOperationDisplayInfo, self).__init__(**kwargs) self.description = description self.resource = resource @@ -337,8 +399,8 @@ class AzureADOnlyAuthentication(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param azure_ad_only_authentication: Azure Active Directory only Authentication enabled. - :type azure_ad_only_authentication: bool + :ivar azure_ad_only_authentication: Azure Active Directory only Authentication enabled. + :vartype azure_ad_only_authentication: bool :ivar state: property configuration state. Possible values include: "Consistent", "InConsistent", "Updating". :vartype state: str or ~azure.mgmt.synapse.models.StateValue @@ -369,6 +431,10 @@ def __init__( azure_ad_only_authentication: Optional[bool] = None, **kwargs ): + """ + :keyword azure_ad_only_authentication: Azure Active Directory only Authentication enabled. + :paramtype azure_ad_only_authentication: bool + """ super(AzureADOnlyAuthentication, self).__init__(**kwargs) self.azure_ad_only_authentication = azure_ad_only_authentication self.state = None @@ -400,6 +466,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureADOnlyAuthenticationListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -410,15 +478,14 @@ class AzureCapacity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param scale_type: Required. Scale type. Possible values include: "automatic", "manual", - "none". - :type scale_type: str or ~azure.mgmt.synapse.models.AzureScaleType - :param minimum: Required. Minimum allowed capacity. - :type minimum: int - :param maximum: Required. Maximum allowed capacity. - :type maximum: int - :param default: Required. The default capacity that would be used. - :type default: int + :ivar scale_type: Required. Scale type. Possible values include: "automatic", "manual", "none". + :vartype scale_type: str or ~azure.mgmt.synapse.models.AzureScaleType + :ivar minimum: Required. Minimum allowed capacity. + :vartype minimum: int + :ivar maximum: Required. Maximum allowed capacity. + :vartype maximum: int + :ivar default: Required. The default capacity that would be used. + :vartype default: int """ _validation = { @@ -444,6 +511,17 @@ def __init__( default: int, **kwargs ): + """ + :keyword scale_type: Required. Scale type. Possible values include: "automatic", "manual", + "none". + :paramtype scale_type: str or ~azure.mgmt.synapse.models.AzureScaleType + :keyword minimum: Required. Minimum allowed capacity. + :paramtype minimum: int + :keyword maximum: Required. Maximum allowed capacity. + :paramtype maximum: int + :keyword default: Required. The default capacity that would be used. + :paramtype default: int + """ super(AzureCapacity, self).__init__(**kwargs) self.scale_type = scale_type self.minimum = minimum @@ -486,6 +564,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureEntityResource, self).__init__(**kwargs) self.etag = None @@ -493,12 +573,12 @@ def __init__( class AzureResourceSku(msrest.serialization.Model): """Azure resource SKU definition. - :param resource_type: Resource Namespace and Type. - :type resource_type: str - :param sku: The SKU details. - :type sku: ~azure.mgmt.synapse.models.AzureSku - :param capacity: The number of instances of the cluster. - :type capacity: ~azure.mgmt.synapse.models.AzureCapacity + :ivar resource_type: Resource Namespace and Type. + :vartype resource_type: str + :ivar sku: The SKU details. + :vartype sku: ~azure.mgmt.synapse.models.AzureSku + :ivar capacity: The number of instances of the cluster. + :vartype capacity: ~azure.mgmt.synapse.models.AzureCapacity """ _attribute_map = { @@ -515,6 +595,14 @@ def __init__( capacity: Optional["AzureCapacity"] = None, **kwargs ): + """ + :keyword resource_type: Resource Namespace and Type. + :paramtype resource_type: str + :keyword sku: The SKU details. + :paramtype sku: ~azure.mgmt.synapse.models.AzureSku + :keyword capacity: The number of instances of the cluster. + :paramtype capacity: ~azure.mgmt.synapse.models.AzureCapacity + """ super(AzureResourceSku, self).__init__(**kwargs) self.resource_type = resource_type self.sku = sku @@ -526,14 +614,14 @@ class AzureSku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. SKU name. Possible values include: "Compute optimized", "Storage + :ivar name: Required. SKU name. Possible values include: "Compute optimized", "Storage optimized". - :type name: str or ~azure.mgmt.synapse.models.SkuName - :param capacity: The number of instances of the cluster. - :type capacity: int - :param size: Required. SKU size. Possible values include: "Extra small", "Small", "Medium", + :vartype name: str or ~azure.mgmt.synapse.models.SkuName + :ivar capacity: The number of instances of the cluster. + :vartype capacity: int + :ivar size: Required. SKU size. Possible values include: "Extra small", "Small", "Medium", "Large". - :type size: str or ~azure.mgmt.synapse.models.SkuSize + :vartype size: str or ~azure.mgmt.synapse.models.SkuSize """ _validation = { @@ -555,6 +643,16 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: Required. SKU name. Possible values include: "Compute optimized", "Storage + optimized". + :paramtype name: str or ~azure.mgmt.synapse.models.SkuName + :keyword capacity: The number of instances of the cluster. + :paramtype capacity: int + :keyword size: Required. SKU size. Possible values include: "Extra small", "Small", "Medium", + "Large". + :paramtype size: str or ~azure.mgmt.synapse.models.SkuSize + """ super(AzureSku, self).__init__(**kwargs) self.name = name self.capacity = capacity @@ -564,8 +662,8 @@ def __init__( class BigDataPoolPatchInfo(msrest.serialization.Model): """Properties patch for a Big Data pool. - :param tags: A set of tags. Updated tags for the Big Data pool. - :type tags: dict[str, str] + :ivar tags: A set of tags. Updated tags for the Big Data pool. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -578,6 +676,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Updated tags for the Big Data pool. + :paramtype tags: dict[str, str] + """ super(BigDataPoolPatchInfo, self).__init__(**kwargs) self.tags = tags @@ -597,10 +699,10 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str """ _validation = { @@ -625,6 +727,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -645,46 +753,46 @@ class BigDataPoolResourceInfo(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param provisioning_state: The state of the Big Data pool. - :type provisioning_state: str - :param auto_scale: Auto-scaling properties. - :type auto_scale: ~azure.mgmt.synapse.models.AutoScaleProperties - :param creation_date: The time when the Big Data pool was created. - :type creation_date: ~datetime.datetime - :param auto_pause: Auto-pausing properties. - :type auto_pause: ~azure.mgmt.synapse.models.AutoPauseProperties - :param is_compute_isolation_enabled: Whether compute isolation is required or not. - :type is_compute_isolation_enabled: bool - :param session_level_packages_enabled: Whether session level packages enabled. - :type session_level_packages_enabled: bool - :param cache_size: The cache size. - :type cache_size: int - :param dynamic_executor_allocation: Dynamic Executor Allocation. - :type dynamic_executor_allocation: ~azure.mgmt.synapse.models.DynamicExecutorAllocation - :param spark_events_folder: The Spark events folder. - :type spark_events_folder: str - :param node_count: The number of nodes in the Big Data pool. - :type node_count: int - :param library_requirements: Library version requirements. - :type library_requirements: ~azure.mgmt.synapse.models.LibraryRequirements - :param custom_libraries: List of custom libraries/packages associated with the spark pool. - :type custom_libraries: list[~azure.mgmt.synapse.models.LibraryInfo] - :param spark_config_properties: Spark configuration file to specify additional properties. - :type spark_config_properties: ~azure.mgmt.synapse.models.SparkConfigProperties - :param spark_version: The Apache Spark version. - :type spark_version: str - :param default_spark_log_folder: The default folder where Spark logs will be written. - :type default_spark_log_folder: str - :param node_size: The level of compute power that each node in the Big Data pool has. Possible + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: The state of the Big Data pool. + :vartype provisioning_state: str + :ivar auto_scale: Auto-scaling properties. + :vartype auto_scale: ~azure.mgmt.synapse.models.AutoScaleProperties + :ivar creation_date: The time when the Big Data pool was created. + :vartype creation_date: ~datetime.datetime + :ivar auto_pause: Auto-pausing properties. + :vartype auto_pause: ~azure.mgmt.synapse.models.AutoPauseProperties + :ivar is_compute_isolation_enabled: Whether compute isolation is required or not. + :vartype is_compute_isolation_enabled: bool + :ivar session_level_packages_enabled: Whether session level packages enabled. + :vartype session_level_packages_enabled: bool + :ivar cache_size: The cache size. + :vartype cache_size: int + :ivar dynamic_executor_allocation: Dynamic Executor Allocation. + :vartype dynamic_executor_allocation: ~azure.mgmt.synapse.models.DynamicExecutorAllocation + :ivar spark_events_folder: The Spark events folder. + :vartype spark_events_folder: str + :ivar node_count: The number of nodes in the Big Data pool. + :vartype node_count: int + :ivar library_requirements: Library version requirements. + :vartype library_requirements: ~azure.mgmt.synapse.models.LibraryRequirements + :ivar custom_libraries: List of custom libraries/packages associated with the spark pool. + :vartype custom_libraries: list[~azure.mgmt.synapse.models.LibraryInfo] + :ivar spark_config_properties: Spark configuration file to specify additional properties. + :vartype spark_config_properties: ~azure.mgmt.synapse.models.SparkConfigProperties + :ivar spark_version: The Apache Spark version. + :vartype spark_version: str + :ivar default_spark_log_folder: The default folder where Spark logs will be written. + :vartype default_spark_log_folder: str + :ivar node_size: The level of compute power that each node in the Big Data pool has. Possible values include: "None", "Small", "Medium", "Large", "XLarge", "XXLarge", "XXXLarge". - :type node_size: str or ~azure.mgmt.synapse.models.NodeSize - :param node_size_family: The kind of nodes that the Big Data pool provides. Possible values + :vartype node_size: str or ~azure.mgmt.synapse.models.NodeSize + :ivar node_size_family: The kind of nodes that the Big Data pool provides. Possible values include: "None", "MemoryOptimized", "HardwareAcceleratedFPGA", "HardwareAcceleratedGPU". - :type node_size_family: str or ~azure.mgmt.synapse.models.NodeSizeFamily + :vartype node_size_family: str or ~azure.mgmt.synapse.models.NodeSizeFamily :ivar last_succeeded_timestamp: The time when the Big Data pool was updated successfully. :vartype last_succeeded_timestamp: ~datetime.datetime """ @@ -747,6 +855,48 @@ def __init__( node_size_family: Optional[Union[str, "NodeSizeFamily"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword provisioning_state: The state of the Big Data pool. + :paramtype provisioning_state: str + :keyword auto_scale: Auto-scaling properties. + :paramtype auto_scale: ~azure.mgmt.synapse.models.AutoScaleProperties + :keyword creation_date: The time when the Big Data pool was created. + :paramtype creation_date: ~datetime.datetime + :keyword auto_pause: Auto-pausing properties. + :paramtype auto_pause: ~azure.mgmt.synapse.models.AutoPauseProperties + :keyword is_compute_isolation_enabled: Whether compute isolation is required or not. + :paramtype is_compute_isolation_enabled: bool + :keyword session_level_packages_enabled: Whether session level packages enabled. + :paramtype session_level_packages_enabled: bool + :keyword cache_size: The cache size. + :paramtype cache_size: int + :keyword dynamic_executor_allocation: Dynamic Executor Allocation. + :paramtype dynamic_executor_allocation: ~azure.mgmt.synapse.models.DynamicExecutorAllocation + :keyword spark_events_folder: The Spark events folder. + :paramtype spark_events_folder: str + :keyword node_count: The number of nodes in the Big Data pool. + :paramtype node_count: int + :keyword library_requirements: Library version requirements. + :paramtype library_requirements: ~azure.mgmt.synapse.models.LibraryRequirements + :keyword custom_libraries: List of custom libraries/packages associated with the spark pool. + :paramtype custom_libraries: list[~azure.mgmt.synapse.models.LibraryInfo] + :keyword spark_config_properties: Spark configuration file to specify additional properties. + :paramtype spark_config_properties: ~azure.mgmt.synapse.models.SparkConfigProperties + :keyword spark_version: The Apache Spark version. + :paramtype spark_version: str + :keyword default_spark_log_folder: The default folder where Spark logs will be written. + :paramtype default_spark_log_folder: str + :keyword node_size: The level of compute power that each node in the Big Data pool has. + Possible values include: "None", "Small", "Medium", "Large", "XLarge", "XXLarge", "XXXLarge". + :paramtype node_size: str or ~azure.mgmt.synapse.models.NodeSize + :keyword node_size_family: The kind of nodes that the Big Data pool provides. Possible values + include: "None", "MemoryOptimized", "HardwareAcceleratedFPGA", "HardwareAcceleratedGPU". + :paramtype node_size_family: str or ~azure.mgmt.synapse.models.NodeSizeFamily + """ super(BigDataPoolResourceInfo, self).__init__(tags=tags, location=location, **kwargs) self.provisioning_state = provisioning_state self.auto_scale = auto_scale @@ -771,10 +921,10 @@ def __init__( class BigDataPoolResourceInfoListResult(msrest.serialization.Model): """Collection of Big Data pool information. - :param next_link: Link to the next page of results. - :type next_link: str - :param value: List of Big Data pools. - :type value: list[~azure.mgmt.synapse.models.BigDataPoolResourceInfo] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + :ivar value: List of Big Data pools. + :vartype value: list[~azure.mgmt.synapse.models.BigDataPoolResourceInfo] """ _attribute_map = { @@ -789,6 +939,12 @@ def __init__( value: Optional[List["BigDataPoolResourceInfo"]] = None, **kwargs ): + """ + :keyword next_link: Link to the next page of results. + :paramtype next_link: str + :keyword value: List of Big Data pools. + :paramtype value: list[~azure.mgmt.synapse.models.BigDataPoolResourceInfo] + """ super(BigDataPoolResourceInfoListResult, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -797,10 +953,10 @@ def __init__( class CheckNameAvailabilityRequest(msrest.serialization.Model): """A request about whether a workspace name is available. - :param name: Workspace name. - :type name: str - :param type: Type: workspace. - :type type: str + :ivar name: Workspace name. + :vartype name: str + :ivar type: Type: workspace. + :vartype type: str """ _attribute_map = { @@ -815,6 +971,12 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword name: Workspace name. + :paramtype name: str + :keyword type: Type: workspace. + :paramtype type: str + """ super(CheckNameAvailabilityRequest, self).__init__(**kwargs) self.name = name self.type = type @@ -823,14 +985,14 @@ def __init__( class CheckNameAvailabilityResponse(msrest.serialization.Model): """A response saying whether the workspace name is available. - :param message: Validation message. - :type message: str - :param available: Whether the workspace name is available. - :type available: bool - :param reason: Reason the workspace name is or is not available. - :type reason: str - :param name: Workspace name. - :type name: str + :ivar message: Validation message. + :vartype message: str + :ivar available: Whether the workspace name is available. + :vartype available: bool + :ivar reason: Reason the workspace name is or is not available. + :vartype reason: str + :ivar name: Workspace name. + :vartype name: str """ _attribute_map = { @@ -849,6 +1011,16 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword message: Validation message. + :paramtype message: str + :keyword available: Whether the workspace name is available. + :paramtype available: bool + :keyword reason: Reason the workspace name is or is not available. + :paramtype reason: str + :keyword name: Workspace name. + :paramtype name: str + """ super(CheckNameAvailabilityResponse, self).__init__(**kwargs) self.message = message self.available = available @@ -859,16 +1031,16 @@ def __init__( class CheckNameResult(msrest.serialization.Model): """The result returned from a check name availability request. - :param name_available: Specifies a Boolean value that indicates if the name is available. - :type name_available: bool - :param name: The name that was checked. - :type name: str - :param message: Message indicating an unavailable name due to a conflict, or a description of + :ivar name_available: Specifies a Boolean value that indicates if the name is available. + :vartype name_available: bool + :ivar name: The name that was checked. + :vartype name: str + :ivar message: Message indicating an unavailable name due to a conflict, or a description of the naming rules that are violated. - :type message: str - :param reason: Message providing the reason why the given name is invalid. Possible values + :vartype message: str + :ivar reason: Message providing the reason why the given name is invalid. Possible values include: "Invalid", "AlreadyExists". - :type reason: str or ~azure.mgmt.synapse.models.Reason + :vartype reason: str or ~azure.mgmt.synapse.models.Reason """ _attribute_map = { @@ -887,6 +1059,18 @@ def __init__( reason: Optional[Union[str, "Reason"]] = None, **kwargs ): + """ + :keyword name_available: Specifies a Boolean value that indicates if the name is available. + :paramtype name_available: bool + :keyword name: The name that was checked. + :paramtype name: str + :keyword message: Message indicating an unavailable name due to a conflict, or a description of + the naming rules that are violated. + :paramtype message: str + :keyword reason: Message providing the reason why the given name is invalid. Possible values + include: "Invalid", "AlreadyExists". + :paramtype reason: str or ~azure.mgmt.synapse.models.Reason + """ super(CheckNameResult, self).__init__(**kwargs) self.name_available = name_available self.name = name @@ -910,16 +1094,16 @@ class ClusterPrincipalAssignment(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.synapse.models.SystemData - :param principal_id: The principal ID assigned to the cluster principal. It can be a user - email, application ID, or security group name. - :type principal_id: str - :param role: Cluster principal role. Possible values include: "AllDatabasesAdmin", + :ivar principal_id: The principal ID assigned to the cluster principal. It can be a user email, + application ID, or security group name. + :vartype principal_id: str + :ivar role: Cluster principal role. Possible values include: "AllDatabasesAdmin", "AllDatabasesViewer". - :type role: str or ~azure.mgmt.synapse.models.ClusterPrincipalRole - :param tenant_id: The tenant id of the principal. - :type tenant_id: str - :param principal_type: Principal type. Possible values include: "App", "Group", "User". - :type principal_type: str or ~azure.mgmt.synapse.models.PrincipalType + :vartype role: str or ~azure.mgmt.synapse.models.ClusterPrincipalRole + :ivar tenant_id: The tenant id of the principal. + :vartype tenant_id: str + :ivar principal_type: Principal type. Possible values include: "App", "Group", "User". + :vartype principal_type: str or ~azure.mgmt.synapse.models.PrincipalType :ivar tenant_name: The tenant name of the principal. :vartype tenant_name: str :ivar principal_name: The principal name. @@ -962,6 +1146,18 @@ def __init__( principal_type: Optional[Union[str, "PrincipalType"]] = None, **kwargs ): + """ + :keyword principal_id: The principal ID assigned to the cluster principal. It can be a user + email, application ID, or security group name. + :paramtype principal_id: str + :keyword role: Cluster principal role. Possible values include: "AllDatabasesAdmin", + "AllDatabasesViewer". + :paramtype role: str or ~azure.mgmt.synapse.models.ClusterPrincipalRole + :keyword tenant_id: The tenant id of the principal. + :paramtype tenant_id: str + :keyword principal_type: Principal type. Possible values include: "App", "Group", "User". + :paramtype principal_type: str or ~azure.mgmt.synapse.models.PrincipalType + """ super(ClusterPrincipalAssignment, self).__init__(**kwargs) self.system_data = None self.principal_id = principal_id @@ -980,8 +1176,8 @@ class ClusterPrincipalAssignmentCheckNameRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Principal Assignment resource name. - :type name: str + :ivar name: Required. Principal Assignment resource name. + :vartype name: str :ivar type: The type of resource, Microsoft.Synapse/workspaces/kustoPools/principalAssignments. Has constant value: "Microsoft.Synapse/workspaces/kustoPools/principalAssignments". :vartype type: str @@ -1005,6 +1201,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Principal Assignment resource name. + :paramtype name: str + """ super(ClusterPrincipalAssignmentCheckNameRequest, self).__init__(**kwargs) self.name = name @@ -1012,8 +1212,8 @@ def __init__( class ClusterPrincipalAssignmentListResult(msrest.serialization.Model): """The list Kusto cluster principal assignments operation response. - :param value: The list of Kusto cluster principal assignments. - :type value: list[~azure.mgmt.synapse.models.ClusterPrincipalAssignment] + :ivar value: The list of Kusto cluster principal assignments. + :vartype value: list[~azure.mgmt.synapse.models.ClusterPrincipalAssignment] """ _attribute_map = { @@ -1026,6 +1226,10 @@ def __init__( value: Optional[List["ClusterPrincipalAssignment"]] = None, **kwargs ): + """ + :keyword value: The list of Kusto cluster principal assignments. + :paramtype value: list[~azure.mgmt.synapse.models.ClusterPrincipalAssignment] + """ super(ClusterPrincipalAssignmentListResult, self).__init__(**kwargs) self.value = value @@ -1038,8 +1242,8 @@ class CustomSetupBase(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of custom setup.Constant filled by server. - :type type: str + :ivar type: Required. The type of custom setup.Constant filled by server. + :vartype type: str """ _validation = { @@ -1058,6 +1262,8 @@ def __init__( self, **kwargs ): + """ + """ super(CustomSetupBase, self).__init__(**kwargs) self.type = None # type: Optional[str] @@ -1067,14 +1273,14 @@ class CmdkeySetup(CustomSetupBase): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of custom setup.Constant filled by server. - :type type: str - :param target_name: Required. The server name of data source access. - :type target_name: any - :param user_name: Required. The user name of data source access. - :type user_name: any - :param password: Required. The password of data source access. - :type password: ~azure.mgmt.synapse.models.SecretBase + :ivar type: Required. The type of custom setup.Constant filled by server. + :vartype type: str + :ivar target_name: Required. The server name of data source access. + :vartype target_name: any + :ivar user_name: Required. The user name of data source access. + :vartype user_name: any + :ivar password: Required. The password of data source access. + :vartype password: ~azure.mgmt.synapse.models.SecretBase """ _validation = { @@ -1099,6 +1305,14 @@ def __init__( password: "SecretBase", **kwargs ): + """ + :keyword target_name: Required. The server name of data source access. + :paramtype target_name: any + :keyword user_name: Required. The user name of data source access. + :paramtype user_name: any + :keyword password: Required. The password of data source access. + :paramtype password: ~azure.mgmt.synapse.models.SecretBase + """ super(CmdkeySetup, self).__init__(**kwargs) self.type = 'CmdkeySetup' # type: str self.target_name = target_name @@ -1111,12 +1325,12 @@ class ComponentSetup(CustomSetupBase): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of custom setup.Constant filled by server. - :type type: str - :param component_name: Required. The name of the 3rd party component. - :type component_name: str - :param license_key: The license key to activate the component. - :type license_key: ~azure.mgmt.synapse.models.SecretBase + :ivar type: Required. The type of custom setup.Constant filled by server. + :vartype type: str + :ivar component_name: Required. The name of the 3rd party component. + :vartype component_name: str + :ivar license_key: The license key to activate the component. + :vartype license_key: ~azure.mgmt.synapse.models.SecretBase """ _validation = { @@ -1137,6 +1351,12 @@ def __init__( license_key: Optional["SecretBase"] = None, **kwargs ): + """ + :keyword component_name: Required. The name of the 3rd party component. + :paramtype component_name: str + :keyword license_key: The license key to activate the component. + :paramtype license_key: ~azure.mgmt.synapse.models.SecretBase + """ super(ComponentSetup, self).__init__(**kwargs) self.type = 'ComponentSetup' # type: str self.component_name = component_name @@ -1148,8 +1368,8 @@ class CreateSqlPoolRestorePointDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param restore_point_label: Required. The restore point label to apply. - :type restore_point_label: str + :ivar restore_point_label: Required. The restore point label to apply. + :vartype restore_point_label: str """ _validation = { @@ -1166,6 +1386,10 @@ def __init__( restore_point_label: str, **kwargs ): + """ + :keyword restore_point_label: Required. The restore point label to apply. + :paramtype restore_point_label: str + """ super(CreateSqlPoolRestorePointDefinition, self).__init__(**kwargs) self.restore_point_label = restore_point_label @@ -1173,8 +1397,8 @@ def __init__( class CspWorkspaceAdminProperties(msrest.serialization.Model): """Initial workspace AAD admin properties for a CSP subscription. - :param initial_workspace_admin_object_id: AAD object ID of initial workspace admin. - :type initial_workspace_admin_object_id: str + :ivar initial_workspace_admin_object_id: AAD object ID of initial workspace admin. + :vartype initial_workspace_admin_object_id: str """ _attribute_map = { @@ -1187,6 +1411,10 @@ def __init__( initial_workspace_admin_object_id: Optional[str] = None, **kwargs ): + """ + :keyword initial_workspace_admin_object_id: AAD object ID of initial workspace admin. + :paramtype initial_workspace_admin_object_id: str + """ super(CspWorkspaceAdminProperties, self).__init__(**kwargs) self.initial_workspace_admin_object_id = initial_workspace_admin_object_id @@ -1198,10 +1426,10 @@ class CustomerManagedKeyDetails(msrest.serialization.Model): :ivar status: The customer managed key status on the workspace. :vartype status: str - :param key: The key object of the workspace. - :type key: ~azure.mgmt.synapse.models.WorkspaceKeyDetails - :param kek_identity: Key encryption key. - :type kek_identity: ~azure.mgmt.synapse.models.KekIdentityProperties + :ivar key: The key object of the workspace. + :vartype key: ~azure.mgmt.synapse.models.WorkspaceKeyDetails + :ivar kek_identity: Key encryption key. + :vartype kek_identity: ~azure.mgmt.synapse.models.KekIdentityProperties """ _validation = { @@ -1221,6 +1449,12 @@ def __init__( kek_identity: Optional["KekIdentityProperties"] = None, **kwargs ): + """ + :keyword key: The key object of the workspace. + :paramtype key: ~azure.mgmt.synapse.models.WorkspaceKeyDetails + :keyword kek_identity: Key encryption key. + :paramtype kek_identity: ~azure.mgmt.synapse.models.KekIdentityProperties + """ super(CustomerManagedKeyDetails, self).__init__(**kwargs) self.status = None self.key = key @@ -1245,11 +1479,11 @@ class Database(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the database.Constant filled by server. Possible values - include: "ReadWrite", "ReadOnlyFollowing". - :type kind: str or ~azure.mgmt.synapse.models.Kind + :ivar location: Resource location. + :vartype location: str + :ivar kind: Required. Kind of the database.Constant filled by server. Possible values include: + "ReadWrite", "ReadOnlyFollowing". + :vartype kind: str or ~azure.mgmt.synapse.models.Kind :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.synapse.models.SystemData @@ -1282,6 +1516,10 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + """ super(Database, self).__init__(**kwargs) self.location = location self.kind = 'Database' # type: str @@ -1293,13 +1531,13 @@ class DatabaseCheckNameRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Resource name. - :type name: str - :param type: Required. The type of resource, for instance + :ivar name: Required. Resource name. + :vartype name: str + :ivar type: Required. The type of resource, for instance Microsoft.Synapse/workspaces/kustoPools/databases. Possible values include: "Microsoft.Synapse/workspaces/kustoPools/databases", "Microsoft.Synapse/workspaces/kustoPools/attachedDatabaseConfigurations". - :type type: str or ~azure.mgmt.synapse.models.Type + :vartype type: str or ~azure.mgmt.synapse.models.Type """ _validation = { @@ -1319,6 +1557,15 @@ def __init__( type: Union[str, "Type"], **kwargs ): + """ + :keyword name: Required. Resource name. + :paramtype name: str + :keyword type: Required. The type of resource, for instance + Microsoft.Synapse/workspaces/kustoPools/databases. Possible values include: + "Microsoft.Synapse/workspaces/kustoPools/databases", + "Microsoft.Synapse/workspaces/kustoPools/attachedDatabaseConfigurations". + :paramtype type: str or ~azure.mgmt.synapse.models.Type + """ super(DatabaseCheckNameRequest, self).__init__(**kwargs) self.name = name self.type = type @@ -1327,8 +1574,8 @@ def __init__( class DatabaseListResult(msrest.serialization.Model): """The list Kusto databases operation response. - :param value: The list of Kusto databases. - :type value: list[~azure.mgmt.synapse.models.Database] + :ivar value: The list of Kusto databases. + :vartype value: list[~azure.mgmt.synapse.models.Database] """ _attribute_map = { @@ -1341,6 +1588,10 @@ def __init__( value: Optional[List["Database"]] = None, **kwargs ): + """ + :keyword value: The list of Kusto databases. + :paramtype value: list[~azure.mgmt.synapse.models.Database] + """ super(DatabaseListResult, self).__init__(**kwargs) self.value = value @@ -1361,16 +1612,16 @@ class DatabasePrincipalAssignment(ProxyResource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.synapse.models.SystemData - :param principal_id: The principal ID assigned to the database principal. It can be a user + :ivar principal_id: The principal ID assigned to the database principal. It can be a user email, application ID, or security group name. - :type principal_id: str - :param role: Database principal role. Possible values include: "Admin", "Ingestor", "Monitor", + :vartype principal_id: str + :ivar role: Database principal role. Possible values include: "Admin", "Ingestor", "Monitor", "User", "UnrestrictedViewer", "Viewer". - :type role: str or ~azure.mgmt.synapse.models.DatabasePrincipalRole - :param tenant_id: The tenant id of the principal. - :type tenant_id: str - :param principal_type: Principal type. Possible values include: "App", "Group", "User". - :type principal_type: str or ~azure.mgmt.synapse.models.PrincipalType + :vartype role: str or ~azure.mgmt.synapse.models.DatabasePrincipalRole + :ivar tenant_id: The tenant id of the principal. + :vartype tenant_id: str + :ivar principal_type: Principal type. Possible values include: "App", "Group", "User". + :vartype principal_type: str or ~azure.mgmt.synapse.models.PrincipalType :ivar tenant_name: The tenant name of the principal. :vartype tenant_name: str :ivar principal_name: The principal name. @@ -1413,6 +1664,18 @@ def __init__( principal_type: Optional[Union[str, "PrincipalType"]] = None, **kwargs ): + """ + :keyword principal_id: The principal ID assigned to the database principal. It can be a user + email, application ID, or security group name. + :paramtype principal_id: str + :keyword role: Database principal role. Possible values include: "Admin", "Ingestor", + "Monitor", "User", "UnrestrictedViewer", "Viewer". + :paramtype role: str or ~azure.mgmt.synapse.models.DatabasePrincipalRole + :keyword tenant_id: The tenant id of the principal. + :paramtype tenant_id: str + :keyword principal_type: Principal type. Possible values include: "App", "Group", "User". + :paramtype principal_type: str or ~azure.mgmt.synapse.models.PrincipalType + """ super(DatabasePrincipalAssignment, self).__init__(**kwargs) self.system_data = None self.principal_id = principal_id @@ -1431,8 +1694,8 @@ class DatabasePrincipalAssignmentCheckNameRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Principal Assignment resource name. - :type name: str + :ivar name: Required. Principal Assignment resource name. + :vartype name: str :ivar type: The type of resource, Microsoft.Synapse/workspaces/kustoPools/databases/principalAssignments. Has constant value: "Microsoft.Synapse/workspaces/kustoPools/databases/principalAssignments". @@ -1457,6 +1720,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Principal Assignment resource name. + :paramtype name: str + """ super(DatabasePrincipalAssignmentCheckNameRequest, self).__init__(**kwargs) self.name = name @@ -1464,8 +1731,8 @@ def __init__( class DatabasePrincipalAssignmentListResult(msrest.serialization.Model): """The list Kusto database principal assignments operation response. - :param value: The list of Kusto database principal assignments. - :type value: list[~azure.mgmt.synapse.models.DatabasePrincipalAssignment] + :ivar value: The list of Kusto database principal assignments. + :vartype value: list[~azure.mgmt.synapse.models.DatabasePrincipalAssignment] """ _attribute_map = { @@ -1478,6 +1745,10 @@ def __init__( value: Optional[List["DatabasePrincipalAssignment"]] = None, **kwargs ): + """ + :keyword value: The list of Kusto database principal assignments. + :paramtype value: list[~azure.mgmt.synapse.models.DatabasePrincipalAssignment] + """ super(DatabasePrincipalAssignmentListResult, self).__init__(**kwargs) self.value = value @@ -1485,8 +1756,8 @@ def __init__( class DatabaseStatistics(msrest.serialization.Model): """A class that contains database statistics information. - :param size: The database size - the total size of compressed data and index in bytes. - :type size: float + :ivar size: The database size - the total size of compressed data and index in bytes. + :vartype size: float """ _attribute_map = { @@ -1499,6 +1770,10 @@ def __init__( size: Optional[float] = None, **kwargs ): + """ + :keyword size: The database size - the total size of compressed data and index in bytes. + :paramtype size: float + """ super(DatabaseStatistics, self).__init__(**kwargs) self.size = size @@ -1521,11 +1796,11 @@ class DataConnection(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + :ivar location: Resource location. + :vartype location: str + :ivar kind: Required. Kind of the endpoint for the data connection.Constant filled by server. Possible values include: "EventHub", "EventGrid", "IotHub". - :type kind: str or ~azure.mgmt.synapse.models.DataConnectionKind + :vartype kind: str or ~azure.mgmt.synapse.models.DataConnectionKind :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.synapse.models.SystemData @@ -1558,6 +1833,10 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + """ super(DataConnection, self).__init__(**kwargs) self.location = location self.kind = 'DataConnection' # type: str @@ -1571,8 +1850,8 @@ class DataConnectionCheckNameRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Data Connection name. - :type name: str + :ivar name: Required. Data Connection name. + :vartype name: str :ivar type: The type of resource, Microsoft.Synapse/workspaces/kustoPools/databases/dataConnections. Has constant value: "Microsoft.Synapse/workspaces/kustoPools/databases/dataConnections". @@ -1597,6 +1876,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Data Connection name. + :paramtype name: str + """ super(DataConnectionCheckNameRequest, self).__init__(**kwargs) self.name = name @@ -1604,8 +1887,8 @@ def __init__( class DataConnectionListResult(msrest.serialization.Model): """The list Kusto data connections operation response. - :param value: The list of Kusto data connections. - :type value: list[~azure.mgmt.synapse.models.DataConnection] + :ivar value: The list of Kusto data connections. + :vartype value: list[~azure.mgmt.synapse.models.DataConnection] """ _attribute_map = { @@ -1618,6 +1901,10 @@ def __init__( value: Optional[List["DataConnection"]] = None, **kwargs ): + """ + :keyword value: The list of Kusto data connections. + :paramtype value: list[~azure.mgmt.synapse.models.DataConnection] + """ super(DataConnectionListResult, self).__init__(**kwargs) self.value = value @@ -1625,10 +1912,10 @@ def __init__( class DataConnectionValidation(msrest.serialization.Model): """Class representing an data connection validation. - :param data_connection_name: The name of the data connection. - :type data_connection_name: str - :param properties: The data connection properties to validate. - :type properties: ~azure.mgmt.synapse.models.DataConnection + :ivar data_connection_name: The name of the data connection. + :vartype data_connection_name: str + :ivar properties: The data connection properties to validate. + :vartype properties: ~azure.mgmt.synapse.models.DataConnection """ _attribute_map = { @@ -1643,6 +1930,12 @@ def __init__( properties: Optional["DataConnection"] = None, **kwargs ): + """ + :keyword data_connection_name: The name of the data connection. + :paramtype data_connection_name: str + :keyword properties: The data connection properties to validate. + :paramtype properties: ~azure.mgmt.synapse.models.DataConnection + """ super(DataConnectionValidation, self).__init__(**kwargs) self.data_connection_name = data_connection_name self.properties = properties @@ -1651,8 +1944,8 @@ def __init__( class DataConnectionValidationListResult(msrest.serialization.Model): """The list Kusto data connection validation result. - :param value: The list of Kusto data connection validation errors. - :type value: list[~azure.mgmt.synapse.models.DataConnectionValidationResult] + :ivar value: The list of Kusto data connection validation errors. + :vartype value: list[~azure.mgmt.synapse.models.DataConnectionValidationResult] """ _attribute_map = { @@ -1665,6 +1958,10 @@ def __init__( value: Optional[List["DataConnectionValidationResult"]] = None, **kwargs ): + """ + :keyword value: The list of Kusto data connection validation errors. + :paramtype value: list[~azure.mgmt.synapse.models.DataConnectionValidationResult] + """ super(DataConnectionValidationListResult, self).__init__(**kwargs) self.value = value @@ -1672,8 +1969,8 @@ def __init__( class DataConnectionValidationResult(msrest.serialization.Model): """The result returned from a data connection validation request. - :param error_message: A message which indicates a problem in data connection validation. - :type error_message: str + :ivar error_message: A message which indicates a problem in data connection validation. + :vartype error_message: str """ _attribute_map = { @@ -1686,6 +1983,10 @@ def __init__( error_message: Optional[str] = None, **kwargs ): + """ + :keyword error_message: A message which indicates a problem in data connection validation. + :paramtype error_message: str + """ super(DataConnectionValidationResult, self).__init__(**kwargs) self.error_message = error_message @@ -1693,15 +1994,15 @@ def __init__( class DataLakeStorageAccountDetails(msrest.serialization.Model): """Details of the data lake storage account associated with the workspace. - :param account_url: Account URL. - :type account_url: str - :param filesystem: Filesystem name. - :type filesystem: str - :param resource_id: ARM resource Id of this storage account. - :type resource_id: str - :param create_managed_private_endpoint: Create managed private endpoint to this storage account + :ivar account_url: Account URL. + :vartype account_url: str + :ivar filesystem: Filesystem name. + :vartype filesystem: str + :ivar resource_id: ARM resource Id of this storage account. + :vartype resource_id: str + :ivar create_managed_private_endpoint: Create managed private endpoint to this storage account or not. - :type create_managed_private_endpoint: bool + :vartype create_managed_private_endpoint: bool """ _attribute_map = { @@ -1720,6 +2021,17 @@ def __init__( create_managed_private_endpoint: Optional[bool] = None, **kwargs ): + """ + :keyword account_url: Account URL. + :paramtype account_url: str + :keyword filesystem: Filesystem name. + :paramtype filesystem: str + :keyword resource_id: ARM resource Id of this storage account. + :paramtype resource_id: str + :keyword create_managed_private_endpoint: Create managed private endpoint to this storage + account or not. + :paramtype create_managed_private_endpoint: bool + """ super(DataLakeStorageAccountDetails, self).__init__(**kwargs) self.account_url = account_url self.filesystem = filesystem @@ -1746,13 +2058,13 @@ class DataMaskingPolicy(ProxyResource): :vartype kind: str :ivar managed_by: Fully qualified resource ID of the sql pool. :vartype managed_by: str - :param data_masking_state: The state of the data masking policy. Possible values include: + :ivar data_masking_state: The state of the data masking policy. Possible values include: "Disabled", "Enabled". - :type data_masking_state: str or ~azure.mgmt.synapse.models.DataMaskingState - :param exempt_principals: The list of the exempt principals. Specifies the semicolon-separated + :vartype data_masking_state: str or ~azure.mgmt.synapse.models.DataMaskingState + :ivar exempt_principals: The list of the exempt principals. Specifies the semicolon-separated list of database users for which the data masking policy does not apply. The specified users receive data results without masking for all of the database queries. - :type exempt_principals: str + :vartype exempt_principals: str :ivar application_principals: The list of the application principals. This is a legacy parameter and is no longer used. :vartype application_principals: str @@ -1791,6 +2103,15 @@ def __init__( exempt_principals: Optional[str] = None, **kwargs ): + """ + :keyword data_masking_state: The state of the data masking policy. Possible values include: + "Disabled", "Enabled". + :paramtype data_masking_state: str or ~azure.mgmt.synapse.models.DataMaskingState + :keyword exempt_principals: The list of the exempt principals. Specifies the + semicolon-separated list of database users for which the data masking policy does not apply. + The specified users receive data results without masking for all of the database queries. + :paramtype exempt_principals: str + """ super(DataMaskingPolicy, self).__init__(**kwargs) self.location = None self.kind = None @@ -1820,38 +2141,38 @@ class DataMaskingRule(ProxyResource): :vartype kind: str :ivar id_properties_id: The rule Id. :vartype id_properties_id: str - :param alias_name: The alias name. This is a legacy parameter and is no longer used. - :type alias_name: str - :param rule_state: The rule state. Used to delete a rule. To delete an existing rule, specify + :ivar alias_name: The alias name. This is a legacy parameter and is no longer used. + :vartype alias_name: str + :ivar rule_state: The rule state. Used to delete a rule. To delete an existing rule, specify the schemaName, tableName, columnName, maskingFunction, and specify ruleState as disabled. However, if the rule doesn't already exist, the rule will be created with ruleState set to enabled, regardless of the provided value of ruleState. Possible values include: "Disabled", "Enabled". - :type rule_state: str or ~azure.mgmt.synapse.models.DataMaskingRuleState - :param schema_name: The schema name on which the data masking rule is applied. - :type schema_name: str - :param table_name: The table name on which the data masking rule is applied. - :type table_name: str - :param column_name: The column name on which the data masking rule is applied. - :type column_name: str - :param masking_function: The masking function that is used for the data masking rule. Possible + :vartype rule_state: str or ~azure.mgmt.synapse.models.DataMaskingRuleState + :ivar schema_name: The schema name on which the data masking rule is applied. + :vartype schema_name: str + :ivar table_name: The table name on which the data masking rule is applied. + :vartype table_name: str + :ivar column_name: The column name on which the data masking rule is applied. + :vartype column_name: str + :ivar masking_function: The masking function that is used for the data masking rule. Possible values include: "Default", "CCN", "Email", "Number", "SSN", "Text". - :type masking_function: str or ~azure.mgmt.synapse.models.DataMaskingFunction - :param number_from: The numberFrom property of the masking rule. Required if maskingFunction is + :vartype masking_function: str or ~azure.mgmt.synapse.models.DataMaskingFunction + :ivar number_from: The numberFrom property of the masking rule. Required if maskingFunction is + set to Number, otherwise this parameter will be ignored. + :vartype number_from: str + :ivar number_to: The numberTo property of the data masking rule. Required if maskingFunction is set to Number, otherwise this parameter will be ignored. - :type number_from: str - :param number_to: The numberTo property of the data masking rule. Required if maskingFunction - is set to Number, otherwise this parameter will be ignored. - :type number_to: str - :param prefix_size: If maskingFunction is set to Text, the number of characters to show - unmasked in the beginning of the string. Otherwise, this parameter will be ignored. - :type prefix_size: str - :param suffix_size: If maskingFunction is set to Text, the number of characters to show - unmasked at the end of the string. Otherwise, this parameter will be ignored. - :type suffix_size: str - :param replacement_string: If maskingFunction is set to Text, the character to use for masking + :vartype number_to: str + :ivar prefix_size: If maskingFunction is set to Text, the number of characters to show unmasked + in the beginning of the string. Otherwise, this parameter will be ignored. + :vartype prefix_size: str + :ivar suffix_size: If maskingFunction is set to Text, the number of characters to show unmasked + at the end of the string. Otherwise, this parameter will be ignored. + :vartype suffix_size: str + :ivar replacement_string: If maskingFunction is set to Text, the character to use for masking the unexposed part of the string. Otherwise, this parameter will be ignored. - :type replacement_string: str + :vartype replacement_string: str """ _validation = { @@ -1899,6 +2220,40 @@ def __init__( replacement_string: Optional[str] = None, **kwargs ): + """ + :keyword alias_name: The alias name. This is a legacy parameter and is no longer used. + :paramtype alias_name: str + :keyword rule_state: The rule state. Used to delete a rule. To delete an existing rule, specify + the schemaName, tableName, columnName, maskingFunction, and specify ruleState as disabled. + However, if the rule doesn't already exist, the rule will be created with ruleState set to + enabled, regardless of the provided value of ruleState. Possible values include: "Disabled", + "Enabled". + :paramtype rule_state: str or ~azure.mgmt.synapse.models.DataMaskingRuleState + :keyword schema_name: The schema name on which the data masking rule is applied. + :paramtype schema_name: str + :keyword table_name: The table name on which the data masking rule is applied. + :paramtype table_name: str + :keyword column_name: The column name on which the data masking rule is applied. + :paramtype column_name: str + :keyword masking_function: The masking function that is used for the data masking rule. + Possible values include: "Default", "CCN", "Email", "Number", "SSN", "Text". + :paramtype masking_function: str or ~azure.mgmt.synapse.models.DataMaskingFunction + :keyword number_from: The numberFrom property of the masking rule. Required if maskingFunction + is set to Number, otherwise this parameter will be ignored. + :paramtype number_from: str + :keyword number_to: The numberTo property of the data masking rule. Required if maskingFunction + is set to Number, otherwise this parameter will be ignored. + :paramtype number_to: str + :keyword prefix_size: If maskingFunction is set to Text, the number of characters to show + unmasked in the beginning of the string. Otherwise, this parameter will be ignored. + :paramtype prefix_size: str + :keyword suffix_size: If maskingFunction is set to Text, the number of characters to show + unmasked at the end of the string. Otherwise, this parameter will be ignored. + :paramtype suffix_size: str + :keyword replacement_string: If maskingFunction is set to Text, the character to use for + masking the unexposed part of the string. Otherwise, this parameter will be ignored. + :paramtype replacement_string: str + """ super(DataMaskingRule, self).__init__(**kwargs) self.location = None self.kind = None @@ -1919,8 +2274,8 @@ def __init__( class DataMaskingRuleListResult(msrest.serialization.Model): """The response to a list data masking rules request. - :param value: The list of Sql pool data masking rules. - :type value: list[~azure.mgmt.synapse.models.DataMaskingRule] + :ivar value: The list of Sql pool data masking rules. + :vartype value: list[~azure.mgmt.synapse.models.DataMaskingRule] """ _attribute_map = { @@ -1933,6 +2288,10 @@ def __init__( value: Optional[List["DataMaskingRule"]] = None, **kwargs ): + """ + :keyword value: The list of Sql pool data masking rules. + :paramtype value: list[~azure.mgmt.synapse.models.DataMaskingRule] + """ super(DataMaskingRuleListResult, self).__init__(**kwargs) self.value = value @@ -1972,6 +2331,8 @@ def __init__( self, **kwargs ): + """ + """ super(DataWarehouseUserActivities, self).__init__(**kwargs) self.active_queries_count = None @@ -1979,8 +2340,8 @@ def __init__( class DynamicExecutorAllocation(msrest.serialization.Model): """Dynamic Executor Allocation Properties. - :param enabled: Indicates whether Dynamic Executor Allocation is enabled or not. - :type enabled: bool + :ivar enabled: Indicates whether Dynamic Executor Allocation is enabled or not. + :vartype enabled: bool """ _attribute_map = { @@ -1993,6 +2354,10 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: Indicates whether Dynamic Executor Allocation is enabled or not. + :paramtype enabled: bool + """ super(DynamicExecutorAllocation, self).__init__(**kwargs) self.enabled = enabled @@ -2004,8 +2369,8 @@ class EncryptionDetails(msrest.serialization.Model): :ivar double_encryption_enabled: Double Encryption enabled. :vartype double_encryption_enabled: bool - :param cmk: Customer Managed Key Details. - :type cmk: ~azure.mgmt.synapse.models.CustomerManagedKeyDetails + :ivar cmk: Customer Managed Key Details. + :vartype cmk: ~azure.mgmt.synapse.models.CustomerManagedKeyDetails """ _validation = { @@ -2023,6 +2388,10 @@ def __init__( cmk: Optional["CustomerManagedKeyDetails"] = None, **kwargs ): + """ + :keyword cmk: Customer Managed Key Details. + :paramtype cmk: ~azure.mgmt.synapse.models.CustomerManagedKeyDetails + """ super(EncryptionDetails, self).__init__(**kwargs) self.double_encryption_enabled = None self.cmk = cmk @@ -2048,11 +2417,11 @@ class EncryptionProtector(ProxyResource): :vartype location: str :ivar subregion: Subregion of the encryption protector. :vartype subregion: str - :param server_key_name: The name of the server key. - :type server_key_name: str - :param server_key_type: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + :ivar server_key_name: The name of the server key. + :vartype server_key_name: str + :ivar server_key_type: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. Possible values include: "ServiceManaged", "AzureKeyVault". - :type server_key_type: str or ~azure.mgmt.synapse.models.ServerKeyType + :vartype server_key_type: str or ~azure.mgmt.synapse.models.ServerKeyType :ivar uri: The URI of the server key. :vartype uri: str :ivar thumbprint: Thumbprint of the server key. @@ -2090,6 +2459,13 @@ def __init__( server_key_type: Optional[Union[str, "ServerKeyType"]] = None, **kwargs ): + """ + :keyword server_key_name: The name of the server key. + :paramtype server_key_name: str + :keyword server_key_type: The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. + Possible values include: "ServiceManaged", "AzureKeyVault". + :paramtype server_key_type: str or ~azure.mgmt.synapse.models.ServerKeyType + """ super(EncryptionProtector, self).__init__(**kwargs) self.kind = None self.location = None @@ -2125,6 +2501,8 @@ def __init__( self, **kwargs ): + """ + """ super(EncryptionProtectorListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2133,11 +2511,11 @@ def __init__( class EntityReference(msrest.serialization.Model): """The entity reference. - :param type: The type of this referenced entity. Possible values include: + :ivar type: The type of this referenced entity. Possible values include: "IntegrationRuntimeReference", "LinkedServiceReference". - :type type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeEntityReferenceType - :param reference_name: The name of this referenced entity. - :type reference_name: str + :vartype type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeEntityReferenceType + :ivar reference_name: The name of this referenced entity. + :vartype reference_name: str """ _attribute_map = { @@ -2152,6 +2530,13 @@ def __init__( reference_name: Optional[str] = None, **kwargs ): + """ + :keyword type: The type of this referenced entity. Possible values include: + "IntegrationRuntimeReference", "LinkedServiceReference". + :paramtype type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeEntityReferenceType + :keyword reference_name: The name of this referenced entity. + :paramtype reference_name: str + """ super(EntityReference, self).__init__(**kwargs) self.type = type self.reference_name = reference_name @@ -2162,12 +2547,12 @@ class EnvironmentVariableSetup(CustomSetupBase): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of custom setup.Constant filled by server. - :type type: str - :param variable_name: Required. The name of the environment variable. - :type variable_name: str - :param variable_value: Required. The value of the environment variable. - :type variable_value: str + :ivar type: Required. The type of custom setup.Constant filled by server. + :vartype type: str + :ivar variable_name: Required. The name of the environment variable. + :vartype variable_name: str + :ivar variable_value: Required. The value of the environment variable. + :vartype variable_value: str """ _validation = { @@ -2189,6 +2574,12 @@ def __init__( variable_value: str, **kwargs ): + """ + :keyword variable_name: Required. The name of the environment variable. + :paramtype variable_name: str + :keyword variable_value: Required. The value of the environment variable. + :paramtype variable_value: str + """ super(EnvironmentVariableSetup, self).__init__(**kwargs) self.type = 'EnvironmentVariableSetup' # type: str self.variable_name = variable_name @@ -2220,6 +2611,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None @@ -2262,6 +2655,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None @@ -2273,8 +2668,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - :param error: The error object. - :type error: ~azure.mgmt.synapse.models.ErrorDetail + :ivar error: The error object. + :vartype error: ~azure.mgmt.synapse.models.ErrorDetail """ _attribute_map = { @@ -2287,6 +2682,10 @@ def __init__( error: Optional["ErrorDetail"] = None, **kwargs ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.synapse.models.ErrorDetail + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -2306,39 +2705,38 @@ class EventGridDataConnection(DataConnection): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + :ivar location: Resource location. + :vartype location: str + :ivar kind: Required. Kind of the endpoint for the data connection.Constant filled by server. Possible values include: "EventHub", "EventGrid", "IotHub". - :type kind: str or ~azure.mgmt.synapse.models.DataConnectionKind + :vartype kind: str or ~azure.mgmt.synapse.models.DataConnectionKind :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.synapse.models.SystemData - :param storage_account_resource_id: The resource ID of the storage account where the data + :ivar storage_account_resource_id: The resource ID of the storage account where the data resides. - :type storage_account_resource_id: str - :param event_hub_resource_id: The resource ID where the event grid is configured to send - events. - :type event_hub_resource_id: str - :param consumer_group: The event hub consumer group. - :type consumer_group: str - :param table_name: The table where the data should be ingested. Optionally the table + :vartype storage_account_resource_id: str + :ivar event_hub_resource_id: The resource ID where the event grid is configured to send events. + :vartype event_hub_resource_id: str + :ivar consumer_group: The event hub consumer group. + :vartype consumer_group: str + :ivar table_name: The table where the data should be ingested. Optionally the table information + can be added to each message. + :vartype table_name: str + :ivar mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. - :type table_name: str - :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the - mapping information can be added to each message. - :type mapping_rule_name: str - :param data_format: The data format of the message. Optionally the data format can be added to + :vartype mapping_rule_name: str + :ivar data_format: The data format of the message. Optionally the data format can be added to each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", "W3CLOGFILE". - :type data_format: str or ~azure.mgmt.synapse.models.EventGridDataFormat - :param ignore_first_record: A Boolean value that, if set to true, indicates that ingestion + :vartype data_format: str or ~azure.mgmt.synapse.models.EventGridDataFormat + :ivar ignore_first_record: A Boolean value that, if set to true, indicates that ingestion should ignore the first record of every file. - :type ignore_first_record: bool - :param blob_storage_event_type: The name of blob storage event type to process. Possible values + :vartype ignore_first_record: bool + :ivar blob_storage_event_type: The name of blob storage event type to process. Possible values include: "Microsoft.Storage.BlobCreated", "Microsoft.Storage.BlobRenamed". - :type blob_storage_event_type: str or ~azure.mgmt.synapse.models.BlobStorageEventType + :vartype blob_storage_event_type: str or ~azure.mgmt.synapse.models.BlobStorageEventType :ivar provisioning_state: The provisioned state of the resource. Possible values include: "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState @@ -2385,6 +2783,35 @@ def __init__( blob_storage_event_type: Optional[Union[str, "BlobStorageEventType"]] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword storage_account_resource_id: The resource ID of the storage account where the data + resides. + :paramtype storage_account_resource_id: str + :keyword event_hub_resource_id: The resource ID where the event grid is configured to send + events. + :paramtype event_hub_resource_id: str + :keyword consumer_group: The event hub consumer group. + :paramtype consumer_group: str + :keyword table_name: The table where the data should be ingested. Optionally the table + information can be added to each message. + :paramtype table_name: str + :keyword mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the + mapping information can be added to each message. + :paramtype mapping_rule_name: str + :keyword data_format: The data format of the message. Optionally the data format can be added + to each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", + "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", + "W3CLOGFILE". + :paramtype data_format: str or ~azure.mgmt.synapse.models.EventGridDataFormat + :keyword ignore_first_record: A Boolean value that, if set to true, indicates that ingestion + should ignore the first record of every file. + :paramtype ignore_first_record: bool + :keyword blob_storage_event_type: The name of blob storage event type to process. Possible + values include: "Microsoft.Storage.BlobCreated", "Microsoft.Storage.BlobRenamed". + :paramtype blob_storage_event_type: str or ~azure.mgmt.synapse.models.BlobStorageEventType + """ super(EventGridDataConnection, self).__init__(location=location, **kwargs) self.kind = 'EventGrid' # type: str self.storage_account_resource_id = storage_account_resource_id @@ -2413,41 +2840,41 @@ class EventHubDataConnection(DataConnection): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + :ivar location: Resource location. + :vartype location: str + :ivar kind: Required. Kind of the endpoint for the data connection.Constant filled by server. Possible values include: "EventHub", "EventGrid", "IotHub". - :type kind: str or ~azure.mgmt.synapse.models.DataConnectionKind + :vartype kind: str or ~azure.mgmt.synapse.models.DataConnectionKind :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.synapse.models.SystemData - :param event_hub_resource_id: The resource ID of the event hub to be used to create a data + :ivar event_hub_resource_id: The resource ID of the event hub to be used to create a data connection. - :type event_hub_resource_id: str - :param consumer_group: The event hub consumer group. - :type consumer_group: str - :param table_name: The table where the data should be ingested. Optionally the table + :vartype event_hub_resource_id: str + :ivar consumer_group: The event hub consumer group. + :vartype consumer_group: str + :ivar table_name: The table where the data should be ingested. Optionally the table information + can be added to each message. + :vartype table_name: str + :ivar mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. - :type table_name: str - :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the - mapping information can be added to each message. - :type mapping_rule_name: str - :param data_format: The data format of the message. Optionally the data format can be added to + :vartype mapping_rule_name: str + :ivar data_format: The data format of the message. Optionally the data format can be added to each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", "W3CLOGFILE". - :type data_format: str or ~azure.mgmt.synapse.models.EventHubDataFormat - :param event_system_properties: System properties of the event hub. - :type event_system_properties: list[str] - :param compression: The event hub messages compression type. Possible values include: "None", + :vartype data_format: str or ~azure.mgmt.synapse.models.EventHubDataFormat + :ivar event_system_properties: System properties of the event hub. + :vartype event_system_properties: list[str] + :ivar compression: The event hub messages compression type. Possible values include: "None", "GZip". - :type compression: str or ~azure.mgmt.synapse.models.Compression + :vartype compression: str or ~azure.mgmt.synapse.models.Compression :ivar provisioning_state: The provisioned state of the resource. Possible values include: "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState - :param managed_identity_resource_id: The resource ID of a managed identity (system or user + :ivar managed_identity_resource_id: The resource ID of a managed identity (system or user assigned) to be used to authenticate with event hub. - :type managed_identity_resource_id: str + :vartype managed_identity_resource_id: str """ _validation = { @@ -2491,6 +2918,34 @@ def __init__( managed_identity_resource_id: Optional[str] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword event_hub_resource_id: The resource ID of the event hub to be used to create a data + connection. + :paramtype event_hub_resource_id: str + :keyword consumer_group: The event hub consumer group. + :paramtype consumer_group: str + :keyword table_name: The table where the data should be ingested. Optionally the table + information can be added to each message. + :paramtype table_name: str + :keyword mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the + mapping information can be added to each message. + :paramtype mapping_rule_name: str + :keyword data_format: The data format of the message. Optionally the data format can be added + to each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", + "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", + "W3CLOGFILE". + :paramtype data_format: str or ~azure.mgmt.synapse.models.EventHubDataFormat + :keyword event_system_properties: System properties of the event hub. + :paramtype event_system_properties: list[str] + :keyword compression: The event hub messages compression type. Possible values include: "None", + "GZip". + :paramtype compression: str or ~azure.mgmt.synapse.models.Compression + :keyword managed_identity_resource_id: The resource ID of a managed identity (system or user + assigned) to be used to authenticate with event hub. + :paramtype managed_identity_resource_id: str + """ super(EventHubDataConnection, self).__init__(location=location, **kwargs) self.kind = 'EventHub' # type: str self.event_hub_resource_id = event_hub_resource_id @@ -2517,17 +2972,16 @@ class ExtendedServerBlobAuditingPolicy(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param predicate_expression: Specifies condition of where clause when creating an audit. - :type predicate_expression: str - :param state: Specifies the state of the policy. If state is Enabled, storageEndpoint or + :ivar predicate_expression: Specifies condition of where clause when creating an audit. + :vartype predicate_expression: str + :ivar state: Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyState - :param storage_endpoint: Specifies the blob storage endpoint (e.g. + :vartype state: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyState + :ivar storage_endpoint: Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - :type storage_endpoint: str - :param storage_account_access_key: Specifies the identifier key of the auditing storage - account. + :vartype storage_endpoint: str + :ivar storage_account_access_key: Specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. @@ -2539,11 +2993,11 @@ class ExtendedServerBlobAuditingPolicy(ProxyResource): Contributor' RBAC role to the server identity. For more information, see `Auditing to storage using Managed Identity authentication `_. - :type storage_account_access_key: str - :param retention_days: Specifies the number of days to keep in the audit logs in the storage + :vartype storage_account_access_key: str + :ivar retention_days: Specifies the number of days to keep in the audit logs in the storage account. - :type retention_days: int - :param audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit. + :vartype retention_days: int + :ivar audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit. The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and @@ -2611,13 +3065,13 @@ class ExtendedServerBlobAuditingPolicy(ProxyResource): For more information, see `Database-Level Audit Actions `_. - :type audit_actions_and_groups: list[str] - :param storage_account_subscription_id: Specifies the blob storage subscription Id. - :type storage_account_subscription_id: str - :param is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is the + :vartype audit_actions_and_groups: list[str] + :ivar storage_account_subscription_id: Specifies the blob storage subscription Id. + :vartype storage_account_subscription_id: str + :ivar is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is the storage's secondary key. - :type is_storage_secondary_key_in_use: bool - :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure + :vartype is_storage_secondary_key_in_use: bool + :ivar is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. @@ -2633,11 +3087,11 @@ class ExtendedServerBlobAuditingPolicy(ProxyResource): For more information, see `Diagnostic Settings REST API `_ or `Diagnostic Settings PowerShell `_. - :type is_azure_monitor_target_enabled: bool - :param queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before - audit actions are forced to be processed. + :vartype is_azure_monitor_target_enabled: bool + :ivar queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before audit + actions are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. - :type queue_delay_ms: int + :vartype queue_delay_ms: int """ _validation = { @@ -2677,6 +3131,129 @@ def __init__( queue_delay_ms: Optional[int] = None, **kwargs ): + """ + :keyword predicate_expression: Specifies condition of where clause when creating an audit. + :paramtype predicate_expression: str + :keyword state: Specifies the state of the policy. If state is Enabled, storageEndpoint or + isAzureMonitorTargetEnabled are required. Possible values include: "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyState + :keyword storage_endpoint: Specifies the blob storage endpoint (e.g. + https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + isAzureMonitorTargetEnabled is required. + :paramtype storage_endpoint: str + :keyword storage_account_access_key: Specifies the identifier key of the auditing storage + account. + If state is Enabled and storageEndpoint is specified, not specifying the + storageAccountAccessKey will use SQL server system-assigned managed identity to access the + storage. + Prerequisites for using managed identity authentication: + + + #. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). + #. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data + Contributor' RBAC role to the server identity. + For more information, see `Auditing to storage using Managed Identity authentication + `_. + :paramtype storage_account_access_key: str + :keyword retention_days: Specifies the number of days to keep in the audit logs in the storage + account. + :paramtype retention_days: int + :keyword audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit. + + The recommended set of action groups to use is the following combination - this will audit all + the queries and stored procedures executed against the database, as well as successful and + failed logins: + + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + + This above combination is also the set that is configured by default when enabling auditing + from the Azure portal. + + The supported action groups to audit are (note: choose only specific groups that cover your + auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + + These are groups that cover all sql statements and stored procedures executed against the + database, and should not be used in combination with other groups as this will result in + duplicate audit logs. + + For more information, see `Database-Level Audit Action Groups + `_. + + For Database auditing policy, specific Actions can also be specified (note that Actions cannot + be specified for Server auditing policy). The supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + + The general form for defining an action to be audited is: + {action} ON {object} BY {principal} + + Note that :code:`` in the above format can refer to an object like a table, view, or + stored procedure, or an entire database or schema. For the latter cases, the forms + DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + + For more information, see `Database-Level Audit Actions + `_. + :paramtype audit_actions_and_groups: list[str] + :keyword storage_account_subscription_id: Specifies the blob storage subscription Id. + :paramtype storage_account_subscription_id: str + :keyword is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is + the storage's secondary key. + :paramtype is_storage_secondary_key_in_use: bool + :keyword is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure + Monitor. + In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and + 'isAzureMonitorTargetEnabled' as true. + + When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' + diagnostic logs category on the database should be also created. + Note that for server level audit you should use the 'master' database as {databaseName}. + + Diagnostic Settings URI format: + PUT + https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + + For more information, see `Diagnostic Settings REST API + `_ + or `Diagnostic Settings PowerShell `_. + :paramtype is_azure_monitor_target_enabled: bool + :keyword queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before + audit actions are forced to be processed. + The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + :paramtype queue_delay_ms: int + """ super(ExtendedServerBlobAuditingPolicy, self).__init__(**kwargs) self.predicate_expression = predicate_expression self.state = state @@ -2715,6 +3292,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExtendedServerBlobAuditingPolicyListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2733,17 +3312,16 @@ class ExtendedSqlPoolBlobAuditingPolicy(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param predicate_expression: Specifies condition of where clause when creating an audit. - :type predicate_expression: str - :param state: Specifies the state of the policy. If state is Enabled, storageEndpoint or + :ivar predicate_expression: Specifies condition of where clause when creating an audit. + :vartype predicate_expression: str + :ivar state: Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyState - :param storage_endpoint: Specifies the blob storage endpoint (e.g. + :vartype state: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyState + :ivar storage_endpoint: Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - :type storage_endpoint: str - :param storage_account_access_key: Specifies the identifier key of the auditing storage - account. + :vartype storage_endpoint: str + :ivar storage_account_access_key: Specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. @@ -2755,11 +3333,11 @@ class ExtendedSqlPoolBlobAuditingPolicy(ProxyResource): Contributor' RBAC role to the server identity. For more information, see `Auditing to storage using Managed Identity authentication `_. - :type storage_account_access_key: str - :param retention_days: Specifies the number of days to keep in the audit logs in the storage + :vartype storage_account_access_key: str + :ivar retention_days: Specifies the number of days to keep in the audit logs in the storage account. - :type retention_days: int - :param audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit. + :vartype retention_days: int + :ivar audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit. The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and @@ -2827,13 +3405,13 @@ class ExtendedSqlPoolBlobAuditingPolicy(ProxyResource): For more information, see `Database-Level Audit Actions `_. - :type audit_actions_and_groups: list[str] - :param storage_account_subscription_id: Specifies the blob storage subscription Id. - :type storage_account_subscription_id: str - :param is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is the + :vartype audit_actions_and_groups: list[str] + :ivar storage_account_subscription_id: Specifies the blob storage subscription Id. + :vartype storage_account_subscription_id: str + :ivar is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is the storage's secondary key. - :type is_storage_secondary_key_in_use: bool - :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure + :vartype is_storage_secondary_key_in_use: bool + :ivar is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. @@ -2849,11 +3427,11 @@ class ExtendedSqlPoolBlobAuditingPolicy(ProxyResource): For more information, see `Diagnostic Settings REST API `_ or `Diagnostic Settings PowerShell `_. - :type is_azure_monitor_target_enabled: bool - :param queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before - audit actions are forced to be processed. + :vartype is_azure_monitor_target_enabled: bool + :ivar queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before audit + actions are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. - :type queue_delay_ms: int + :vartype queue_delay_ms: int """ _validation = { @@ -2893,6 +3471,129 @@ def __init__( queue_delay_ms: Optional[int] = None, **kwargs ): + """ + :keyword predicate_expression: Specifies condition of where clause when creating an audit. + :paramtype predicate_expression: str + :keyword state: Specifies the state of the policy. If state is Enabled, storageEndpoint or + isAzureMonitorTargetEnabled are required. Possible values include: "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyState + :keyword storage_endpoint: Specifies the blob storage endpoint (e.g. + https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + isAzureMonitorTargetEnabled is required. + :paramtype storage_endpoint: str + :keyword storage_account_access_key: Specifies the identifier key of the auditing storage + account. + If state is Enabled and storageEndpoint is specified, not specifying the + storageAccountAccessKey will use SQL server system-assigned managed identity to access the + storage. + Prerequisites for using managed identity authentication: + + + #. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). + #. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data + Contributor' RBAC role to the server identity. + For more information, see `Auditing to storage using Managed Identity authentication + `_. + :paramtype storage_account_access_key: str + :keyword retention_days: Specifies the number of days to keep in the audit logs in the storage + account. + :paramtype retention_days: int + :keyword audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit. + + The recommended set of action groups to use is the following combination - this will audit all + the queries and stored procedures executed against the database, as well as successful and + failed logins: + + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + + This above combination is also the set that is configured by default when enabling auditing + from the Azure portal. + + The supported action groups to audit are (note: choose only specific groups that cover your + auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + + These are groups that cover all sql statements and stored procedures executed against the + database, and should not be used in combination with other groups as this will result in + duplicate audit logs. + + For more information, see `Database-Level Audit Action Groups + `_. + + For Database auditing policy, specific Actions can also be specified (note that Actions cannot + be specified for Server auditing policy). The supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + + The general form for defining an action to be audited is: + {action} ON {object} BY {principal} + + Note that :code:`` in the above format can refer to an object like a table, view, or + stored procedure, or an entire database or schema. For the latter cases, the forms + DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + + For more information, see `Database-Level Audit Actions + `_. + :paramtype audit_actions_and_groups: list[str] + :keyword storage_account_subscription_id: Specifies the blob storage subscription Id. + :paramtype storage_account_subscription_id: str + :keyword is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is + the storage's secondary key. + :paramtype is_storage_secondary_key_in_use: bool + :keyword is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure + Monitor. + In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and + 'isAzureMonitorTargetEnabled' as true. + + When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' + diagnostic logs category on the database should be also created. + Note that for server level audit you should use the 'master' database as {databaseName}. + + Diagnostic Settings URI format: + PUT + https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + + For more information, see `Diagnostic Settings REST API + `_ + or `Diagnostic Settings PowerShell `_. + :paramtype is_azure_monitor_target_enabled: bool + :keyword queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before + audit actions are forced to be processed. + The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + :paramtype queue_delay_ms: int + """ super(ExtendedSqlPoolBlobAuditingPolicy, self).__init__(**kwargs) self.predicate_expression = predicate_expression self.state = state @@ -2931,6 +3632,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExtendedSqlPoolBlobAuditingPolicyListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2943,12 +3646,12 @@ class FollowerDatabaseDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param kusto_pool_resource_id: Required. Resource id of the cluster that follows a database + :ivar kusto_pool_resource_id: Required. Resource id of the cluster that follows a database owned by this cluster. - :type kusto_pool_resource_id: str - :param attached_database_configuration_name: Required. Resource name of the attached database + :vartype kusto_pool_resource_id: str + :ivar attached_database_configuration_name: Required. Resource name of the attached database configuration in the follower cluster. - :type attached_database_configuration_name: str + :vartype attached_database_configuration_name: str :ivar database_name: The database name owned by this cluster that was followed. * in case following all databases. :vartype database_name: str @@ -2973,6 +3676,14 @@ def __init__( attached_database_configuration_name: str, **kwargs ): + """ + :keyword kusto_pool_resource_id: Required. Resource id of the cluster that follows a database + owned by this cluster. + :paramtype kusto_pool_resource_id: str + :keyword attached_database_configuration_name: Required. Resource name of the attached database + configuration in the follower cluster. + :paramtype attached_database_configuration_name: str + """ super(FollowerDatabaseDefinition, self).__init__(**kwargs) self.kusto_pool_resource_id = kusto_pool_resource_id self.attached_database_configuration_name = attached_database_configuration_name @@ -2982,8 +3693,8 @@ def __init__( class FollowerDatabaseListResult(msrest.serialization.Model): """The list Kusto database principals operation response. - :param value: The list of follower database result. - :type value: list[~azure.mgmt.synapse.models.FollowerDatabaseDefinition] + :ivar value: The list of follower database result. + :vartype value: list[~azure.mgmt.synapse.models.FollowerDatabaseDefinition] """ _attribute_map = { @@ -2996,6 +3707,10 @@ def __init__( value: Optional[List["FollowerDatabaseDefinition"]] = None, **kwargs ): + """ + :keyword value: The list of follower database result. + :paramtype value: list[~azure.mgmt.synapse.models.FollowerDatabaseDefinition] + """ super(FollowerDatabaseListResult, self).__init__(**kwargs) self.value = value @@ -3019,9 +3734,9 @@ class GeoBackupPolicy(ProxyResource): :vartype kind: str :ivar location: Backup policy location. :vartype location: str - :param state: Required. The state of the geo backup policy. Possible values include: - "Disabled", "Enabled". - :type state: str or ~azure.mgmt.synapse.models.GeoBackupPolicyState + :ivar state: Required. The state of the geo backup policy. Possible values include: "Disabled", + "Enabled". + :vartype state: str or ~azure.mgmt.synapse.models.GeoBackupPolicyState :ivar storage_type: The storage type of the geo backup policy. :vartype storage_type: str """ @@ -3052,6 +3767,11 @@ def __init__( state: Union[str, "GeoBackupPolicyState"], **kwargs ): + """ + :keyword state: Required. The state of the geo backup policy. Possible values include: + "Disabled", "Enabled". + :paramtype state: str or ~azure.mgmt.synapse.models.GeoBackupPolicyState + """ super(GeoBackupPolicy, self).__init__(**kwargs) self.kind = None self.location = None @@ -3062,8 +3782,8 @@ def __init__( class GeoBackupPolicyListResult(msrest.serialization.Model): """The response to a list geo backup policies request. - :param value: The list of geo backup policies. - :type value: list[~azure.mgmt.synapse.models.GeoBackupPolicy] + :ivar value: The list of geo backup policies. + :vartype value: list[~azure.mgmt.synapse.models.GeoBackupPolicy] """ _attribute_map = { @@ -3076,6 +3796,10 @@ def __init__( value: Optional[List["GeoBackupPolicy"]] = None, **kwargs ): + """ + :keyword value: The list of geo backup policies. + :paramtype value: list[~azure.mgmt.synapse.models.GeoBackupPolicy] + """ super(GeoBackupPolicyListResult, self).__init__(**kwargs) self.value = value @@ -3083,8 +3807,8 @@ def __init__( class GetSsisObjectMetadataRequest(msrest.serialization.Model): """The request payload of get SSIS object metadata. - :param metadata_path: Metadata path. - :type metadata_path: str + :ivar metadata_path: Metadata path. + :vartype metadata_path: str """ _attribute_map = { @@ -3097,6 +3821,10 @@ def __init__( metadata_path: Optional[str] = None, **kwargs ): + """ + :keyword metadata_path: Metadata path. + :paramtype metadata_path: str + """ super(GetSsisObjectMetadataRequest, self).__init__(**kwargs) self.metadata_path = metadata_path @@ -3109,14 +3837,14 @@ class IntegrationRuntime(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, any] - :param type: Required. Type of integration runtime.Constant filled by server. Possible values + :vartype additional_properties: dict[str, any] + :ivar type: Required. Type of integration runtime.Constant filled by server. Possible values include: "Managed", "SelfHosted". - :type type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeType - :param description: Integration runtime description. - :type description: str + :vartype type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeType + :ivar description: Integration runtime description. + :vartype description: str """ _validation = { @@ -3140,6 +3868,13 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword description: Integration runtime description. + :paramtype description: str + """ super(IntegrationRuntime, self).__init__(**kwargs) self.additional_properties = additional_properties self.type = 'IntegrationRuntime' # type: str @@ -3149,10 +3884,10 @@ def __init__( class IntegrationRuntimeAuthKeys(msrest.serialization.Model): """The integration runtime authentication keys. - :param auth_key1: The primary integration runtime authentication key. - :type auth_key1: str - :param auth_key2: The secondary integration runtime authentication key. - :type auth_key2: str + :ivar auth_key1: The primary integration runtime authentication key. + :vartype auth_key1: str + :ivar auth_key2: The secondary integration runtime authentication key. + :vartype auth_key2: str """ _attribute_map = { @@ -3167,6 +3902,12 @@ def __init__( auth_key2: Optional[str] = None, **kwargs ): + """ + :keyword auth_key1: The primary integration runtime authentication key. + :paramtype auth_key1: str + :keyword auth_key2: The secondary integration runtime authentication key. + :paramtype auth_key2: str + """ super(IntegrationRuntimeAuthKeys, self).__init__(**kwargs) self.auth_key1 = auth_key1 self.auth_key2 = auth_key2 @@ -3175,24 +3916,24 @@ def __init__( class IntegrationRuntimeComputeProperties(msrest.serialization.Model): """The compute resource properties for managed integration runtime. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, any] - :param location: The location for managed integration runtime. The supported regions could be + :vartype additional_properties: dict[str, any] + :ivar location: The location for managed integration runtime. The supported regions could be found on https://docs.microsoft.com/en-us/azure/data-factory/data-factory-data-movement-activities. - :type location: str - :param node_size: The node size requirement to managed integration runtime. - :type node_size: str - :param number_of_nodes: The required number of nodes for managed integration runtime. - :type number_of_nodes: int - :param max_parallel_executions_per_node: Maximum parallel executions count per node for managed + :vartype location: str + :ivar node_size: The node size requirement to managed integration runtime. + :vartype node_size: str + :ivar number_of_nodes: The required number of nodes for managed integration runtime. + :vartype number_of_nodes: int + :ivar max_parallel_executions_per_node: Maximum parallel executions count per node for managed integration runtime. - :type max_parallel_executions_per_node: int - :param data_flow_properties: Data flow properties for managed integration runtime. - :type data_flow_properties: ~azure.mgmt.synapse.models.IntegrationRuntimeDataFlowProperties - :param v_net_properties: VNet properties for managed integration runtime. - :type v_net_properties: ~azure.mgmt.synapse.models.IntegrationRuntimeVNetProperties + :vartype max_parallel_executions_per_node: int + :ivar data_flow_properties: Data flow properties for managed integration runtime. + :vartype data_flow_properties: ~azure.mgmt.synapse.models.IntegrationRuntimeDataFlowProperties + :ivar v_net_properties: VNet properties for managed integration runtime. + :vartype v_net_properties: ~azure.mgmt.synapse.models.IntegrationRuntimeVNetProperties """ _validation = { @@ -3222,6 +3963,27 @@ def __init__( v_net_properties: Optional["IntegrationRuntimeVNetProperties"] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword location: The location for managed integration runtime. The supported regions could be + found on + https://docs.microsoft.com/en-us/azure/data-factory/data-factory-data-movement-activities. + :paramtype location: str + :keyword node_size: The node size requirement to managed integration runtime. + :paramtype node_size: str + :keyword number_of_nodes: The required number of nodes for managed integration runtime. + :paramtype number_of_nodes: int + :keyword max_parallel_executions_per_node: Maximum parallel executions count per node for + managed integration runtime. + :paramtype max_parallel_executions_per_node: int + :keyword data_flow_properties: Data flow properties for managed integration runtime. + :paramtype data_flow_properties: + ~azure.mgmt.synapse.models.IntegrationRuntimeDataFlowProperties + :keyword v_net_properties: VNet properties for managed integration runtime. + :paramtype v_net_properties: ~azure.mgmt.synapse.models.IntegrationRuntimeVNetProperties + """ super(IntegrationRuntimeComputeProperties, self).__init__(**kwargs) self.additional_properties = additional_properties self.location = location @@ -3237,9 +3999,9 @@ class IntegrationRuntimeConnectionInfo(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, any] + :vartype additional_properties: dict[str, any] :ivar service_token: The token generated in service. Callers use this token to authenticate to integration runtime. :vartype service_token: str @@ -3282,6 +4044,11 @@ def __init__( additional_properties: Optional[Dict[str, Any]] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + """ super(IntegrationRuntimeConnectionInfo, self).__init__(**kwargs) self.additional_properties = additional_properties self.service_token = None @@ -3295,11 +4062,11 @@ def __init__( class IntegrationRuntimeCustomSetupScriptProperties(msrest.serialization.Model): """Custom setup script properties for a managed dedicated integration runtime. - :param blob_container_uri: The URI of the Azure blob container that contains the custom setup + :ivar blob_container_uri: The URI of the Azure blob container that contains the custom setup script. - :type blob_container_uri: str - :param sas_token: The SAS token of the Azure blob container. - :type sas_token: ~azure.mgmt.synapse.models.SecureString + :vartype blob_container_uri: str + :ivar sas_token: The SAS token of the Azure blob container. + :vartype sas_token: ~azure.mgmt.synapse.models.SecureString """ _attribute_map = { @@ -3314,6 +4081,13 @@ def __init__( sas_token: Optional["SecureString"] = None, **kwargs ): + """ + :keyword blob_container_uri: The URI of the Azure blob container that contains the custom setup + script. + :paramtype blob_container_uri: str + :keyword sas_token: The SAS token of the Azure blob container. + :paramtype sas_token: ~azure.mgmt.synapse.models.SecureString + """ super(IntegrationRuntimeCustomSetupScriptProperties, self).__init__(**kwargs) self.blob_container_uri = blob_container_uri self.sas_token = sas_token @@ -3322,21 +4096,21 @@ def __init__( class IntegrationRuntimeDataFlowProperties(msrest.serialization.Model): """Data flow properties for managed integration runtime. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, any] - :param compute_type: Compute type of the cluster which will execute data flow job. Possible + :vartype additional_properties: dict[str, any] + :ivar compute_type: Compute type of the cluster which will execute data flow job. Possible values include: "General", "MemoryOptimized", "ComputeOptimized". - :type compute_type: str or ~azure.mgmt.synapse.models.DataFlowComputeType - :param core_count: Core count of the cluster which will execute data flow job. Supported values + :vartype compute_type: str or ~azure.mgmt.synapse.models.DataFlowComputeType + :ivar core_count: Core count of the cluster which will execute data flow job. Supported values are: 8, 16, 32, 48, 80, 144 and 272. - :type core_count: int - :param time_to_live: Time to live (in minutes) setting of the cluster which will execute data + :vartype core_count: int + :ivar time_to_live: Time to live (in minutes) setting of the cluster which will execute data flow job. - :type time_to_live: int - :param cleanup: Cluster will not be recycled and it will be used in next data flow activity run + :vartype time_to_live: int + :ivar cleanup: Cluster will not be recycled and it will be used in next data flow activity run until TTL (time to live) is reached if this is set as false. Default is true. - :type cleanup: bool + :vartype cleanup: bool """ _validation = { @@ -3361,6 +4135,23 @@ def __init__( cleanup: Optional[bool] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword compute_type: Compute type of the cluster which will execute data flow job. Possible + values include: "General", "MemoryOptimized", "ComputeOptimized". + :paramtype compute_type: str or ~azure.mgmt.synapse.models.DataFlowComputeType + :keyword core_count: Core count of the cluster which will execute data flow job. Supported + values are: 8, 16, 32, 48, 80, 144 and 272. + :paramtype core_count: int + :keyword time_to_live: Time to live (in minutes) setting of the cluster which will execute data + flow job. + :paramtype time_to_live: int + :keyword cleanup: Cluster will not be recycled and it will be used in next data flow activity + run until TTL (time to live) is reached if this is set as false. Default is true. + :paramtype cleanup: bool + """ super(IntegrationRuntimeDataFlowProperties, self).__init__(**kwargs) self.additional_properties = additional_properties self.compute_type = compute_type @@ -3372,12 +4163,12 @@ def __init__( class IntegrationRuntimeDataProxyProperties(msrest.serialization.Model): """Data proxy properties for a managed dedicated integration runtime. - :param connect_via: The self-hosted integration runtime reference. - :type connect_via: ~azure.mgmt.synapse.models.EntityReference - :param staging_linked_service: The staging linked service reference. - :type staging_linked_service: ~azure.mgmt.synapse.models.EntityReference - :param path: The path to contain the staged data in the Blob storage. - :type path: str + :ivar connect_via: The self-hosted integration runtime reference. + :vartype connect_via: ~azure.mgmt.synapse.models.EntityReference + :ivar staging_linked_service: The staging linked service reference. + :vartype staging_linked_service: ~azure.mgmt.synapse.models.EntityReference + :ivar path: The path to contain the staged data in the Blob storage. + :vartype path: str """ _attribute_map = { @@ -3394,6 +4185,14 @@ def __init__( path: Optional[str] = None, **kwargs ): + """ + :keyword connect_via: The self-hosted integration runtime reference. + :paramtype connect_via: ~azure.mgmt.synapse.models.EntityReference + :keyword staging_linked_service: The staging linked service reference. + :paramtype staging_linked_service: ~azure.mgmt.synapse.models.EntityReference + :keyword path: The path to contain the staged data in the Blob storage. + :paramtype path: str + """ super(IntegrationRuntimeDataProxyProperties, self).__init__(**kwargs) self.connect_via = connect_via self.staging_linked_service = staging_linked_service @@ -3405,10 +4204,10 @@ class IntegrationRuntimeListResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. List of integration runtimes. - :type value: list[~azure.mgmt.synapse.models.IntegrationRuntimeResource] - :param next_link: The link to the next page of results, if any remaining results exist. - :type next_link: str + :ivar value: Required. List of integration runtimes. + :vartype value: list[~azure.mgmt.synapse.models.IntegrationRuntimeResource] + :ivar next_link: The link to the next page of results, if any remaining results exist. + :vartype next_link: str """ _validation = { @@ -3427,6 +4226,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. List of integration runtimes. + :paramtype value: list[~azure.mgmt.synapse.models.IntegrationRuntimeResource] + :keyword next_link: The link to the next page of results, if any remaining results exist. + :paramtype next_link: str + """ super(IntegrationRuntimeListResponse, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3435,10 +4240,10 @@ def __init__( class IntegrationRuntimeMonitoringData(msrest.serialization.Model): """Get monitoring data response. - :param name: Integration runtime name. - :type name: str - :param nodes: Integration runtime node monitoring data. - :type nodes: list[~azure.mgmt.synapse.models.IntegrationRuntimeNodeMonitoringData] + :ivar name: Integration runtime name. + :vartype name: str + :ivar nodes: Integration runtime node monitoring data. + :vartype nodes: list[~azure.mgmt.synapse.models.IntegrationRuntimeNodeMonitoringData] """ _attribute_map = { @@ -3453,6 +4258,12 @@ def __init__( nodes: Optional[List["IntegrationRuntimeNodeMonitoringData"]] = None, **kwargs ): + """ + :keyword name: Integration runtime name. + :paramtype name: str + :keyword nodes: Integration runtime node monitoring data. + :paramtype nodes: list[~azure.mgmt.synapse.models.IntegrationRuntimeNodeMonitoringData] + """ super(IntegrationRuntimeMonitoringData, self).__init__(**kwargs) self.name = name self.nodes = nodes @@ -3479,6 +4290,8 @@ def __init__( self, **kwargs ): + """ + """ super(IntegrationRuntimeNodeIpAddress, self).__init__(**kwargs) self.ip_address = None @@ -3488,9 +4301,9 @@ class IntegrationRuntimeNodeMonitoringData(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, any] + :vartype additional_properties: dict[str, any] :ivar node_name: Name of the integration runtime node. :vartype node_name: str :ivar available_memory_in_mb: Available memory (MB) on the integration runtime node. @@ -3539,6 +4352,11 @@ def __init__( additional_properties: Optional[Dict[str, Any]] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + """ super(IntegrationRuntimeNodeMonitoringData, self).__init__(**kwargs) self.additional_properties = additional_properties self.node_name = None @@ -3554,10 +4372,10 @@ def __init__( class IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint(msrest.serialization.Model): """Azure-SSIS integration runtime outbound network dependency endpoints for one category. - :param category: The category of outbound network dependency. - :type category: str - :param endpoints: The endpoints for outbound network dependency. - :type endpoints: + :ivar category: The category of outbound network dependency. + :vartype category: str + :ivar endpoints: The endpoints for outbound network dependency. + :vartype endpoints: list[~azure.mgmt.synapse.models.IntegrationRuntimeOutboundNetworkDependenciesEndpoint] """ @@ -3573,6 +4391,13 @@ def __init__( endpoints: Optional[List["IntegrationRuntimeOutboundNetworkDependenciesEndpoint"]] = None, **kwargs ): + """ + :keyword category: The category of outbound network dependency. + :paramtype category: str + :keyword endpoints: The endpoints for outbound network dependency. + :paramtype endpoints: + list[~azure.mgmt.synapse.models.IntegrationRuntimeOutboundNetworkDependenciesEndpoint] + """ super(IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint, self).__init__(**kwargs) self.category = category self.endpoints = endpoints @@ -3581,10 +4406,10 @@ def __init__( class IntegrationRuntimeOutboundNetworkDependenciesEndpoint(msrest.serialization.Model): """The endpoint for Azure-SSIS integration runtime outbound network dependency. - :param domain_name: The domain name of endpoint. - :type domain_name: str - :param endpoint_details: The details of endpoint. - :type endpoint_details: + :ivar domain_name: The domain name of endpoint. + :vartype domain_name: str + :ivar endpoint_details: The details of endpoint. + :vartype endpoint_details: list[~azure.mgmt.synapse.models.IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails] """ @@ -3600,6 +4425,13 @@ def __init__( endpoint_details: Optional[List["IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails"]] = None, **kwargs ): + """ + :keyword domain_name: The domain name of endpoint. + :paramtype domain_name: str + :keyword endpoint_details: The details of endpoint. + :paramtype endpoint_details: + list[~azure.mgmt.synapse.models.IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails] + """ super(IntegrationRuntimeOutboundNetworkDependenciesEndpoint, self).__init__(**kwargs) self.domain_name = domain_name self.endpoint_details = endpoint_details @@ -3608,8 +4440,8 @@ def __init__( class IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails(msrest.serialization.Model): """The details of Azure-SSIS integration runtime outbound network dependency endpoint. - :param port: The port of endpoint. - :type port: int + :ivar port: The port of endpoint. + :vartype port: int """ _attribute_map = { @@ -3622,6 +4454,10 @@ def __init__( port: Optional[int] = None, **kwargs ): + """ + :keyword port: The port of endpoint. + :paramtype port: int + """ super(IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails, self).__init__(**kwargs) self.port = port @@ -3629,8 +4465,8 @@ def __init__( class IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse(msrest.serialization.Model): """Azure-SSIS integration runtime outbound network dependency endpoints. - :param value: The list of outbound network dependency endpoints. - :type value: + :ivar value: The list of outbound network dependency endpoints. + :vartype value: list[~azure.mgmt.synapse.models.IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint] """ @@ -3644,6 +4480,11 @@ def __init__( value: Optional[List["IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint"]] = None, **kwargs ): + """ + :keyword value: The list of outbound network dependency endpoints. + :paramtype value: + list[~azure.mgmt.synapse.models.IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint] + """ super(IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse, self).__init__(**kwargs) self.value = value @@ -3651,9 +4492,9 @@ def __init__( class IntegrationRuntimeRegenerateKeyParameters(msrest.serialization.Model): """Parameters to regenerate the authentication key. - :param key_name: The name of the authentication key to regenerate. Possible values include: + :ivar key_name: The name of the authentication key to regenerate. Possible values include: "authKey1", "authKey2". - :type key_name: str or ~azure.mgmt.synapse.models.IntegrationRuntimeAuthKeyName + :vartype key_name: str or ~azure.mgmt.synapse.models.IntegrationRuntimeAuthKeyName """ _attribute_map = { @@ -3666,6 +4507,11 @@ def __init__( key_name: Optional[Union[str, "IntegrationRuntimeAuthKeyName"]] = None, **kwargs ): + """ + :keyword key_name: The name of the authentication key to regenerate. Possible values include: + "authKey1", "authKey2". + :paramtype key_name: str or ~azure.mgmt.synapse.models.IntegrationRuntimeAuthKeyName + """ super(IntegrationRuntimeRegenerateKeyParameters, self).__init__(**kwargs) self.key_name = key_name @@ -3705,6 +4551,8 @@ def __init__( self, **kwargs ): + """ + """ super(SubResource, self).__init__(**kwargs) @@ -3725,8 +4573,8 @@ class IntegrationRuntimeResource(SubResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param properties: Required. Integration runtime properties. - :type properties: ~azure.mgmt.synapse.models.IntegrationRuntime + :ivar properties: Required. Integration runtime properties. + :vartype properties: ~azure.mgmt.synapse.models.IntegrationRuntime """ _validation = { @@ -3751,6 +4599,10 @@ def __init__( properties: "IntegrationRuntime", **kwargs ): + """ + :keyword properties: Required. Integration runtime properties. + :paramtype properties: ~azure.mgmt.synapse.models.IntegrationRuntime + """ super(IntegrationRuntimeResource, self).__init__(**kwargs) self.properties = properties @@ -3758,20 +4610,20 @@ def __init__( class IntegrationRuntimeSsisCatalogInfo(msrest.serialization.Model): """Catalog information for managed dedicated integration runtime. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, any] - :param catalog_server_endpoint: The catalog database server URL. - :type catalog_server_endpoint: str - :param catalog_admin_user_name: The administrator user name of catalog database. - :type catalog_admin_user_name: str - :param catalog_admin_password: The password of the administrator user account of the catalog + :vartype additional_properties: dict[str, any] + :ivar catalog_server_endpoint: The catalog database server URL. + :vartype catalog_server_endpoint: str + :ivar catalog_admin_user_name: The administrator user name of catalog database. + :vartype catalog_admin_user_name: str + :ivar catalog_admin_password: The password of the administrator user account of the catalog database. - :type catalog_admin_password: ~azure.mgmt.synapse.models.SecureString - :param catalog_pricing_tier: The pricing tier for the catalog database. The valid values could + :vartype catalog_admin_password: ~azure.mgmt.synapse.models.SecureString + :ivar catalog_pricing_tier: The pricing tier for the catalog database. The valid values could be found in https://azure.microsoft.com/en-us/pricing/details/sql-database/. Possible values include: "Basic", "Standard", "Premium", "PremiumRS". - :type catalog_pricing_tier: str or + :vartype catalog_pricing_tier: str or ~azure.mgmt.synapse.models.IntegrationRuntimeSsisCatalogPricingTier """ @@ -3797,6 +4649,23 @@ def __init__( catalog_pricing_tier: Optional[Union[str, "IntegrationRuntimeSsisCatalogPricingTier"]] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword catalog_server_endpoint: The catalog database server URL. + :paramtype catalog_server_endpoint: str + :keyword catalog_admin_user_name: The administrator user name of catalog database. + :paramtype catalog_admin_user_name: str + :keyword catalog_admin_password: The password of the administrator user account of the catalog + database. + :paramtype catalog_admin_password: ~azure.mgmt.synapse.models.SecureString + :keyword catalog_pricing_tier: The pricing tier for the catalog database. The valid values + could be found in https://azure.microsoft.com/en-us/pricing/details/sql-database/. Possible + values include: "Basic", "Standard", "Premium", "PremiumRS". + :paramtype catalog_pricing_tier: str or + ~azure.mgmt.synapse.models.IntegrationRuntimeSsisCatalogPricingTier + """ super(IntegrationRuntimeSsisCatalogInfo, self).__init__(**kwargs) self.additional_properties = additional_properties self.catalog_server_endpoint = catalog_server_endpoint @@ -3808,27 +4677,27 @@ def __init__( class IntegrationRuntimeSsisProperties(msrest.serialization.Model): """SSIS properties for managed integration runtime. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, any] - :param catalog_info: Catalog information for managed dedicated integration runtime. - :type catalog_info: ~azure.mgmt.synapse.models.IntegrationRuntimeSsisCatalogInfo - :param license_type: License type for bringing your own license scenario. Possible values + :vartype additional_properties: dict[str, any] + :ivar catalog_info: Catalog information for managed dedicated integration runtime. + :vartype catalog_info: ~azure.mgmt.synapse.models.IntegrationRuntimeSsisCatalogInfo + :ivar license_type: License type for bringing your own license scenario. Possible values include: "BasePrice", "LicenseIncluded". - :type license_type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeLicenseType - :param custom_setup_script_properties: Custom setup script properties for a managed dedicated + :vartype license_type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeLicenseType + :ivar custom_setup_script_properties: Custom setup script properties for a managed dedicated integration runtime. - :type custom_setup_script_properties: + :vartype custom_setup_script_properties: ~azure.mgmt.synapse.models.IntegrationRuntimeCustomSetupScriptProperties - :param data_proxy_properties: Data proxy properties for a managed dedicated integration - runtime. - :type data_proxy_properties: ~azure.mgmt.synapse.models.IntegrationRuntimeDataProxyProperties - :param edition: The edition for the SSIS Integration Runtime. Possible values include: + :ivar data_proxy_properties: Data proxy properties for a managed dedicated integration runtime. + :vartype data_proxy_properties: + ~azure.mgmt.synapse.models.IntegrationRuntimeDataProxyProperties + :ivar edition: The edition for the SSIS Integration Runtime. Possible values include: "Standard", "Enterprise". - :type edition: str or ~azure.mgmt.synapse.models.IntegrationRuntimeEdition - :param express_custom_setup_properties: Custom setup without script properties for a SSIS + :vartype edition: str or ~azure.mgmt.synapse.models.IntegrationRuntimeEdition + :ivar express_custom_setup_properties: Custom setup without script properties for a SSIS integration runtime. - :type express_custom_setup_properties: list[~azure.mgmt.synapse.models.CustomSetupBase] + :vartype express_custom_setup_properties: list[~azure.mgmt.synapse.models.CustomSetupBase] """ _attribute_map = { @@ -3853,6 +4722,30 @@ def __init__( express_custom_setup_properties: Optional[List["CustomSetupBase"]] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword catalog_info: Catalog information for managed dedicated integration runtime. + :paramtype catalog_info: ~azure.mgmt.synapse.models.IntegrationRuntimeSsisCatalogInfo + :keyword license_type: License type for bringing your own license scenario. Possible values + include: "BasePrice", "LicenseIncluded". + :paramtype license_type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeLicenseType + :keyword custom_setup_script_properties: Custom setup script properties for a managed dedicated + integration runtime. + :paramtype custom_setup_script_properties: + ~azure.mgmt.synapse.models.IntegrationRuntimeCustomSetupScriptProperties + :keyword data_proxy_properties: Data proxy properties for a managed dedicated integration + runtime. + :paramtype data_proxy_properties: + ~azure.mgmt.synapse.models.IntegrationRuntimeDataProxyProperties + :keyword edition: The edition for the SSIS Integration Runtime. Possible values include: + "Standard", "Enterprise". + :paramtype edition: str or ~azure.mgmt.synapse.models.IntegrationRuntimeEdition + :keyword express_custom_setup_properties: Custom setup without script properties for a SSIS + integration runtime. + :paramtype express_custom_setup_properties: list[~azure.mgmt.synapse.models.CustomSetupBase] + """ super(IntegrationRuntimeSsisProperties, self).__init__(**kwargs) self.additional_properties = additional_properties self.catalog_info = catalog_info @@ -3873,12 +4766,12 @@ class IntegrationRuntimeStatus(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, any] - :param type: Required. Type of integration runtime.Constant filled by server. Possible values + :vartype additional_properties: dict[str, any] + :ivar type: Required. Type of integration runtime.Constant filled by server. Possible values include: "Managed", "SelfHosted". - :type type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeType + :vartype type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeType :ivar data_factory_name: The workspace name which the integration runtime belong to. :vartype data_factory_name: str :ivar state: The state of integration runtime. Possible values include: "Initial", "Stopped", @@ -3910,6 +4803,11 @@ def __init__( additional_properties: Optional[Dict[str, Any]] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + """ super(IntegrationRuntimeStatus, self).__init__(**kwargs) self.additional_properties = additional_properties self.type = 'IntegrationRuntimeStatus' # type: str @@ -3926,8 +4824,8 @@ class IntegrationRuntimeStatusResponse(msrest.serialization.Model): :ivar name: The integration runtime name. :vartype name: str - :param properties: Required. Integration runtime properties. - :type properties: ~azure.mgmt.synapse.models.IntegrationRuntimeStatus + :ivar properties: Required. Integration runtime properties. + :vartype properties: ~azure.mgmt.synapse.models.IntegrationRuntimeStatus """ _validation = { @@ -3946,6 +4844,10 @@ def __init__( properties: "IntegrationRuntimeStatus", **kwargs ): + """ + :keyword properties: Required. Integration runtime properties. + :paramtype properties: ~azure.mgmt.synapse.models.IntegrationRuntimeStatus + """ super(IntegrationRuntimeStatusResponse, self).__init__(**kwargs) self.name = None self.properties = properties @@ -3954,19 +4856,18 @@ def __init__( class IntegrationRuntimeVNetProperties(msrest.serialization.Model): """VNet properties for managed integration runtime. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, any] - :param v_net_id: The ID of the VNet that this integration runtime will join. - :type v_net_id: str - :param subnet: The name of the subnet this integration runtime will join. - :type subnet: str - :param public_i_ps: Resource IDs of the public IP addresses that this integration runtime will + :vartype additional_properties: dict[str, any] + :ivar v_net_id: The ID of the VNet that this integration runtime will join. + :vartype v_net_id: str + :ivar subnet: The name of the subnet this integration runtime will join. + :vartype subnet: str + :ivar public_i_ps: Resource IDs of the public IP addresses that this integration runtime will use. - :type public_i_ps: list[str] - :param subnet_id: The ID of subnet, to which this Azure-SSIS integration runtime will be - joined. - :type subnet_id: str + :vartype public_i_ps: list[str] + :ivar subnet_id: The ID of subnet, to which this Azure-SSIS integration runtime will be joined. + :vartype subnet_id: str """ _attribute_map = { @@ -3987,6 +4888,21 @@ def __init__( subnet_id: Optional[str] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword v_net_id: The ID of the VNet that this integration runtime will join. + :paramtype v_net_id: str + :keyword subnet: The name of the subnet this integration runtime will join. + :paramtype subnet: str + :keyword public_i_ps: Resource IDs of the public IP addresses that this integration runtime + will use. + :paramtype public_i_ps: list[str] + :keyword subnet_id: The ID of subnet, to which this Azure-SSIS integration runtime will be + joined. + :paramtype subnet_id: str + """ super(IntegrationRuntimeVNetProperties, self).__init__(**kwargs) self.additional_properties = additional_properties self.v_net_id = v_net_id @@ -4010,34 +4926,34 @@ class IotHubDataConnection(DataConnection): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + :ivar location: Resource location. + :vartype location: str + :ivar kind: Required. Kind of the endpoint for the data connection.Constant filled by server. Possible values include: "EventHub", "EventGrid", "IotHub". - :type kind: str or ~azure.mgmt.synapse.models.DataConnectionKind + :vartype kind: str or ~azure.mgmt.synapse.models.DataConnectionKind :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.synapse.models.SystemData - :param iot_hub_resource_id: The resource ID of the Iot hub to be used to create a data + :ivar iot_hub_resource_id: The resource ID of the Iot hub to be used to create a data connection. - :type iot_hub_resource_id: str - :param consumer_group: The iot hub consumer group. - :type consumer_group: str - :param table_name: The table where the data should be ingested. Optionally the table + :vartype iot_hub_resource_id: str + :ivar consumer_group: The iot hub consumer group. + :vartype consumer_group: str + :ivar table_name: The table where the data should be ingested. Optionally the table information + can be added to each message. + :vartype table_name: str + :ivar mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. - :type table_name: str - :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the - mapping information can be added to each message. - :type mapping_rule_name: str - :param data_format: The data format of the message. Optionally the data format can be added to + :vartype mapping_rule_name: str + :ivar data_format: The data format of the message. Optionally the data format can be added to each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", "W3CLOGFILE". - :type data_format: str or ~azure.mgmt.synapse.models.IotHubDataFormat - :param event_system_properties: System properties of the iot hub. - :type event_system_properties: list[str] - :param shared_access_policy_name: The name of the share access policy. - :type shared_access_policy_name: str + :vartype data_format: str or ~azure.mgmt.synapse.models.IotHubDataFormat + :ivar event_system_properties: System properties of the iot hub. + :vartype event_system_properties: list[str] + :ivar shared_access_policy_name: The name of the share access policy. + :vartype shared_access_policy_name: str :ivar provisioning_state: The provisioned state of the resource. Possible values include: "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState @@ -4082,6 +4998,30 @@ def __init__( shared_access_policy_name: Optional[str] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword iot_hub_resource_id: The resource ID of the Iot hub to be used to create a data + connection. + :paramtype iot_hub_resource_id: str + :keyword consumer_group: The iot hub consumer group. + :paramtype consumer_group: str + :keyword table_name: The table where the data should be ingested. Optionally the table + information can be added to each message. + :paramtype table_name: str + :keyword mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the + mapping information can be added to each message. + :paramtype mapping_rule_name: str + :keyword data_format: The data format of the message. Optionally the data format can be added + to each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", + "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", + "W3CLOGFILE". + :paramtype data_format: str or ~azure.mgmt.synapse.models.IotHubDataFormat + :keyword event_system_properties: System properties of the iot hub. + :paramtype event_system_properties: list[str] + :keyword shared_access_policy_name: The name of the share access policy. + :paramtype shared_access_policy_name: str + """ super(IotHubDataConnection, self).__init__(location=location, **kwargs) self.kind = 'IotHub' # type: str self.iot_hub_resource_id = iot_hub_resource_id @@ -4107,14 +5047,14 @@ class IpFirewallRuleInfo(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param end_ip_address: The end IP address of the firewall rule. Must be IPv4 format. Must be + :ivar end_ip_address: The end IP address of the firewall rule. Must be IPv4 format. Must be greater than or equal to startIpAddress. - :type end_ip_address: str + :vartype end_ip_address: str :ivar provisioning_state: Resource provisioning state. Possible values include: "Provisioning", "Succeeded", "Deleting", "Failed", "DeleteError". :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ProvisioningState - :param start_ip_address: The start IP address of the firewall rule. Must be IPv4 format. - :type start_ip_address: str + :ivar start_ip_address: The start IP address of the firewall rule. Must be IPv4 format. + :vartype start_ip_address: str """ _validation = { @@ -4140,6 +5080,13 @@ def __init__( start_ip_address: Optional[str] = None, **kwargs ): + """ + :keyword end_ip_address: The end IP address of the firewall rule. Must be IPv4 format. Must be + greater than or equal to startIpAddress. + :paramtype end_ip_address: str + :keyword start_ip_address: The start IP address of the firewall rule. Must be IPv4 format. + :paramtype start_ip_address: str + """ super(IpFirewallRuleInfo, self).__init__(**kwargs) self.end_ip_address = end_ip_address self.provisioning_state = None @@ -4149,10 +5096,10 @@ def __init__( class IpFirewallRuleInfoListResult(msrest.serialization.Model): """List of IP firewall rules. - :param next_link: Link to next page of results. - :type next_link: str - :param value: List of IP firewall rules. - :type value: list[~azure.mgmt.synapse.models.IpFirewallRuleInfo] + :ivar next_link: Link to next page of results. + :vartype next_link: str + :ivar value: List of IP firewall rules. + :vartype value: list[~azure.mgmt.synapse.models.IpFirewallRuleInfo] """ _attribute_map = { @@ -4167,6 +5114,12 @@ def __init__( value: Optional[List["IpFirewallRuleInfo"]] = None, **kwargs ): + """ + :keyword next_link: Link to next page of results. + :paramtype next_link: str + :keyword value: List of IP firewall rules. + :paramtype value: list[~azure.mgmt.synapse.models.IpFirewallRuleInfo] + """ super(IpFirewallRuleInfoListResult, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -4177,14 +5130,14 @@ class IpFirewallRuleProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param end_ip_address: The end IP address of the firewall rule. Must be IPv4 format. Must be + :ivar end_ip_address: The end IP address of the firewall rule. Must be IPv4 format. Must be greater than or equal to startIpAddress. - :type end_ip_address: str + :vartype end_ip_address: str :ivar provisioning_state: Resource provisioning state. Possible values include: "Provisioning", "Succeeded", "Deleting", "Failed", "DeleteError". :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ProvisioningState - :param start_ip_address: The start IP address of the firewall rule. Must be IPv4 format. - :type start_ip_address: str + :ivar start_ip_address: The start IP address of the firewall rule. Must be IPv4 format. + :vartype start_ip_address: str """ _validation = { @@ -4204,6 +5157,13 @@ def __init__( start_ip_address: Optional[str] = None, **kwargs ): + """ + :keyword end_ip_address: The end IP address of the firewall rule. Must be IPv4 format. Must be + greater than or equal to startIpAddress. + :paramtype end_ip_address: str + :keyword start_ip_address: The start IP address of the firewall rule. Must be IPv4 format. + :paramtype start_ip_address: str + """ super(IpFirewallRuleProperties, self).__init__(**kwargs) self.end_ip_address = end_ip_address self.provisioning_state = None @@ -4213,11 +5173,11 @@ def __init__( class KekIdentityProperties(msrest.serialization.Model): """Key encryption key properties. - :param user_assigned_identity: User assigned identity resource Id. - :type user_assigned_identity: str - :param use_system_assigned_identity: Boolean specifying whether to use system assigned identity + :ivar user_assigned_identity: User assigned identity resource Id. + :vartype user_assigned_identity: str + :ivar use_system_assigned_identity: Boolean specifying whether to use system assigned identity or not. - :type use_system_assigned_identity: any + :vartype use_system_assigned_identity: any """ _attribute_map = { @@ -4232,6 +5192,13 @@ def __init__( use_system_assigned_identity: Optional[Any] = None, **kwargs ): + """ + :keyword user_assigned_identity: User assigned identity resource Id. + :paramtype user_assigned_identity: str + :keyword use_system_assigned_identity: Boolean specifying whether to use system assigned + identity or not. + :paramtype use_system_assigned_identity: any + """ super(KekIdentityProperties, self).__init__(**kwargs) self.user_assigned_identity = user_assigned_identity self.use_system_assigned_identity = use_system_assigned_identity @@ -4250,10 +5217,10 @@ class Key(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param is_active_cmk: Used to activate the workspace after a customer managed key is provided. - :type is_active_cmk: bool - :param key_vault_url: The Key Vault Url of the workspace key. - :type key_vault_url: str + :ivar is_active_cmk: Used to activate the workspace after a customer managed key is provided. + :vartype is_active_cmk: bool + :ivar key_vault_url: The Key Vault Url of the workspace key. + :vartype key_vault_url: str """ _validation = { @@ -4277,6 +5244,13 @@ def __init__( key_vault_url: Optional[str] = None, **kwargs ): + """ + :keyword is_active_cmk: Used to activate the workspace after a customer managed key is + provided. + :paramtype is_active_cmk: bool + :keyword key_vault_url: The Key Vault Url of the workspace key. + :paramtype key_vault_url: str + """ super(Key, self).__init__(**kwargs) self.is_active_cmk = is_active_cmk self.key_vault_url = key_vault_url @@ -4285,10 +5259,10 @@ def __init__( class KeyInfoListResult(msrest.serialization.Model): """List of keys. - :param next_link: Link to the next page of results. - :type next_link: str - :param value: List of keys. - :type value: list[~azure.mgmt.synapse.models.Key] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + :ivar value: List of keys. + :vartype value: list[~azure.mgmt.synapse.models.Key] """ _attribute_map = { @@ -4303,6 +5277,12 @@ def __init__( value: Optional[List["Key"]] = None, **kwargs ): + """ + :keyword next_link: Link to the next page of results. + :paramtype next_link: str + :keyword value: List of keys. + :paramtype value: list[~azure.mgmt.synapse.models.Key] + """ super(KeyInfoListResult, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -4323,12 +5303,12 @@ class KustoPool(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param sku: Required. The SKU of the kusto pool. - :type sku: ~azure.mgmt.synapse.models.AzureSku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar sku: Required. The SKU of the kusto pool. + :vartype sku: ~azure.mgmt.synapse.models.AzureSku :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy @@ -4346,17 +5326,17 @@ class KustoPool(TrackedResource): :vartype data_ingestion_uri: str :ivar state_reason: The reason for the Kusto Pool's current state. :vartype state_reason: str - :param optimized_autoscale: Optimized auto scale definition. - :type optimized_autoscale: ~azure.mgmt.synapse.models.OptimizedAutoscale - :param enable_streaming_ingest: A boolean value that indicates if the streaming ingest is + :ivar optimized_autoscale: Optimized auto scale definition. + :vartype optimized_autoscale: ~azure.mgmt.synapse.models.OptimizedAutoscale + :ivar enable_streaming_ingest: A boolean value that indicates if the streaming ingest is enabled. - :type enable_streaming_ingest: bool - :param enable_purge: A boolean value that indicates if the purge operations are enabled. - :type enable_purge: bool + :vartype enable_streaming_ingest: bool + :ivar enable_purge: A boolean value that indicates if the purge operations are enabled. + :vartype enable_purge: bool :ivar language_extensions: List of the Kusto Pool's language extensions. :vartype language_extensions: ~azure.mgmt.synapse.models.LanguageExtensionsList - :param workspace_uid: The workspace unique identifier. - :type workspace_uid: str + :ivar workspace_uid: The workspace unique identifier. + :vartype workspace_uid: str """ _validation = { @@ -4408,6 +5388,23 @@ def __init__( workspace_uid: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword sku: Required. The SKU of the kusto pool. + :paramtype sku: ~azure.mgmt.synapse.models.AzureSku + :keyword optimized_autoscale: Optimized auto scale definition. + :paramtype optimized_autoscale: ~azure.mgmt.synapse.models.OptimizedAutoscale + :keyword enable_streaming_ingest: A boolean value that indicates if the streaming ingest is + enabled. + :paramtype enable_streaming_ingest: bool + :keyword enable_purge: A boolean value that indicates if the purge operations are enabled. + :paramtype enable_purge: bool + :keyword workspace_uid: The workspace unique identifier. + :paramtype workspace_uid: str + """ super(KustoPool, self).__init__(tags=tags, location=location, **kwargs) self.sku = sku self.etag = None @@ -4431,8 +5428,8 @@ class KustoPoolCheckNameRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Kusto Pool name. - :type name: str + :ivar name: Required. Kusto Pool name. + :vartype name: str :ivar type: The type of resource, Microsoft.Synapse/workspaces/kustoPools. Has constant value: "Microsoft.Synapse/workspaces/kustoPools". :vartype type: str @@ -4456,6 +5453,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Kusto Pool name. + :paramtype name: str + """ super(KustoPoolCheckNameRequest, self).__init__(**kwargs) self.name = name @@ -4463,8 +5464,8 @@ def __init__( class KustoPoolListResult(msrest.serialization.Model): """The list Kusto pools operation response. - :param value: The list of Kusto pools. - :type value: list[~azure.mgmt.synapse.models.KustoPool] + :ivar value: The list of Kusto pools. + :vartype value: list[~azure.mgmt.synapse.models.KustoPool] """ _attribute_map = { @@ -4477,6 +5478,10 @@ def __init__( value: Optional[List["KustoPool"]] = None, **kwargs ): + """ + :keyword value: The list of Kusto pools. + :paramtype value: list[~azure.mgmt.synapse.models.KustoPool] + """ super(KustoPoolListResult, self).__init__(**kwargs) self.value = value @@ -4494,10 +5499,10 @@ class KustoPoolUpdate(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param sku: The SKU of the kusto pool. - :type sku: ~azure.mgmt.synapse.models.AzureSku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The SKU of the kusto pool. + :vartype sku: ~azure.mgmt.synapse.models.AzureSku :ivar state: The state of the resource. Possible values include: "Creating", "Unavailable", "Running", "Deleting", "Deleted", "Stopping", "Stopped", "Starting", "Updating". :vartype state: str or ~azure.mgmt.synapse.models.State @@ -4510,17 +5515,17 @@ class KustoPoolUpdate(Resource): :vartype data_ingestion_uri: str :ivar state_reason: The reason for the Kusto Pool's current state. :vartype state_reason: str - :param optimized_autoscale: Optimized auto scale definition. - :type optimized_autoscale: ~azure.mgmt.synapse.models.OptimizedAutoscale - :param enable_streaming_ingest: A boolean value that indicates if the streaming ingest is + :ivar optimized_autoscale: Optimized auto scale definition. + :vartype optimized_autoscale: ~azure.mgmt.synapse.models.OptimizedAutoscale + :ivar enable_streaming_ingest: A boolean value that indicates if the streaming ingest is enabled. - :type enable_streaming_ingest: bool - :param enable_purge: A boolean value that indicates if the purge operations are enabled. - :type enable_purge: bool + :vartype enable_streaming_ingest: bool + :ivar enable_purge: A boolean value that indicates if the purge operations are enabled. + :vartype enable_purge: bool :ivar language_extensions: List of the Kusto Pool's language extensions. :vartype language_extensions: ~azure.mgmt.synapse.models.LanguageExtensionsList - :param workspace_uid: The workspace unique identifier. - :type workspace_uid: str + :ivar workspace_uid: The workspace unique identifier. + :vartype workspace_uid: str """ _validation = { @@ -4564,6 +5569,21 @@ def __init__( workspace_uid: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The SKU of the kusto pool. + :paramtype sku: ~azure.mgmt.synapse.models.AzureSku + :keyword optimized_autoscale: Optimized auto scale definition. + :paramtype optimized_autoscale: ~azure.mgmt.synapse.models.OptimizedAutoscale + :keyword enable_streaming_ingest: A boolean value that indicates if the streaming ingest is + enabled. + :paramtype enable_streaming_ingest: bool + :keyword enable_purge: A boolean value that indicates if the purge operations are enabled. + :paramtype enable_purge: bool + :keyword workspace_uid: The workspace unique identifier. + :paramtype workspace_uid: str + """ super(KustoPoolUpdate, self).__init__(**kwargs) self.tags = tags self.sku = sku @@ -4582,9 +5602,9 @@ def __init__( class LanguageExtension(msrest.serialization.Model): """The language extension object. - :param language_extension_name: The language extension name. Possible values include: "PYTHON", + :ivar language_extension_name: The language extension name. Possible values include: "PYTHON", "R". - :type language_extension_name: str or ~azure.mgmt.synapse.models.LanguageExtensionName + :vartype language_extension_name: str or ~azure.mgmt.synapse.models.LanguageExtensionName """ _attribute_map = { @@ -4597,6 +5617,11 @@ def __init__( language_extension_name: Optional[Union[str, "LanguageExtensionName"]] = None, **kwargs ): + """ + :keyword language_extension_name: The language extension name. Possible values include: + "PYTHON", "R". + :paramtype language_extension_name: str or ~azure.mgmt.synapse.models.LanguageExtensionName + """ super(LanguageExtension, self).__init__(**kwargs) self.language_extension_name = language_extension_name @@ -4604,8 +5629,8 @@ def __init__( class LanguageExtensionsList(msrest.serialization.Model): """The list of language extension objects. - :param value: The list of language extensions. - :type value: list[~azure.mgmt.synapse.models.LanguageExtension] + :ivar value: The list of language extensions. + :vartype value: list[~azure.mgmt.synapse.models.LanguageExtension] """ _attribute_map = { @@ -4618,6 +5643,10 @@ def __init__( value: Optional[List["LanguageExtension"]] = None, **kwargs ): + """ + :keyword value: The list of language extensions. + :paramtype value: list[~azure.mgmt.synapse.models.LanguageExtension] + """ super(LanguageExtensionsList, self).__init__(**kwargs) self.value = value @@ -4627,16 +5656,16 @@ class LibraryInfo(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: Name of the library. - :type name: str - :param path: Storage blob path of library. - :type path: str - :param container_name: Storage blob container name. - :type container_name: str - :param uploaded_timestamp: The last update time of the library. - :type uploaded_timestamp: ~datetime.datetime - :param type: Type of the library. - :type type: str + :ivar name: Name of the library. + :vartype name: str + :ivar path: Storage blob path of library. + :vartype path: str + :ivar container_name: Storage blob container name. + :vartype container_name: str + :ivar uploaded_timestamp: The last update time of the library. + :vartype uploaded_timestamp: ~datetime.datetime + :ivar type: Type of the library. + :vartype type: str :ivar provisioning_status: Provisioning status of the library/package. :vartype provisioning_status: str :ivar creator_id: Creator Id of the library/package. @@ -4668,6 +5697,18 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the library. + :paramtype name: str + :keyword path: Storage blob path of library. + :paramtype path: str + :keyword container_name: Storage blob container name. + :paramtype container_name: str + :keyword uploaded_timestamp: The last update time of the library. + :paramtype uploaded_timestamp: ~datetime.datetime + :keyword type: Type of the library. + :paramtype type: str + """ super(LibraryInfo, self).__init__(**kwargs) self.name = name self.path = path @@ -4683,10 +5724,10 @@ class LibraryListResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. List of Library. - :type value: list[~azure.mgmt.synapse.models.LibraryResource] - :param next_link: The link to the next page of results, if any remaining results exist. - :type next_link: str + :ivar value: Required. List of Library. + :vartype value: list[~azure.mgmt.synapse.models.LibraryResource] + :ivar next_link: The link to the next page of results, if any remaining results exist. + :vartype next_link: str """ _validation = { @@ -4705,6 +5746,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. List of Library. + :paramtype value: list[~azure.mgmt.synapse.models.LibraryResource] + :keyword next_link: The link to the next page of results, if any remaining results exist. + :paramtype next_link: str + """ super(LibraryListResponse, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -4717,10 +5764,10 @@ class LibraryRequirements(msrest.serialization.Model): :ivar time: The last update time of the library requirements file. :vartype time: ~datetime.datetime - :param content: The library requirements. - :type content: str - :param filename: The filename of the library requirements file. - :type filename: str + :ivar content: The library requirements. + :vartype content: str + :ivar filename: The filename of the library requirements file. + :vartype filename: str """ _validation = { @@ -4740,6 +5787,12 @@ def __init__( filename: Optional[str] = None, **kwargs ): + """ + :keyword content: The library requirements. + :paramtype content: str + :keyword filename: The filename of the library requirements file. + :paramtype filename: str + """ super(LibraryRequirements, self).__init__(**kwargs) self.time = None self.content = content @@ -4761,16 +5814,16 @@ class LibraryResource(SubResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param name_properties_name: Name of the library. - :type name_properties_name: str - :param path: Storage blob path of library. - :type path: str - :param container_name: Storage blob container name. - :type container_name: str - :param uploaded_timestamp: The last update time of the library. - :type uploaded_timestamp: ~datetime.datetime - :param type_properties_type: Type of the library. - :type type_properties_type: str + :ivar name_properties_name: Name of the library. + :vartype name_properties_name: str + :ivar path: Storage blob path of library. + :vartype path: str + :ivar container_name: Storage blob container name. + :vartype container_name: str + :ivar uploaded_timestamp: The last update time of the library. + :vartype uploaded_timestamp: ~datetime.datetime + :ivar type_properties_type: Type of the library. + :vartype type_properties_type: str :ivar provisioning_status: Provisioning status of the library/package. :vartype provisioning_status: str :ivar creator_id: Creator Id of the library/package. @@ -4810,6 +5863,18 @@ def __init__( type_properties_type: Optional[str] = None, **kwargs ): + """ + :keyword name_properties_name: Name of the library. + :paramtype name_properties_name: str + :keyword path: Storage blob path of library. + :paramtype path: str + :keyword container_name: Storage blob container name. + :paramtype container_name: str + :keyword uploaded_timestamp: The last update time of the library. + :paramtype uploaded_timestamp: ~datetime.datetime + :keyword type_properties_type: Type of the library. + :paramtype type_properties_type: str + """ super(LibraryResource, self).__init__(**kwargs) self.name_properties_name = name_properties_name self.path = path @@ -4859,6 +5924,8 @@ def __init__( self, **kwargs ): + """ + """ super(LinkedIntegrationRuntime, self).__init__(**kwargs) self.name = None self.subscription_id = None @@ -4875,9 +5942,9 @@ class LinkedIntegrationRuntimeType(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param authorization_type: Required. The authorization type for integration runtime + :ivar authorization_type: Required. The authorization type for integration runtime sharing.Constant filled by server. - :type authorization_type: str + :vartype authorization_type: str """ _validation = { @@ -4896,6 +5963,8 @@ def __init__( self, **kwargs ): + """ + """ super(LinkedIntegrationRuntimeType, self).__init__(**kwargs) self.authorization_type = None # type: Optional[str] @@ -4905,11 +5974,11 @@ class LinkedIntegrationRuntimeKeyAuthorization(LinkedIntegrationRuntimeType): All required parameters must be populated in order to send to Azure. - :param authorization_type: Required. The authorization type for integration runtime + :ivar authorization_type: Required. The authorization type for integration runtime sharing.Constant filled by server. - :type authorization_type: str - :param key: Required. The key used for authorization. - :type key: ~azure.mgmt.synapse.models.SecureString + :vartype authorization_type: str + :ivar key: Required. The key used for authorization. + :vartype key: ~azure.mgmt.synapse.models.SecureString """ _validation = { @@ -4928,6 +5997,10 @@ def __init__( key: "SecureString", **kwargs ): + """ + :keyword key: Required. The key used for authorization. + :paramtype key: ~azure.mgmt.synapse.models.SecureString + """ super(LinkedIntegrationRuntimeKeyAuthorization, self).__init__(**kwargs) self.authorization_type = 'Key' # type: str self.key = key @@ -4938,11 +6011,11 @@ class LinkedIntegrationRuntimeRbacAuthorization(LinkedIntegrationRuntimeType): All required parameters must be populated in order to send to Azure. - :param authorization_type: Required. The authorization type for integration runtime + :ivar authorization_type: Required. The authorization type for integration runtime sharing.Constant filled by server. - :type authorization_type: str - :param resource_id: Required. The resource identifier of the integration runtime to be shared. - :type resource_id: str + :vartype authorization_type: str + :ivar resource_id: Required. The resource identifier of the integration runtime to be shared. + :vartype resource_id: str """ _validation = { @@ -4961,6 +6034,11 @@ def __init__( resource_id: str, **kwargs ): + """ + :keyword resource_id: Required. The resource identifier of the integration runtime to be + shared. + :paramtype resource_id: str + """ super(LinkedIntegrationRuntimeRbacAuthorization, self).__init__(**kwargs) self.authorization_type = 'RBAC' # type: str self.resource_id = resource_id @@ -4969,8 +6047,8 @@ def __init__( class ListResourceSkusResult(msrest.serialization.Model): """List of available SKUs for a Kusto Pool. - :param value: The collection of available SKUs for an existing resource. - :type value: list[~azure.mgmt.synapse.models.AzureResourceSku] + :ivar value: The collection of available SKUs for an existing resource. + :vartype value: list[~azure.mgmt.synapse.models.AzureResourceSku] """ _attribute_map = { @@ -4983,6 +6061,10 @@ def __init__( value: Optional[List["AzureResourceSku"]] = None, **kwargs ): + """ + :keyword value: The collection of available SKUs for an existing resource. + :paramtype value: list[~azure.mgmt.synapse.models.AzureResourceSku] + """ super(ListResourceSkusResult, self).__init__(**kwargs) self.value = value @@ -5012,6 +6094,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListSqlPoolSecurityAlertPolicies, self).__init__(**kwargs) self.value = None self.next_link = None @@ -5030,22 +6114,22 @@ class MaintenanceWindowOptions(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param is_enabled: Whether maintenance windows are enabled for the database. - :type is_enabled: bool - :param maintenance_window_cycles: Available maintenance cycles e.g. {Saturday, 0, 48\ *60}, + :ivar is_enabled: Whether maintenance windows are enabled for the database. + :vartype is_enabled: bool + :ivar maintenance_window_cycles: Available maintenance cycles e.g. {Saturday, 0, 48\ *60}, {Wednesday, 0, 24*\ 60}. - :type maintenance_window_cycles: list[~azure.mgmt.synapse.models.MaintenanceWindowTimeRange] - :param min_duration_in_minutes: Minimum duration of maintenance window. - :type min_duration_in_minutes: int - :param default_duration_in_minutes: Default duration for maintenance window. - :type default_duration_in_minutes: int - :param min_cycles: Minimum number of maintenance windows cycles to be set on the database. - :type min_cycles: int - :param time_granularity_in_minutes: Time granularity in minutes for maintenance windows. - :type time_granularity_in_minutes: int - :param allow_multiple_maintenance_windows_per_cycle: Whether we allow multiple maintenance + :vartype maintenance_window_cycles: list[~azure.mgmt.synapse.models.MaintenanceWindowTimeRange] + :ivar min_duration_in_minutes: Minimum duration of maintenance window. + :vartype min_duration_in_minutes: int + :ivar default_duration_in_minutes: Default duration for maintenance window. + :vartype default_duration_in_minutes: int + :ivar min_cycles: Minimum number of maintenance windows cycles to be set on the database. + :vartype min_cycles: int + :ivar time_granularity_in_minutes: Time granularity in minutes for maintenance windows. + :vartype time_granularity_in_minutes: int + :ivar allow_multiple_maintenance_windows_per_cycle: Whether we allow multiple maintenance windows per cycle. - :type allow_multiple_maintenance_windows_per_cycle: bool + :vartype allow_multiple_maintenance_windows_per_cycle: bool """ _validation = { @@ -5079,6 +6163,25 @@ def __init__( allow_multiple_maintenance_windows_per_cycle: Optional[bool] = None, **kwargs ): + """ + :keyword is_enabled: Whether maintenance windows are enabled for the database. + :paramtype is_enabled: bool + :keyword maintenance_window_cycles: Available maintenance cycles e.g. {Saturday, 0, 48\ *60}, + {Wednesday, 0, 24*\ 60}. + :paramtype maintenance_window_cycles: + list[~azure.mgmt.synapse.models.MaintenanceWindowTimeRange] + :keyword min_duration_in_minutes: Minimum duration of maintenance window. + :paramtype min_duration_in_minutes: int + :keyword default_duration_in_minutes: Default duration for maintenance window. + :paramtype default_duration_in_minutes: int + :keyword min_cycles: Minimum number of maintenance windows cycles to be set on the database. + :paramtype min_cycles: int + :keyword time_granularity_in_minutes: Time granularity in minutes for maintenance windows. + :paramtype time_granularity_in_minutes: int + :keyword allow_multiple_maintenance_windows_per_cycle: Whether we allow multiple maintenance + windows per cycle. + :paramtype allow_multiple_maintenance_windows_per_cycle: bool + """ super(MaintenanceWindowOptions, self).__init__(**kwargs) self.is_enabled = is_enabled self.maintenance_window_cycles = maintenance_window_cycles @@ -5102,8 +6205,8 @@ class MaintenanceWindows(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param time_ranges: - :type time_ranges: list[~azure.mgmt.synapse.models.MaintenanceWindowTimeRange] + :ivar time_ranges: + :vartype time_ranges: list[~azure.mgmt.synapse.models.MaintenanceWindowTimeRange] """ _validation = { @@ -5125,6 +6228,10 @@ def __init__( time_ranges: Optional[List["MaintenanceWindowTimeRange"]] = None, **kwargs ): + """ + :keyword time_ranges: + :paramtype time_ranges: list[~azure.mgmt.synapse.models.MaintenanceWindowTimeRange] + """ super(MaintenanceWindows, self).__init__(**kwargs) self.time_ranges = time_ranges @@ -5132,13 +6239,13 @@ def __init__( class MaintenanceWindowTimeRange(msrest.serialization.Model): """Maintenance window time range. - :param day_of_week: Day of maintenance window. Possible values include: "Sunday", "Monday", + :ivar day_of_week: Day of maintenance window. Possible values include: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday". - :type day_of_week: str or ~azure.mgmt.synapse.models.DayOfWeek - :param start_time: Start time minutes offset from 12am. - :type start_time: str - :param duration: Duration of maintenance window in minutes. - :type duration: str + :vartype day_of_week: str or ~azure.mgmt.synapse.models.DayOfWeek + :ivar start_time: Start time minutes offset from 12am. + :vartype start_time: str + :ivar duration: Duration of maintenance window in minutes. + :vartype duration: str """ _attribute_map = { @@ -5155,6 +6262,15 @@ def __init__( duration: Optional[str] = None, **kwargs ): + """ + :keyword day_of_week: Day of maintenance window. Possible values include: "Sunday", "Monday", + "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday". + :paramtype day_of_week: str or ~azure.mgmt.synapse.models.DayOfWeek + :keyword start_time: Start time minutes offset from 12am. + :paramtype start_time: str + :keyword duration: Duration of maintenance window in minutes. + :paramtype duration: str + """ super(MaintenanceWindowTimeRange, self).__init__(**kwargs) self.day_of_week = day_of_week self.start_time = start_time @@ -5170,11 +6286,11 @@ class ManagedIdentity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of the workspace managed identity. :vartype tenant_id: str - :param type: The type of managed identity for the workspace. Possible values include: "None", + :ivar type: The type of managed identity for the workspace. Possible values include: "None", "SystemAssigned", "SystemAssigned,UserAssigned". - :type type: str or ~azure.mgmt.synapse.models.ResourceIdentityType - :param user_assigned_identities: The user assigned managed identities. - :type user_assigned_identities: dict[str, + :vartype type: str or ~azure.mgmt.synapse.models.ResourceIdentityType + :ivar user_assigned_identities: The user assigned managed identities. + :vartype user_assigned_identities: dict[str, ~azure.mgmt.synapse.models.UserAssignedManagedIdentity] """ @@ -5197,6 +6313,14 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserAssignedManagedIdentity"]] = None, **kwargs ): + """ + :keyword type: The type of managed identity for the workspace. Possible values include: "None", + "SystemAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.synapse.models.ResourceIdentityType + :keyword user_assigned_identities: The user assigned managed identities. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.synapse.models.UserAssignedManagedIdentity] + """ super(ManagedIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -5217,8 +6341,8 @@ class ManagedIdentitySqlControlSettingsModel(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param grant_sql_control_to_managed_identity: Grant sql control to managed identity. - :type grant_sql_control_to_managed_identity: + :ivar grant_sql_control_to_managed_identity: Grant sql control to managed identity. + :vartype grant_sql_control_to_managed_identity: ~azure.mgmt.synapse.models.ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity """ @@ -5241,6 +6365,11 @@ def __init__( grant_sql_control_to_managed_identity: Optional["ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity"] = None, **kwargs ): + """ + :keyword grant_sql_control_to_managed_identity: Grant sql control to managed identity. + :paramtype grant_sql_control_to_managed_identity: + ~azure.mgmt.synapse.models.ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity + """ super(ManagedIdentitySqlControlSettingsModel, self).__init__(**kwargs) self.grant_sql_control_to_managed_identity = grant_sql_control_to_managed_identity @@ -5250,8 +6379,8 @@ class ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedId Variables are only populated by the server, and will be ignored when sending a request. - :param desired_state: Desired state. Possible values include: "Enabled", "Disabled". - :type desired_state: str or + :ivar desired_state: Desired state. Possible values include: "Enabled", "Disabled". + :vartype desired_state: str or ~azure.mgmt.synapse.models.ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentityDesiredState :ivar actual_state: Actual state. Possible values include: "Enabling", "Enabled", "Disabling", "Disabled", "Unknown". @@ -5274,6 +6403,11 @@ def __init__( desired_state: Optional[Union[str, "ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentityDesiredState"]] = None, **kwargs ): + """ + :keyword desired_state: Desired state. Possible values include: "Enabled", "Disabled". + :paramtype desired_state: str or + ~azure.mgmt.synapse.models.ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentityDesiredState + """ super(ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity, self).__init__(**kwargs) self.desired_state = desired_state self.actual_state = None @@ -5286,22 +6420,22 @@ class ManagedIntegrationRuntime(IntegrationRuntime): All required parameters must be populated in order to send to Azure. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, any] - :param type: Required. Type of integration runtime.Constant filled by server. Possible values + :vartype additional_properties: dict[str, any] + :ivar type: Required. Type of integration runtime.Constant filled by server. Possible values include: "Managed", "SelfHosted". - :type type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeType - :param description: Integration runtime description. - :type description: str + :vartype type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeType + :ivar description: Integration runtime description. + :vartype description: str :ivar state: Integration runtime state, only valid for managed dedicated integration runtime. Possible values include: "Initial", "Stopped", "Started", "Starting", "Stopping", "NeedRegistration", "Online", "Limited", "Offline", "AccessDenied". :vartype state: str or ~azure.mgmt.synapse.models.IntegrationRuntimeState - :param compute_properties: The compute resource for managed integration runtime. - :type compute_properties: ~azure.mgmt.synapse.models.IntegrationRuntimeComputeProperties - :param ssis_properties: SSIS properties for managed integration runtime. - :type ssis_properties: ~azure.mgmt.synapse.models.IntegrationRuntimeSsisProperties + :ivar compute_properties: The compute resource for managed integration runtime. + :vartype compute_properties: ~azure.mgmt.synapse.models.IntegrationRuntimeComputeProperties + :ivar ssis_properties: SSIS properties for managed integration runtime. + :vartype ssis_properties: ~azure.mgmt.synapse.models.IntegrationRuntimeSsisProperties """ _validation = { @@ -5327,6 +6461,17 @@ def __init__( ssis_properties: Optional["IntegrationRuntimeSsisProperties"] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword description: Integration runtime description. + :paramtype description: str + :keyword compute_properties: The compute resource for managed integration runtime. + :paramtype compute_properties: ~azure.mgmt.synapse.models.IntegrationRuntimeComputeProperties + :keyword ssis_properties: SSIS properties for managed integration runtime. + :paramtype ssis_properties: ~azure.mgmt.synapse.models.IntegrationRuntimeSsisProperties + """ super(ManagedIntegrationRuntime, self).__init__(additional_properties=additional_properties, description=description, **kwargs) self.type = 'Managed' # type: str self.state = None @@ -5339,9 +6484,9 @@ class ManagedIntegrationRuntimeError(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, any] + :vartype additional_properties: dict[str, any] :ivar time: The time when the error occurred. :vartype time: ~datetime.datetime :ivar code: Error code. @@ -5373,6 +6518,11 @@ def __init__( additional_properties: Optional[Dict[str, Any]] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + """ super(ManagedIntegrationRuntimeError, self).__init__(**kwargs) self.additional_properties = additional_properties self.time = None @@ -5386,16 +6536,16 @@ class ManagedIntegrationRuntimeNode(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, any] + :vartype additional_properties: dict[str, any] :ivar node_id: The managed integration runtime node id. :vartype node_id: str :ivar status: The managed integration runtime node status. Possible values include: "Starting", "Available", "Recycling", "Unavailable". :vartype status: str or ~azure.mgmt.synapse.models.ManagedIntegrationRuntimeNodeStatus - :param errors: The errors that occurred on this integration runtime node. - :type errors: list[~azure.mgmt.synapse.models.ManagedIntegrationRuntimeError] + :ivar errors: The errors that occurred on this integration runtime node. + :vartype errors: list[~azure.mgmt.synapse.models.ManagedIntegrationRuntimeError] """ _validation = { @@ -5417,6 +6567,13 @@ def __init__( errors: Optional[List["ManagedIntegrationRuntimeError"]] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword errors: The errors that occurred on this integration runtime node. + :paramtype errors: list[~azure.mgmt.synapse.models.ManagedIntegrationRuntimeError] + """ super(ManagedIntegrationRuntimeNode, self).__init__(**kwargs) self.additional_properties = additional_properties self.node_id = None @@ -5429,9 +6586,9 @@ class ManagedIntegrationRuntimeOperationResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, any] + :vartype additional_properties: dict[str, any] :ivar type: The operation type. Could be start or stop. :vartype type: str :ivar start_time: The start time of the operation. @@ -5471,6 +6628,11 @@ def __init__( additional_properties: Optional[Dict[str, Any]] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + """ super(ManagedIntegrationRuntimeOperationResult, self).__init__(**kwargs) self.additional_properties = additional_properties self.type = None @@ -5488,12 +6650,12 @@ class ManagedIntegrationRuntimeStatus(IntegrationRuntimeStatus): All required parameters must be populated in order to send to Azure. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, any] - :param type: Required. Type of integration runtime.Constant filled by server. Possible values + :vartype additional_properties: dict[str, any] + :ivar type: Required. Type of integration runtime.Constant filled by server. Possible values include: "Managed", "SelfHosted". - :type type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeType + :vartype type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeType :ivar data_factory_name: The workspace name which the integration runtime belong to. :vartype data_factory_name: str :ivar state: The state of integration runtime. Possible values include: "Initial", "Stopped", @@ -5537,6 +6699,11 @@ def __init__( additional_properties: Optional[Dict[str, Any]] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + """ super(ManagedIntegrationRuntimeStatus, self).__init__(additional_properties=additional_properties, **kwargs) self.type = 'Managed' # type: str self.create_time = None @@ -5548,12 +6715,12 @@ def __init__( class ManagedVirtualNetworkSettings(msrest.serialization.Model): """Managed Virtual Network Settings. - :param prevent_data_exfiltration: Prevent Data Exfiltration. - :type prevent_data_exfiltration: bool - :param linked_access_check_on_target_resource: Linked Access Check On Target Resource. - :type linked_access_check_on_target_resource: bool - :param allowed_aad_tenant_ids_for_linking: Allowed Aad Tenant Ids For Linking. - :type allowed_aad_tenant_ids_for_linking: list[str] + :ivar prevent_data_exfiltration: Prevent Data Exfiltration. + :vartype prevent_data_exfiltration: bool + :ivar linked_access_check_on_target_resource: Linked Access Check On Target Resource. + :vartype linked_access_check_on_target_resource: bool + :ivar allowed_aad_tenant_ids_for_linking: Allowed Aad Tenant Ids For Linking. + :vartype allowed_aad_tenant_ids_for_linking: list[str] """ _attribute_map = { @@ -5570,6 +6737,14 @@ def __init__( allowed_aad_tenant_ids_for_linking: Optional[List[str]] = None, **kwargs ): + """ + :keyword prevent_data_exfiltration: Prevent Data Exfiltration. + :paramtype prevent_data_exfiltration: bool + :keyword linked_access_check_on_target_resource: Linked Access Check On Target Resource. + :paramtype linked_access_check_on_target_resource: bool + :keyword allowed_aad_tenant_ids_for_linking: Allowed Aad Tenant Ids For Linking. + :paramtype allowed_aad_tenant_ids_for_linking: list[str] + """ super(ManagedVirtualNetworkSettings, self).__init__(**kwargs) self.prevent_data_exfiltration = prevent_data_exfiltration self.linked_access_check_on_target_resource = linked_access_check_on_target_resource @@ -5589,10 +6764,10 @@ class MetadataSyncConfig(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param enabled: Indicates whether the metadata sync is enabled or disabled. - :type enabled: bool - :param sync_interval_in_minutes: The Sync Interval in minutes. - :type sync_interval_in_minutes: int + :ivar enabled: Indicates whether the metadata sync is enabled or disabled. + :vartype enabled: bool + :ivar sync_interval_in_minutes: The Sync Interval in minutes. + :vartype sync_interval_in_minutes: int """ _validation = { @@ -5616,6 +6791,12 @@ def __init__( sync_interval_in_minutes: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Indicates whether the metadata sync is enabled or disabled. + :paramtype enabled: bool + :keyword sync_interval_in_minutes: The Sync Interval in minutes. + :paramtype sync_interval_in_minutes: int + """ super(MetadataSyncConfig, self).__init__(**kwargs) self.enabled = enabled self.sync_interval_in_minutes = sync_interval_in_minutes @@ -5624,14 +6805,14 @@ def __init__( class Operation(msrest.serialization.Model): """A REST API operation. - :param name: This is of the format {provider}/{resource}/{operation}. - :type name: str - :param display: The object that describes the operation. - :type display: ~azure.mgmt.synapse.models.OperationDisplay - :param origin: The intended executor of the operation. - :type origin: str - :param properties: Any object. - :type properties: any + :ivar name: This is of the format {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The object that describes the operation. + :vartype display: ~azure.mgmt.synapse.models.OperationDisplay + :ivar origin: The intended executor of the operation. + :vartype origin: str + :ivar properties: Any object. + :vartype properties: any """ _attribute_map = { @@ -5650,6 +6831,16 @@ def __init__( properties: Optional[Any] = None, **kwargs ): + """ + :keyword name: This is of the format {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The object that describes the operation. + :paramtype display: ~azure.mgmt.synapse.models.OperationDisplay + :keyword origin: The intended executor of the operation. + :paramtype origin: str + :keyword properties: Any object. + :paramtype properties: any + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -5660,14 +6851,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """The object that describes the operation. - :param provider: Friendly name of the resource provider. - :type provider: str - :param operation: For example: read, write, delete. - :type operation: str - :param resource: The resource type on which the operation is performed. - :type resource: str - :param description: The friendly name of the operation. - :type description: str + :ivar provider: Friendly name of the resource provider. + :vartype provider: str + :ivar operation: For example: read, write, delete. + :vartype operation: str + :ivar resource: The resource type on which the operation is performed. + :vartype resource: str + :ivar description: The friendly name of the operation. + :vartype description: str """ _attribute_map = { @@ -5686,6 +6877,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Friendly name of the resource provider. + :paramtype provider: str + :keyword operation: For example: read, write, delete. + :paramtype operation: str + :keyword resource: The resource type on which the operation is performed. + :paramtype resource: str + :keyword description: The friendly name of the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.operation = operation @@ -5698,8 +6899,8 @@ class OperationListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: The list of operations supported by the resource provider. - :type value: list[~azure.mgmt.synapse.models.Operation] + :ivar value: The list of operations supported by the resource provider. + :vartype value: list[~azure.mgmt.synapse.models.Operation] :ivar next_link: The URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -5719,6 +6920,10 @@ def __init__( value: Optional[List["Operation"]] = None, **kwargs ): + """ + :keyword value: The list of operations supported by the resource provider. + :paramtype value: list[~azure.mgmt.synapse.models.Operation] + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -5727,12 +6932,12 @@ def __init__( class OperationMetaLogSpecification(msrest.serialization.Model): """What is this?. - :param display_name: Log display name. - :type display_name: str - :param blob_duration: Time range the log covers. - :type blob_duration: str - :param name: Log unique name. - :type name: str + :ivar display_name: Log display name. + :vartype display_name: str + :ivar blob_duration: Time range the log covers. + :vartype blob_duration: str + :ivar name: Log unique name. + :vartype name: str """ _attribute_map = { @@ -5749,6 +6954,14 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword display_name: Log display name. + :paramtype display_name: str + :keyword blob_duration: Time range the log covers. + :paramtype blob_duration: str + :keyword name: Log unique name. + :paramtype name: str + """ super(OperationMetaLogSpecification, self).__init__(**kwargs) self.display_name = display_name self.blob_duration = blob_duration @@ -5758,12 +6971,12 @@ def __init__( class OperationMetaMetricDimensionSpecification(msrest.serialization.Model): """What is this?. - :param display_name: Dimension display name. - :type display_name: str - :param name: Dimension unique name. - :type name: str - :param to_be_exported_for_shoebox: Whether this metric should be exported for Shoebox. - :type to_be_exported_for_shoebox: bool + :ivar display_name: Dimension display name. + :vartype display_name: str + :ivar name: Dimension unique name. + :vartype name: str + :ivar to_be_exported_for_shoebox: Whether this metric should be exported for Shoebox. + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -5780,6 +6993,14 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword display_name: Dimension display name. + :paramtype display_name: str + :keyword name: Dimension unique name. + :paramtype name: str + :keyword to_be_exported_for_shoebox: Whether this metric should be exported for Shoebox. + :paramtype to_be_exported_for_shoebox: bool + """ super(OperationMetaMetricDimensionSpecification, self).__init__(**kwargs) self.display_name = display_name self.name = name @@ -5789,29 +7010,29 @@ def __init__( class OperationMetaMetricSpecification(msrest.serialization.Model): """What is this?. - :param source_mdm_namespace: The source MDM namespace. - :type source_mdm_namespace: str - :param display_name: Metric display name. - :type display_name: str - :param name: Metric unique name. - :type name: str - :param aggregation_type: Metric aggregation type. - :type aggregation_type: str - :param display_description: Metric description. - :type display_description: str - :param source_mdm_account: The source MDM account. - :type source_mdm_account: str - :param enable_regional_mdm_account: Whether the regional MDM account is enabled. - :type enable_regional_mdm_account: bool - :param unit: Metric units. - :type unit: str - :param dimensions: Metric dimensions. - :type dimensions: list[~azure.mgmt.synapse.models.OperationMetaMetricDimensionSpecification] - :param supports_instance_level_aggregation: Whether the metric supports instance-level + :ivar source_mdm_namespace: The source MDM namespace. + :vartype source_mdm_namespace: str + :ivar display_name: Metric display name. + :vartype display_name: str + :ivar name: Metric unique name. + :vartype name: str + :ivar aggregation_type: Metric aggregation type. + :vartype aggregation_type: str + :ivar display_description: Metric description. + :vartype display_description: str + :ivar source_mdm_account: The source MDM account. + :vartype source_mdm_account: str + :ivar enable_regional_mdm_account: Whether the regional MDM account is enabled. + :vartype enable_regional_mdm_account: bool + :ivar unit: Metric units. + :vartype unit: str + :ivar dimensions: Metric dimensions. + :vartype dimensions: list[~azure.mgmt.synapse.models.OperationMetaMetricDimensionSpecification] + :ivar supports_instance_level_aggregation: Whether the metric supports instance-level aggregation. - :type supports_instance_level_aggregation: bool - :param metric_filter_pattern: Metric filter. - :type metric_filter_pattern: str + :vartype supports_instance_level_aggregation: bool + :ivar metric_filter_pattern: Metric filter. + :vartype metric_filter_pattern: str """ _attribute_map = { @@ -5844,6 +7065,32 @@ def __init__( metric_filter_pattern: Optional[str] = None, **kwargs ): + """ + :keyword source_mdm_namespace: The source MDM namespace. + :paramtype source_mdm_namespace: str + :keyword display_name: Metric display name. + :paramtype display_name: str + :keyword name: Metric unique name. + :paramtype name: str + :keyword aggregation_type: Metric aggregation type. + :paramtype aggregation_type: str + :keyword display_description: Metric description. + :paramtype display_description: str + :keyword source_mdm_account: The source MDM account. + :paramtype source_mdm_account: str + :keyword enable_regional_mdm_account: Whether the regional MDM account is enabled. + :paramtype enable_regional_mdm_account: bool + :keyword unit: Metric units. + :paramtype unit: str + :keyword dimensions: Metric dimensions. + :paramtype dimensions: + list[~azure.mgmt.synapse.models.OperationMetaMetricDimensionSpecification] + :keyword supports_instance_level_aggregation: Whether the metric supports instance-level + aggregation. + :paramtype supports_instance_level_aggregation: bool + :keyword metric_filter_pattern: Metric filter. + :paramtype metric_filter_pattern: str + """ super(OperationMetaMetricSpecification, self).__init__(**kwargs) self.source_mdm_namespace = source_mdm_namespace self.display_name = display_name @@ -5861,10 +7108,11 @@ def __init__( class OperationMetaServiceSpecification(msrest.serialization.Model): """What is this?. - :param metric_specifications: Service metric specifications. - :type metric_specifications: list[~azure.mgmt.synapse.models.OperationMetaMetricSpecification] - :param log_specifications: Service log specifications. - :type log_specifications: list[~azure.mgmt.synapse.models.OperationMetaLogSpecification] + :ivar metric_specifications: Service metric specifications. + :vartype metric_specifications: + list[~azure.mgmt.synapse.models.OperationMetaMetricSpecification] + :ivar log_specifications: Service log specifications. + :vartype log_specifications: list[~azure.mgmt.synapse.models.OperationMetaLogSpecification] """ _attribute_map = { @@ -5879,6 +7127,13 @@ def __init__( log_specifications: Optional[List["OperationMetaLogSpecification"]] = None, **kwargs ): + """ + :keyword metric_specifications: Service metric specifications. + :paramtype metric_specifications: + list[~azure.mgmt.synapse.models.OperationMetaMetricSpecification] + :keyword log_specifications: Service log specifications. + :paramtype log_specifications: list[~azure.mgmt.synapse.models.OperationMetaLogSpecification] + """ super(OperationMetaServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications self.log_specifications = log_specifications @@ -5887,23 +7142,23 @@ def __init__( class OperationResource(msrest.serialization.Model): """An operation. - :param id: Operation ID. - :type id: str - :param name: Operation name. - :type name: str - :param status: Operation status. Possible values include: "InProgress", "Succeeded", "Failed", + :ivar id: Operation ID. + :vartype id: str + :ivar name: Operation name. + :vartype name: str + :ivar status: Operation status. Possible values include: "InProgress", "Succeeded", "Failed", "Canceled". - :type status: str or ~azure.mgmt.synapse.models.OperationStatus - :param properties: Operation properties. - :type properties: any - :param error: Errors from the operation. - :type error: ~azure.mgmt.synapse.models.ErrorDetail - :param start_time: Operation start time. - :type start_time: ~datetime.datetime - :param end_time: Operation start time. - :type end_time: ~datetime.datetime - :param percent_complete: Completion percentage of the operation. - :type percent_complete: float + :vartype status: str or ~azure.mgmt.synapse.models.OperationStatus + :ivar properties: Operation properties. + :vartype properties: any + :ivar error: Errors from the operation. + :vartype error: ~azure.mgmt.synapse.models.ErrorDetail + :ivar start_time: Operation start time. + :vartype start_time: ~datetime.datetime + :ivar end_time: Operation start time. + :vartype end_time: ~datetime.datetime + :ivar percent_complete: Completion percentage of the operation. + :vartype percent_complete: float """ _attribute_map = { @@ -5930,6 +7185,25 @@ def __init__( percent_complete: Optional[float] = None, **kwargs ): + """ + :keyword id: Operation ID. + :paramtype id: str + :keyword name: Operation name. + :paramtype name: str + :keyword status: Operation status. Possible values include: "InProgress", "Succeeded", + "Failed", "Canceled". + :paramtype status: str or ~azure.mgmt.synapse.models.OperationStatus + :keyword properties: Operation properties. + :paramtype properties: any + :keyword error: Errors from the operation. + :paramtype error: ~azure.mgmt.synapse.models.ErrorDetail + :keyword start_time: Operation start time. + :paramtype start_time: ~datetime.datetime + :keyword end_time: Operation start time. + :paramtype end_time: ~datetime.datetime + :keyword percent_complete: Completion percentage of the operation. + :paramtype percent_complete: float + """ super(OperationResource, self).__init__(**kwargs) self.id = id self.name = name @@ -5946,15 +7220,15 @@ class OptimizedAutoscale(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param version: Required. The version of the template defined, for instance 1. - :type version: int - :param is_enabled: Required. A boolean value that indicate if the optimized autoscale feature - is enabled or not. - :type is_enabled: bool - :param minimum: Required. Minimum allowed instances count. - :type minimum: int - :param maximum: Required. Maximum allowed instances count. - :type maximum: int + :ivar version: Required. The version of the template defined, for instance 1. + :vartype version: int + :ivar is_enabled: Required. A boolean value that indicate if the optimized autoscale feature is + enabled or not. + :vartype is_enabled: bool + :ivar minimum: Required. Minimum allowed instances count. + :vartype minimum: int + :ivar maximum: Required. Maximum allowed instances count. + :vartype maximum: int """ _validation = { @@ -5980,6 +7254,17 @@ def __init__( maximum: int, **kwargs ): + """ + :keyword version: Required. The version of the template defined, for instance 1. + :paramtype version: int + :keyword is_enabled: Required. A boolean value that indicate if the optimized autoscale feature + is enabled or not. + :paramtype is_enabled: bool + :keyword minimum: Required. Minimum allowed instances count. + :paramtype minimum: int + :keyword maximum: Required. Maximum allowed instances count. + :paramtype maximum: int + """ super(OptimizedAutoscale, self).__init__(**kwargs) self.version = version self.is_enabled = is_enabled @@ -6008,6 +7293,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -6025,11 +7312,11 @@ class PrivateEndpointConnection(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param private_endpoint: The private endpoint which the connection belongs to. - :type private_endpoint: ~azure.mgmt.synapse.models.PrivateEndpoint - :param private_link_service_connection_state: Connection state of the private endpoint + :ivar private_endpoint: The private endpoint which the connection belongs to. + :vartype private_endpoint: ~azure.mgmt.synapse.models.PrivateEndpoint + :ivar private_link_service_connection_state: Connection state of the private endpoint connection. - :type private_link_service_connection_state: + :vartype private_link_service_connection_state: ~azure.mgmt.synapse.models.PrivateLinkServiceConnectionState :ivar provisioning_state: Provisioning state of the private endpoint connection. :vartype provisioning_state: str @@ -6058,6 +7345,14 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: The private endpoint which the connection belongs to. + :paramtype private_endpoint: ~azure.mgmt.synapse.models.PrivateEndpoint + :keyword private_link_service_connection_state: Connection state of the private endpoint + connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.synapse.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -6067,10 +7362,10 @@ def __init__( class PrivateEndpointConnectionForPrivateLinkHubBasicAutoGenerated(msrest.serialization.Model): """PrivateEndpointConnectionForPrivateLinkHubBasicAutoGenerated. - :param id: - :type id: str - :param properties: Properties of a private endpoint connection. - :type properties: ~azure.mgmt.synapse.models.PrivateEndpointConnectionProperties + :ivar id: + :vartype id: str + :ivar properties: Properties of a private endpoint connection. + :vartype properties: ~azure.mgmt.synapse.models.PrivateEndpointConnectionProperties """ _attribute_map = { @@ -6085,6 +7380,12 @@ def __init__( properties: Optional["PrivateEndpointConnectionProperties"] = None, **kwargs ): + """ + :keyword id: + :paramtype id: str + :keyword properties: Properties of a private endpoint connection. + :paramtype properties: ~azure.mgmt.synapse.models.PrivateEndpointConnectionProperties + """ super(PrivateEndpointConnectionForPrivateLinkHubBasicAutoGenerated, self).__init__(**kwargs) self.id = id self.properties = properties @@ -6093,14 +7394,14 @@ def __init__( class PrivateEndpointConnectionForPrivateLinkHub(PrivateEndpointConnectionForPrivateLinkHubBasicAutoGenerated): """PrivateEndpointConnectionForPrivateLinkHub. - :param id: - :type id: str - :param properties: Properties of a private endpoint connection. - :type properties: ~azure.mgmt.synapse.models.PrivateEndpointConnectionProperties - :param name: - :type name: str - :param type: - :type type: str + :ivar id: + :vartype id: str + :ivar properties: Properties of a private endpoint connection. + :vartype properties: ~azure.mgmt.synapse.models.PrivateEndpointConnectionProperties + :ivar name: + :vartype name: str + :ivar type: + :vartype type: str """ _attribute_map = { @@ -6119,6 +7420,16 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword id: + :paramtype id: str + :keyword properties: Properties of a private endpoint connection. + :paramtype properties: ~azure.mgmt.synapse.models.PrivateEndpointConnectionProperties + :keyword name: + :paramtype name: str + :keyword type: + :paramtype type: str + """ super(PrivateEndpointConnectionForPrivateLinkHub, self).__init__(id=id, properties=properties, **kwargs) self.name = name self.type = type @@ -6131,11 +7442,11 @@ class PrivateEndpointConnectionForPrivateLinkHubBasic(msrest.serialization.Model :ivar id: identifier. :vartype id: str - :param private_endpoint: The private endpoint which the connection belongs to. - :type private_endpoint: ~azure.mgmt.synapse.models.PrivateEndpoint - :param private_link_service_connection_state: Connection state of the private endpoint + :ivar private_endpoint: The private endpoint which the connection belongs to. + :vartype private_endpoint: ~azure.mgmt.synapse.models.PrivateEndpoint + :ivar private_link_service_connection_state: Connection state of the private endpoint connection. - :type private_link_service_connection_state: + :vartype private_link_service_connection_state: ~azure.mgmt.synapse.models.PrivateLinkServiceConnectionState :ivar provisioning_state: Provisioning state of the private endpoint connection. :vartype provisioning_state: str @@ -6160,6 +7471,14 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: The private endpoint which the connection belongs to. + :paramtype private_endpoint: ~azure.mgmt.synapse.models.PrivateEndpoint + :keyword private_link_service_connection_state: Connection state of the private endpoint + connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.synapse.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnectionForPrivateLinkHubBasic, self).__init__(**kwargs) self.id = None self.private_endpoint = private_endpoint @@ -6170,10 +7489,10 @@ def __init__( class PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse(msrest.serialization.Model): """PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse. - :param value: - :type value: list[~azure.mgmt.synapse.models.PrivateEndpointConnectionForPrivateLinkHub] - :param next_link: - :type next_link: str + :ivar value: + :vartype value: list[~azure.mgmt.synapse.models.PrivateEndpointConnectionForPrivateLinkHub] + :ivar next_link: + :vartype next_link: str """ _attribute_map = { @@ -6188,6 +7507,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: + :paramtype value: list[~azure.mgmt.synapse.models.PrivateEndpointConnectionForPrivateLinkHub] + :keyword next_link: + :paramtype next_link: str + """ super(PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -6218,6 +7543,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpointConnectionList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -6228,11 +7555,11 @@ class PrivateEndpointConnectionProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param private_endpoint: The private endpoint which the connection belongs to. - :type private_endpoint: ~azure.mgmt.synapse.models.PrivateEndpoint - :param private_link_service_connection_state: Connection state of the private endpoint + :ivar private_endpoint: The private endpoint which the connection belongs to. + :vartype private_endpoint: ~azure.mgmt.synapse.models.PrivateEndpoint + :ivar private_link_service_connection_state: Connection state of the private endpoint connection. - :type private_link_service_connection_state: + :vartype private_link_service_connection_state: ~azure.mgmt.synapse.models.PrivateLinkServiceConnectionState :ivar provisioning_state: Provisioning state of the private endpoint connection. :vartype provisioning_state: str @@ -6255,6 +7582,14 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: The private endpoint which the connection belongs to. + :paramtype private_endpoint: ~azure.mgmt.synapse.models.PrivateEndpoint + :keyword private_link_service_connection_state: Connection state of the private endpoint + connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.synapse.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnectionProperties, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -6276,12 +7611,12 @@ class PrivateLinkHub(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param provisioning_state: PrivateLinkHub provisioning state. - :type provisioning_state: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: PrivateLinkHub provisioning state. + :vartype provisioning_state: str :ivar private_endpoint_connections: List of private endpoint connections. :vartype private_endpoint_connections: list[~azure.mgmt.synapse.models.PrivateEndpointConnectionForPrivateLinkHubBasic] @@ -6313,6 +7648,14 @@ def __init__( provisioning_state: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword provisioning_state: PrivateLinkHub provisioning state. + :paramtype provisioning_state: str + """ super(PrivateLinkHub, self).__init__(tags=tags, location=location, **kwargs) self.provisioning_state = provisioning_state self.private_endpoint_connections = None @@ -6321,10 +7664,10 @@ def __init__( class PrivateLinkHubInfoListResult(msrest.serialization.Model): """List of privateLinkHubs. - :param next_link: Link to the next page of results. - :type next_link: str - :param value: List of privateLinkHubs. - :type value: list[~azure.mgmt.synapse.models.PrivateLinkHub] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + :ivar value: List of privateLinkHubs. + :vartype value: list[~azure.mgmt.synapse.models.PrivateLinkHub] """ _attribute_map = { @@ -6339,6 +7682,12 @@ def __init__( value: Optional[List["PrivateLinkHub"]] = None, **kwargs ): + """ + :keyword next_link: Link to the next page of results. + :paramtype next_link: str + :keyword value: List of privateLinkHubs. + :paramtype value: list[~azure.mgmt.synapse.models.PrivateLinkHub] + """ super(PrivateLinkHubInfoListResult, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -6347,8 +7696,8 @@ def __init__( class PrivateLinkHubPatchInfo(msrest.serialization.Model): """PrivateLinkHub patch details. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -6361,6 +7710,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(PrivateLinkHubPatchInfo, self).__init__(**kwargs) self.tags = tags @@ -6400,6 +7753,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateLinkResource, self).__init__(**kwargs) self.properties = None @@ -6429,6 +7784,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -6463,6 +7820,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateLinkResourceProperties, self).__init__(**kwargs) self.group_id = None self.required_members = None @@ -6474,10 +7833,10 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param status: The private link service connection status. - :type status: str - :param description: The private link service connection description. - :type description: str + :ivar status: The private link service connection status. + :vartype status: str + :ivar description: The private link service connection description. + :vartype description: str :ivar actions_required: The actions required for private link service connection. :vartype actions_required: str """ @@ -6499,6 +7858,12 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword status: The private link service connection status. + :paramtype status: str + :keyword description: The private link service connection description. + :paramtype description: str + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -6508,8 +7873,8 @@ def __init__( class PurviewConfiguration(msrest.serialization.Model): """Purview Configuration. - :param purview_resource_id: Purview Resource ID. - :type purview_resource_id: str + :ivar purview_resource_id: Purview Resource ID. + :vartype purview_resource_id: str """ _attribute_map = { @@ -6522,6 +7887,10 @@ def __init__( purview_resource_id: Optional[str] = None, **kwargs ): + """ + :keyword purview_resource_id: Purview Resource ID. + :paramtype purview_resource_id: str + """ super(PurviewConfiguration, self).__init__(**kwargs) self.purview_resource_id = purview_resource_id @@ -6555,6 +7924,8 @@ def __init__( self, **kwargs ): + """ + """ super(QueryInterval, self).__init__(**kwargs) self.interval_start_time = None self.execution_count = None @@ -6595,6 +7966,8 @@ def __init__( self, **kwargs ): + """ + """ super(QueryMetric, self).__init__(**kwargs) self.name = None self.display_name = None @@ -6627,6 +8000,8 @@ def __init__( self, **kwargs ): + """ + """ super(QueryStatistic, self).__init__(**kwargs) self.query_id = None self.intervals = None @@ -6647,23 +8022,22 @@ class ReadWriteDatabase(Database): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the database.Constant filled by server. Possible values - include: "ReadWrite", "ReadOnlyFollowing". - :type kind: str or ~azure.mgmt.synapse.models.Kind + :ivar location: Resource location. + :vartype location: str + :ivar kind: Required. Kind of the database.Constant filled by server. Possible values include: + "ReadWrite", "ReadOnlyFollowing". + :vartype kind: str or ~azure.mgmt.synapse.models.Kind :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.synapse.models.SystemData :ivar provisioning_state: The provisioned state of the resource. Possible values include: "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState - :param soft_delete_period: The time the data should be kept before it stops being accessible to + :ivar soft_delete_period: The time the data should be kept before it stops being accessible to queries in TimeSpan. - :type soft_delete_period: ~datetime.timedelta - :param hot_cache_period: The time the data should be kept in cache for fast queries in - TimeSpan. - :type hot_cache_period: ~datetime.timedelta + :vartype soft_delete_period: ~datetime.timedelta + :ivar hot_cache_period: The time the data should be kept in cache for fast queries in TimeSpan. + :vartype hot_cache_period: ~datetime.timedelta :ivar statistics: The statistics of the database. :vartype statistics: ~azure.mgmt.synapse.models.DatabaseStatistics :ivar is_followed: Indicates whether the database is followed. @@ -6703,6 +8077,16 @@ def __init__( hot_cache_period: Optional[datetime.timedelta] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword soft_delete_period: The time the data should be kept before it stops being accessible + to queries in TimeSpan. + :paramtype soft_delete_period: ~datetime.timedelta + :keyword hot_cache_period: The time the data should be kept in cache for fast queries in + TimeSpan. + :paramtype hot_cache_period: ~datetime.timedelta + """ super(ReadWriteDatabase, self).__init__(location=location, **kwargs) self.kind = 'ReadWrite' # type: str self.provisioning_state = None @@ -6725,14 +8109,14 @@ class RecommendedSensitivityLabelUpdate(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param op: Possible values include: "enable", "disable". - :type op: str or ~azure.mgmt.synapse.models.RecommendedSensitivityLabelUpdateKind - :param schema: Schema name of the column to update. - :type schema: str - :param table: Table name of the column to update. - :type table: str - :param column: Column name to update. - :type column: str + :ivar op: Possible values include: "enable", "disable". + :vartype op: str or ~azure.mgmt.synapse.models.RecommendedSensitivityLabelUpdateKind + :ivar schema: Schema name of the column to update. + :vartype schema: str + :ivar table: Table name of the column to update. + :vartype table: str + :ivar column: Column name to update. + :vartype column: str """ _validation = { @@ -6760,6 +8144,16 @@ def __init__( column: Optional[str] = None, **kwargs ): + """ + :keyword op: Possible values include: "enable", "disable". + :paramtype op: str or ~azure.mgmt.synapse.models.RecommendedSensitivityLabelUpdateKind + :keyword schema: Schema name of the column to update. + :paramtype schema: str + :keyword table: Table name of the column to update. + :paramtype table: str + :keyword column: Column name to update. + :paramtype column: str + """ super(RecommendedSensitivityLabelUpdate, self).__init__(**kwargs) self.op = op self.schema = schema @@ -6770,8 +8164,8 @@ def __init__( class RecommendedSensitivityLabelUpdateList(msrest.serialization.Model): """A list of recommended sensitivity label update operations. - :param operations: - :type operations: list[~azure.mgmt.synapse.models.RecommendedSensitivityLabelUpdate] + :ivar operations: + :vartype operations: list[~azure.mgmt.synapse.models.RecommendedSensitivityLabelUpdate] """ _attribute_map = { @@ -6784,6 +8178,10 @@ def __init__( operations: Optional[List["RecommendedSensitivityLabelUpdate"]] = None, **kwargs ): + """ + :keyword operations: + :paramtype operations: list[~azure.mgmt.synapse.models.RecommendedSensitivityLabelUpdate] + """ super(RecommendedSensitivityLabelUpdateList, self).__init__(**kwargs) self.operations = operations @@ -6836,6 +8234,8 @@ def __init__( self, **kwargs ): + """ + """ super(RecoverableSqlPool, self).__init__(**kwargs) self.edition = None self.service_level_objective = None @@ -6868,6 +8268,8 @@ def __init__( self, **kwargs ): + """ + """ super(RecoverableSqlPoolListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -6876,8 +8278,8 @@ def __init__( class ReplaceAllFirewallRulesOperationResponse(msrest.serialization.Model): """An existing operation for replacing the firewall rules. - :param operation_id: The operation ID. - :type operation_id: str + :ivar operation_id: The operation ID. + :vartype operation_id: str """ _attribute_map = { @@ -6890,6 +8292,10 @@ def __init__( operation_id: Optional[str] = None, **kwargs ): + """ + :keyword operation_id: The operation ID. + :paramtype operation_id: str + """ super(ReplaceAllFirewallRulesOperationResponse, self).__init__(**kwargs) self.operation_id = operation_id @@ -6897,8 +8303,8 @@ def __init__( class ReplaceAllIpFirewallRulesRequest(msrest.serialization.Model): """Replace all IP firewall rules request. - :param ip_firewall_rules: IP firewall rule properties. - :type ip_firewall_rules: dict[str, ~azure.mgmt.synapse.models.IpFirewallRuleProperties] + :ivar ip_firewall_rules: IP firewall rule properties. + :vartype ip_firewall_rules: dict[str, ~azure.mgmt.synapse.models.IpFirewallRuleProperties] """ _attribute_map = { @@ -6911,6 +8317,10 @@ def __init__( ip_firewall_rules: Optional[Dict[str, "IpFirewallRuleProperties"]] = None, **kwargs ): + """ + :keyword ip_firewall_rules: IP firewall rule properties. + :paramtype ip_firewall_rules: dict[str, ~azure.mgmt.synapse.models.IpFirewallRuleProperties] + """ super(ReplaceAllIpFirewallRulesRequest, self).__init__(**kwargs) self.ip_firewall_rules = ip_firewall_rules @@ -6994,6 +8404,8 @@ def __init__( self, **kwargs ): + """ + """ super(ReplicationLink, self).__init__(**kwargs) self.location = None self.is_termination_allowed = None @@ -7013,8 +8425,8 @@ class ReplicationLinkListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: The list of Sql pool replication links housed in the Sql pool. - :type value: list[~azure.mgmt.synapse.models.ReplicationLink] + :ivar value: The list of Sql pool replication links housed in the Sql pool. + :vartype value: list[~azure.mgmt.synapse.models.ReplicationLink] :ivar next_link: Link to retrieve next page of results. :vartype next_link: str """ @@ -7034,6 +8446,10 @@ def __init__( value: Optional[List["ReplicationLink"]] = None, **kwargs ): + """ + :keyword value: The list of Sql pool replication links housed in the Sql pool. + :paramtype value: list[~azure.mgmt.synapse.models.ReplicationLink] + """ super(ReplicationLinkListResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -7044,8 +8460,8 @@ class ResourceMoveDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. The target ID for the resource. - :type id: str + :ivar id: Required. The target ID for the resource. + :vartype id: str """ _validation = { @@ -7062,6 +8478,10 @@ def __init__( id: str, **kwargs ): + """ + :keyword id: Required. The target ID for the resource. + :paramtype id: str + """ super(ResourceMoveDefinition, self).__init__(**kwargs) self.id = id @@ -7133,6 +8553,8 @@ def __init__( self, **kwargs ): + """ + """ super(RestorableDroppedSqlPool, self).__init__(**kwargs) self.location = None self.database_name = None @@ -7150,8 +8572,8 @@ class RestorableDroppedSqlPoolListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. A list of restorable dropped Sql pools. - :type value: list[~azure.mgmt.synapse.models.RestorableDroppedSqlPool] + :ivar value: Required. A list of restorable dropped Sql pools. + :vartype value: list[~azure.mgmt.synapse.models.RestorableDroppedSqlPool] """ _validation = { @@ -7168,6 +8590,10 @@ def __init__( value: List["RestorableDroppedSqlPool"], **kwargs ): + """ + :keyword value: Required. A list of restorable dropped Sql pools. + :paramtype value: list[~azure.mgmt.synapse.models.RestorableDroppedSqlPool] + """ super(RestorableDroppedSqlPoolListResult, self).__init__(**kwargs) self.value = value @@ -7224,6 +8650,8 @@ def __init__( self, **kwargs ): + """ + """ super(RestorePoint, self).__init__(**kwargs) self.location = None self.restore_point_type = None @@ -7257,6 +8685,8 @@ def __init__( self, **kwargs ): + """ + """ super(RestorePointListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -7270,8 +8700,8 @@ class SecretBase(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the secret.Constant filled by server. - :type type: str + :ivar type: Required. Type of the secret.Constant filled by server. + :vartype type: str """ _validation = { @@ -7290,6 +8720,8 @@ def __init__( self, **kwargs ): + """ + """ super(SecretBase, self).__init__(**kwargs) self.type = None # type: Optional[str] @@ -7299,10 +8731,10 @@ class SecureString(SecretBase): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of the secret.Constant filled by server. - :type type: str - :param value: Required. Value of secure string. - :type value: str + :ivar type: Required. Type of the secret.Constant filled by server. + :vartype type: str + :ivar value: Required. Value of secure string. + :vartype value: str """ _validation = { @@ -7321,6 +8753,10 @@ def __init__( value: str, **kwargs ): + """ + :keyword value: Required. Value of secure string. + :paramtype value: str + """ super(SecureString, self).__init__(**kwargs) self.type = 'SecureString' # type: str self.value = value @@ -7331,16 +8767,16 @@ class SelfHostedIntegrationRuntime(IntegrationRuntime): All required parameters must be populated in order to send to Azure. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, any] - :param type: Required. Type of integration runtime.Constant filled by server. Possible values + :vartype additional_properties: dict[str, any] + :ivar type: Required. Type of integration runtime.Constant filled by server. Possible values include: "Managed", "SelfHosted". - :type type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeType - :param description: Integration runtime description. - :type description: str - :param linked_info: Linked integration runtime type from data factory. - :type linked_info: ~azure.mgmt.synapse.models.LinkedIntegrationRuntimeType + :vartype type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeType + :ivar description: Integration runtime description. + :vartype description: str + :ivar linked_info: Linked integration runtime type from data factory. + :vartype linked_info: ~azure.mgmt.synapse.models.LinkedIntegrationRuntimeType """ _validation = { @@ -7362,6 +8798,15 @@ def __init__( linked_info: Optional["LinkedIntegrationRuntimeType"] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword description: Integration runtime description. + :paramtype description: str + :keyword linked_info: Linked integration runtime type from data factory. + :paramtype linked_info: ~azure.mgmt.synapse.models.LinkedIntegrationRuntimeType + """ super(SelfHostedIntegrationRuntime, self).__init__(additional_properties=additional_properties, description=description, **kwargs) self.type = 'SelfHosted' # type: str self.linked_info = linked_info @@ -7372,9 +8817,9 @@ class SelfHostedIntegrationRuntimeNode(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, any] + :vartype additional_properties: dict[str, any] :ivar node_name: Name of the integration runtime node. :vartype node_name: str :ivar machine_name: Machine name of the integration runtime node. @@ -7468,6 +8913,11 @@ def __init__( additional_properties: Optional[Dict[str, Any]] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + """ super(SelfHostedIntegrationRuntimeNode, self).__init__(**kwargs) self.additional_properties = additional_properties self.node_name = None @@ -7497,12 +8947,12 @@ class SelfHostedIntegrationRuntimeStatus(IntegrationRuntimeStatus): All required parameters must be populated in order to send to Azure. - :param additional_properties: Unmatched properties from the message are deserialized to this + :ivar additional_properties: Unmatched properties from the message are deserialized to this collection. - :type additional_properties: dict[str, any] - :param type: Required. Type of integration runtime.Constant filled by server. Possible values + :vartype additional_properties: dict[str, any] + :ivar type: Required. Type of integration runtime.Constant filled by server. Possible values include: "Managed", "SelfHosted". - :type type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeType + :vartype type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeType :ivar data_factory_name: The workspace name which the integration runtime belong to. :vartype data_factory_name: str :ivar state: The state of integration runtime. Possible values include: "Initial", "Stopped", @@ -7523,8 +8973,8 @@ class SelfHostedIntegrationRuntimeStatus(IntegrationRuntimeStatus): ~azure.mgmt.synapse.models.IntegrationRuntimeInternalChannelEncryptionMode :ivar version: Version of the integration runtime. :vartype version: str - :param nodes: The list of nodes for this integration runtime. - :type nodes: list[~azure.mgmt.synapse.models.SelfHostedIntegrationRuntimeNode] + :ivar nodes: The list of nodes for this integration runtime. + :vartype nodes: list[~azure.mgmt.synapse.models.SelfHostedIntegrationRuntimeNode] :ivar scheduled_update_date: The date at which the integration runtime will be scheduled to update, in ISO8601 format. :vartype scheduled_update_date: ~datetime.datetime @@ -7542,9 +8992,9 @@ class SelfHostedIntegrationRuntimeStatus(IntegrationRuntimeStatus): :vartype auto_update: str or ~azure.mgmt.synapse.models.IntegrationRuntimeAutoUpdate :ivar version_status: Status of the integration runtime version. :vartype version_status: str - :param links: The list of linked integration runtimes that are created to share with this + :ivar links: The list of linked integration runtimes that are created to share with this integration runtime. - :type links: list[~azure.mgmt.synapse.models.LinkedIntegrationRuntime] + :vartype links: list[~azure.mgmt.synapse.models.LinkedIntegrationRuntime] :ivar pushed_version: The version that the integration runtime is going to update to. :vartype pushed_version: str :ivar latest_version: The latest version on download center. @@ -7607,6 +9057,16 @@ def __init__( links: Optional[List["LinkedIntegrationRuntime"]] = None, **kwargs ): + """ + :keyword additional_properties: Unmatched properties from the message are deserialized to this + collection. + :paramtype additional_properties: dict[str, any] + :keyword nodes: The list of nodes for this integration runtime. + :paramtype nodes: list[~azure.mgmt.synapse.models.SelfHostedIntegrationRuntimeNode] + :keyword links: The list of linked integration runtimes that are created to share with this + integration runtime. + :paramtype links: list[~azure.mgmt.synapse.models.LinkedIntegrationRuntime] + """ super(SelfHostedIntegrationRuntimeStatus, self).__init__(additional_properties=additional_properties, **kwargs) self.type = 'SelfHosted' # type: str self.create_time = None @@ -7649,20 +9109,20 @@ class SensitivityLabel(ProxyResource): :vartype table_name: str :ivar column_name: The column name. :vartype column_name: str - :param label_name: The label name. - :type label_name: str - :param label_id: The label ID. - :type label_id: str - :param information_type: The information type. - :type information_type: str - :param information_type_id: The information type ID. - :type information_type_id: str + :ivar label_name: The label name. + :vartype label_name: str + :ivar label_id: The label ID. + :vartype label_id: str + :ivar information_type: The information type. + :vartype information_type: str + :ivar information_type_id: The information type ID. + :vartype information_type_id: str :ivar is_disabled: Is sensitivity recommendation disabled. Applicable for recommended sensitivity label only. Specifies whether the sensitivity recommendation on this column is disabled (dismissed) or not. :vartype is_disabled: bool - :param rank: Possible values include: "None", "Low", "Medium", "High", "Critical". - :type rank: str or ~azure.mgmt.synapse.models.SensitivityLabelRank + :ivar rank: Possible values include: "None", "Low", "Medium", "High", "Critical". + :vartype rank: str or ~azure.mgmt.synapse.models.SensitivityLabelRank """ _validation = { @@ -7702,6 +9162,18 @@ def __init__( rank: Optional[Union[str, "SensitivityLabelRank"]] = None, **kwargs ): + """ + :keyword label_name: The label name. + :paramtype label_name: str + :keyword label_id: The label ID. + :paramtype label_id: str + :keyword information_type: The information type. + :paramtype information_type: str + :keyword information_type_id: The information type ID. + :paramtype information_type_id: str + :keyword rank: Possible values include: "None", "Low", "Medium", "High", "Critical". + :paramtype rank: str or ~azure.mgmt.synapse.models.SensitivityLabelRank + """ super(SensitivityLabel, self).__init__(**kwargs) self.managed_by = None self.schema_name = None @@ -7740,6 +9212,8 @@ def __init__( self, **kwargs ): + """ + """ super(SensitivityLabelListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -7758,16 +9232,16 @@ class SensitivityLabelUpdate(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param op: Possible values include: "set", "remove". - :type op: str or ~azure.mgmt.synapse.models.SensitivityLabelUpdateKind - :param schema: Schema name of the column to update. - :type schema: str - :param table: Table name of the column to update. - :type table: str - :param column: Column name to update. - :type column: str - :param sensitivity_label: The sensitivity label information to apply on a column. - :type sensitivity_label: ~azure.mgmt.synapse.models.SensitivityLabel + :ivar op: Possible values include: "set", "remove". + :vartype op: str or ~azure.mgmt.synapse.models.SensitivityLabelUpdateKind + :ivar schema: Schema name of the column to update. + :vartype schema: str + :ivar table: Table name of the column to update. + :vartype table: str + :ivar column: Column name to update. + :vartype column: str + :ivar sensitivity_label: The sensitivity label information to apply on a column. + :vartype sensitivity_label: ~azure.mgmt.synapse.models.SensitivityLabel """ _validation = { @@ -7797,6 +9271,18 @@ def __init__( sensitivity_label: Optional["SensitivityLabel"] = None, **kwargs ): + """ + :keyword op: Possible values include: "set", "remove". + :paramtype op: str or ~azure.mgmt.synapse.models.SensitivityLabelUpdateKind + :keyword schema: Schema name of the column to update. + :paramtype schema: str + :keyword table: Table name of the column to update. + :paramtype table: str + :keyword column: Column name to update. + :paramtype column: str + :keyword sensitivity_label: The sensitivity label information to apply on a column. + :paramtype sensitivity_label: ~azure.mgmt.synapse.models.SensitivityLabel + """ super(SensitivityLabelUpdate, self).__init__(**kwargs) self.op = op self.schema = schema @@ -7808,8 +9294,8 @@ def __init__( class SensitivityLabelUpdateList(msrest.serialization.Model): """A list of sensitivity label update operations. - :param operations: - :type operations: list[~azure.mgmt.synapse.models.SensitivityLabelUpdate] + :ivar operations: + :vartype operations: list[~azure.mgmt.synapse.models.SensitivityLabelUpdate] """ _attribute_map = { @@ -7822,6 +9308,10 @@ def __init__( operations: Optional[List["SensitivityLabelUpdate"]] = None, **kwargs ): + """ + :keyword operations: + :paramtype operations: list[~azure.mgmt.synapse.models.SensitivityLabelUpdate] + """ super(SensitivityLabelUpdateList, self).__init__(**kwargs) self.operations = operations @@ -7839,15 +9329,14 @@ class ServerBlobAuditingPolicy(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param state: Specifies the state of the policy. If state is Enabled, storageEndpoint or + :ivar state: Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyState - :param storage_endpoint: Specifies the blob storage endpoint (e.g. + :vartype state: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyState + :ivar storage_endpoint: Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled is required. - :type storage_endpoint: str - :param storage_account_access_key: Specifies the identifier key of the auditing storage - account. + :vartype storage_endpoint: str + :ivar storage_account_access_key: Specifies the identifier key of the auditing storage account. If state is Enabled and storageEndpoint is specified, not specifying the storageAccountAccessKey will use SQL server system-assigned managed identity to access the storage. @@ -7859,11 +9348,11 @@ class ServerBlobAuditingPolicy(ProxyResource): Contributor' RBAC role to the server identity. For more information, see `Auditing to storage using Managed Identity authentication `_. - :type storage_account_access_key: str - :param retention_days: Specifies the number of days to keep in the audit logs in the storage + :vartype storage_account_access_key: str + :ivar retention_days: Specifies the number of days to keep in the audit logs in the storage account. - :type retention_days: int - :param audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit. + :vartype retention_days: int + :ivar audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit. The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and @@ -7931,13 +9420,13 @@ class ServerBlobAuditingPolicy(ProxyResource): For more information, see `Database-Level Audit Actions `_. - :type audit_actions_and_groups: list[str] - :param storage_account_subscription_id: Specifies the blob storage subscription Id. - :type storage_account_subscription_id: str - :param is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is the + :vartype audit_actions_and_groups: list[str] + :ivar storage_account_subscription_id: Specifies the blob storage subscription Id. + :vartype storage_account_subscription_id: str + :ivar is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is the storage's secondary key. - :type is_storage_secondary_key_in_use: bool - :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure + :vartype is_storage_secondary_key_in_use: bool + :ivar is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. @@ -7953,11 +9442,11 @@ class ServerBlobAuditingPolicy(ProxyResource): For more information, see `Diagnostic Settings REST API `_ or `Diagnostic Settings PowerShell `_. - :type is_azure_monitor_target_enabled: bool - :param queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before - audit actions are forced to be processed. + :vartype is_azure_monitor_target_enabled: bool + :ivar queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before audit + actions are forced to be processed. The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. - :type queue_delay_ms: int + :vartype queue_delay_ms: int """ _validation = { @@ -7995,6 +9484,127 @@ def __init__( queue_delay_ms: Optional[int] = None, **kwargs ): + """ + :keyword state: Specifies the state of the policy. If state is Enabled, storageEndpoint or + isAzureMonitorTargetEnabled are required. Possible values include: "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyState + :keyword storage_endpoint: Specifies the blob storage endpoint (e.g. + https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint or + isAzureMonitorTargetEnabled is required. + :paramtype storage_endpoint: str + :keyword storage_account_access_key: Specifies the identifier key of the auditing storage + account. + If state is Enabled and storageEndpoint is specified, not specifying the + storageAccountAccessKey will use SQL server system-assigned managed identity to access the + storage. + Prerequisites for using managed identity authentication: + + + #. Assign SQL Server a system-assigned managed identity in Azure Active Directory (AAD). + #. Grant SQL Server identity access to the storage account by adding 'Storage Blob Data + Contributor' RBAC role to the server identity. + For more information, see `Auditing to storage using Managed Identity authentication + `_. + :paramtype storage_account_access_key: str + :keyword retention_days: Specifies the number of days to keep in the audit logs in the storage + account. + :paramtype retention_days: int + :keyword audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit. + + The recommended set of action groups to use is the following combination - this will audit all + the queries and stored procedures executed against the database, as well as successful and + failed logins: + + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + + This above combination is also the set that is configured by default when enabling auditing + from the Azure portal. + + The supported action groups to audit are (note: choose only specific groups that cover your + auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + + These are groups that cover all sql statements and stored procedures executed against the + database, and should not be used in combination with other groups as this will result in + duplicate audit logs. + + For more information, see `Database-Level Audit Action Groups + `_. + + For Database auditing policy, specific Actions can also be specified (note that Actions cannot + be specified for Server auditing policy). The supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + + The general form for defining an action to be audited is: + {action} ON {object} BY {principal} + + Note that :code:`` in the above format can refer to an object like a table, view, or + stored procedure, or an entire database or schema. For the latter cases, the forms + DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + + For more information, see `Database-Level Audit Actions + `_. + :paramtype audit_actions_and_groups: list[str] + :keyword storage_account_subscription_id: Specifies the blob storage subscription Id. + :paramtype storage_account_subscription_id: str + :keyword is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is + the storage's secondary key. + :paramtype is_storage_secondary_key_in_use: bool + :keyword is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure + Monitor. + In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and + 'isAzureMonitorTargetEnabled' as true. + + When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' + diagnostic logs category on the database should be also created. + Note that for server level audit you should use the 'master' database as {databaseName}. + + Diagnostic Settings URI format: + PUT + https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + + For more information, see `Diagnostic Settings REST API + `_ + or `Diagnostic Settings PowerShell `_. + :paramtype is_azure_monitor_target_enabled: bool + :keyword queue_delay_ms: Specifies the amount of time in milliseconds that can elapse before + audit actions are forced to be processed. + The default minimum value is 1000 (1 second). The maximum is 2,147,483,647. + :paramtype queue_delay_ms: int + """ super(ServerBlobAuditingPolicy, self).__init__(**kwargs) self.state = state self.storage_endpoint = storage_endpoint @@ -8032,6 +9642,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServerBlobAuditingPolicyListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -8050,26 +9662,26 @@ class ServerSecurityAlertPolicy(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param state: Specifies the state of the policy, whether it is enabled or disabled or a policy + :ivar state: Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific server. Possible values include: "New", "Enabled", "Disabled". - :type state: str or ~azure.mgmt.synapse.models.SecurityAlertPolicyState - :param disabled_alerts: Specifies an array of alerts that are disabled. Allowed values are: + :vartype state: str or ~azure.mgmt.synapse.models.SecurityAlertPolicyState + :ivar disabled_alerts: Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. - :type disabled_alerts: list[str] - :param email_addresses: Specifies an array of e-mail addresses to which the alert is sent. - :type email_addresses: list[str] - :param email_account_admins: Specifies that the alert is sent to the account administrators. - :type email_account_admins: bool - :param storage_endpoint: Specifies the blob storage endpoint (e.g. + :vartype disabled_alerts: list[str] + :ivar email_addresses: Specifies an array of e-mail addresses to which the alert is sent. + :vartype email_addresses: list[str] + :ivar email_account_admins: Specifies that the alert is sent to the account administrators. + :vartype email_account_admins: bool + :ivar storage_endpoint: Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. - :type storage_endpoint: str - :param storage_account_access_key: Specifies the identifier key of the Threat Detection audit + :vartype storage_endpoint: str + :ivar storage_account_access_key: Specifies the identifier key of the Threat Detection audit storage account. - :type storage_account_access_key: str - :param retention_days: Specifies the number of days to keep in the Threat Detection audit logs. - :type retention_days: int + :vartype storage_account_access_key: str + :ivar retention_days: Specifies the number of days to keep in the Threat Detection audit logs. + :vartype retention_days: int :ivar creation_time: Specifies the UTC creation time of the policy. :vartype creation_time: ~datetime.datetime """ @@ -8107,6 +9719,29 @@ def __init__( retention_days: Optional[int] = None, **kwargs ): + """ + :keyword state: Specifies the state of the policy, whether it is enabled or disabled or a + policy has not been applied yet on the specific server. Possible values include: "New", + "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.synapse.models.SecurityAlertPolicyState + :keyword disabled_alerts: Specifies an array of alerts that are disabled. Allowed values are: + Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + :paramtype disabled_alerts: list[str] + :keyword email_addresses: Specifies an array of e-mail addresses to which the alert is sent. + :paramtype email_addresses: list[str] + :keyword email_account_admins: Specifies that the alert is sent to the account administrators. + :paramtype email_account_admins: bool + :keyword storage_endpoint: Specifies the blob storage endpoint (e.g. + https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection + audit logs. + :paramtype storage_endpoint: str + :keyword storage_account_access_key: Specifies the identifier key of the Threat Detection audit + storage account. + :paramtype storage_account_access_key: str + :keyword retention_days: Specifies the number of days to keep in the Threat Detection audit + logs. + :paramtype retention_days: int + """ super(ServerSecurityAlertPolicy, self).__init__(**kwargs) self.state = state self.disabled_alerts = disabled_alerts @@ -8143,6 +9778,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServerSecurityAlertPolicyListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -8193,6 +9830,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServerUsage, self).__init__(**kwargs) self.name = None self.resource_name = None @@ -8210,8 +9849,8 @@ class ServerUsageListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of server metrics for the server. - :type value: list[~azure.mgmt.synapse.models.ServerUsage] + :ivar value: Required. The list of server metrics for the server. + :vartype value: list[~azure.mgmt.synapse.models.ServerUsage] :ivar next_link: Link to retrieve next page of results. :vartype next_link: str """ @@ -8232,6 +9871,10 @@ def __init__( value: List["ServerUsage"], **kwargs ): + """ + :keyword value: Required. The list of server metrics for the server. + :paramtype value: list[~azure.mgmt.synapse.models.ServerUsage] + """ super(ServerUsageListResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -8250,19 +9893,19 @@ class ServerVulnerabilityAssessment(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param storage_container_path: A blob storage container path to hold the scan results (e.g. + :ivar storage_container_path: A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). - :type storage_container_path: str - :param storage_container_sas_key: A shared access signature (SAS Key) that has read and write + :vartype storage_container_path: str + :ivar storage_container_sas_key: A shared access signature (SAS Key) that has read and write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. - :type storage_container_sas_key: str - :param storage_account_access_key: Specifies the identifier key of the storage account for + :vartype storage_container_sas_key: str + :ivar storage_account_access_key: Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. - :type storage_account_access_key: str - :param recurring_scans: The recurring scans settings. - :type recurring_scans: + :vartype storage_account_access_key: str + :ivar recurring_scans: The recurring scans settings. + :vartype recurring_scans: ~azure.mgmt.synapse.models.VulnerabilityAssessmentRecurringScansProperties """ @@ -8291,6 +9934,22 @@ def __init__( recurring_scans: Optional["VulnerabilityAssessmentRecurringScansProperties"] = None, **kwargs ): + """ + :keyword storage_container_path: A blob storage container path to hold the scan results (e.g. + https://myStorage.blob.core.windows.net/VaScans/). + :paramtype storage_container_path: str + :keyword storage_container_sas_key: A shared access signature (SAS Key) that has read and write + access to the blob container specified in 'storageContainerPath' parameter. If + 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. + :paramtype storage_container_sas_key: str + :keyword storage_account_access_key: Specifies the identifier key of the storage account for + vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, + storageAccountAccessKey is required. + :paramtype storage_account_access_key: str + :keyword recurring_scans: The recurring scans settings. + :paramtype recurring_scans: + ~azure.mgmt.synapse.models.VulnerabilityAssessmentRecurringScansProperties + """ super(ServerVulnerabilityAssessment, self).__init__(**kwargs) self.storage_container_path = storage_container_path self.storage_container_sas_key = storage_container_sas_key @@ -8323,6 +9982,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServerVulnerabilityAssessmentListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -8331,13 +9992,13 @@ def __init__( class Sku(msrest.serialization.Model): """SQL pool SKU. - :param tier: The service tier. - :type tier: str - :param name: The SKU name. - :type name: str - :param capacity: If the SKU supports scale out/in then the capacity integer should be included. + :ivar tier: The service tier. + :vartype tier: str + :ivar name: The SKU name. + :vartype name: str + :ivar capacity: If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. - :type capacity: int + :vartype capacity: int """ _attribute_map = { @@ -8354,6 +10015,15 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword tier: The service tier. + :paramtype tier: str + :keyword name: The SKU name. + :paramtype name: str + :keyword capacity: If the SKU supports scale out/in then the capacity integer should be + included. If scale out/in is not possible for the resource this may be omitted. + :paramtype capacity: int + """ super(Sku, self).__init__(**kwargs) self.tier = tier self.name = name @@ -8401,6 +10071,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuDescription, self).__init__(**kwargs) self.resource_type = None self.name = None @@ -8431,6 +10103,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuDescriptionList, self).__init__(**kwargs) self.value = None @@ -8440,10 +10114,10 @@ class SkuLocationInfoItem(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param location: Required. The available location of the SKU. - :type location: str - :param zones: The available zone of the SKU. - :type zones: list[str] + :ivar location: Required. The available location of the SKU. + :vartype location: str + :ivar zones: The available zone of the SKU. + :vartype zones: list[str] """ _validation = { @@ -8462,6 +10136,12 @@ def __init__( zones: Optional[List[str]] = None, **kwargs ): + """ + :keyword location: Required. The available location of the SKU. + :paramtype location: str + :keyword zones: The available zone of the SKU. + :paramtype zones: list[str] + """ super(SkuLocationInfoItem, self).__init__(**kwargs) self.location = location self.zones = zones @@ -8474,13 +10154,13 @@ class SparkConfigProperties(msrest.serialization.Model): :ivar time: The last update time of the spark config properties file. :vartype time: ~datetime.datetime - :param content: The spark config properties. - :type content: str - :param filename: The filename of the spark config properties file. - :type filename: str - :param configuration_type: The type of the spark config properties file. Possible values + :ivar content: The spark config properties. + :vartype content: str + :ivar filename: The filename of the spark config properties file. + :vartype filename: str + :ivar configuration_type: The type of the spark config properties file. Possible values include: "File", "Artifact". - :type configuration_type: str or ~azure.mgmt.synapse.models.ConfigurationType + :vartype configuration_type: str or ~azure.mgmt.synapse.models.ConfigurationType """ _validation = { @@ -8502,6 +10182,15 @@ def __init__( configuration_type: Optional[Union[str, "ConfigurationType"]] = None, **kwargs ): + """ + :keyword content: The spark config properties. + :paramtype content: str + :keyword filename: The filename of the spark config properties file. + :paramtype filename: str + :keyword configuration_type: The type of the spark config properties file. Possible values + include: "File", "Artifact". + :paramtype configuration_type: str or ~azure.mgmt.synapse.models.ConfigurationType + """ super(SparkConfigProperties, self).__init__(**kwargs) self.time = None self.content = content @@ -8514,10 +10203,10 @@ class SparkConfigurationListResponse(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. List of SparkConfiguration. - :type value: list[~azure.mgmt.synapse.models.SparkConfigurationResource] - :param next_link: The link to the next page of results, if any remaining results exist. - :type next_link: str + :ivar value: Required. List of SparkConfiguration. + :vartype value: list[~azure.mgmt.synapse.models.SparkConfigurationResource] + :ivar next_link: The link to the next page of results, if any remaining results exist. + :vartype next_link: str """ _validation = { @@ -8536,6 +10225,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Required. List of SparkConfiguration. + :paramtype value: list[~azure.mgmt.synapse.models.SparkConfigurationResource] + :keyword next_link: The link to the next page of results, if any remaining results exist. + :paramtype next_link: str + """ super(SparkConfigurationListResponse, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -8558,18 +10253,18 @@ class SparkConfigurationResource(SubResource): :vartype type: str :ivar etag: Resource Etag. :vartype etag: str - :param description: Description about the SparkConfiguration. - :type description: str - :param configs: Required. SparkConfiguration configs. - :type configs: dict[str, str] - :param annotations: Annotations for SparkConfiguration. - :type annotations: list[str] - :param notes: additional Notes. - :type notes: str - :param created_by: The identity that created the resource. - :type created_by: str - :param created: The timestamp of resource creation. - :type created: ~datetime.datetime + :ivar description: Description about the SparkConfiguration. + :vartype description: str + :ivar configs: Required. SparkConfiguration configs. + :vartype configs: dict[str, str] + :ivar annotations: Annotations for SparkConfiguration. + :vartype annotations: list[str] + :ivar notes: additional Notes. + :vartype notes: str + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created: The timestamp of resource creation. + :vartype created: ~datetime.datetime """ _validation = { @@ -8604,6 +10299,20 @@ def __init__( created: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword description: Description about the SparkConfiguration. + :paramtype description: str + :keyword configs: Required. SparkConfiguration configs. + :paramtype configs: dict[str, str] + :keyword annotations: Annotations for SparkConfiguration. + :paramtype annotations: list[str] + :keyword notes: additional Notes. + :paramtype notes: str + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created: The timestamp of resource creation. + :paramtype created: ~datetime.datetime + """ super(SparkConfigurationResource, self).__init__(**kwargs) self.description = description self.configs = configs @@ -8628,27 +10337,27 @@ class SqlPool(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param sku: SQL pool SKU. - :type sku: ~azure.mgmt.synapse.models.Sku - :param max_size_bytes: Maximum size in bytes. - :type max_size_bytes: long - :param collation: Collation mode. - :type collation: str - :param source_database_id: Source database to create from. - :type source_database_id: str - :param recoverable_database_id: Backup database to restore from. - :type recoverable_database_id: str - :param provisioning_state: Resource state. - :type provisioning_state: str - :param status: Resource status. - :type status: str - :param restore_point_in_time: Snapshot time to restore. - :type restore_point_in_time: ~datetime.datetime - :param create_mode: Specifies the mode of sql pool creation. + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar sku: SQL pool SKU. + :vartype sku: ~azure.mgmt.synapse.models.Sku + :ivar max_size_bytes: Maximum size in bytes. + :vartype max_size_bytes: long + :ivar collation: Collation mode. + :vartype collation: str + :ivar source_database_id: Source database to create from. + :vartype source_database_id: str + :ivar recoverable_database_id: Backup database to restore from. + :vartype recoverable_database_id: str + :ivar provisioning_state: Resource state. + :vartype provisioning_state: str + :ivar status: Resource status. + :vartype status: str + :ivar restore_point_in_time: Snapshot time to restore. + :vartype restore_point_in_time: ~datetime.datetime + :ivar create_mode: Specifies the mode of sql pool creation. Default: regular sql pool creation. @@ -8663,14 +10372,14 @@ class SqlPool(TrackedResource): should be the sql pool's original resource ID. SourceDatabaseId and sourceDatabaseDeletionDate must be specified. Possible values include: "Default", "PointInTimeRestore", "Recovery", "Restore". - :type create_mode: str or ~azure.mgmt.synapse.models.CreateMode - :param creation_date: Date the SQL pool was created. - :type creation_date: ~datetime.datetime - :param storage_account_type: The storage account type used to store backups for this sql pool. + :vartype create_mode: str or ~azure.mgmt.synapse.models.CreateMode + :ivar creation_date: Date the SQL pool was created. + :vartype creation_date: ~datetime.datetime + :ivar storage_account_type: The storage account type used to store backups for this sql pool. Possible values include: "GRS", "LRS", "ZRS". - :type storage_account_type: str or ~azure.mgmt.synapse.models.StorageAccountType - :param source_database_deletion_date: Specifies the time that the sql pool was deleted. - :type source_database_deletion_date: ~datetime.datetime + :vartype storage_account_type: str or ~azure.mgmt.synapse.models.StorageAccountType + :ivar source_database_deletion_date: Specifies the time that the sql pool was deleted. + :vartype source_database_deletion_date: ~datetime.datetime """ _validation = { @@ -8719,6 +10428,51 @@ def __init__( source_database_deletion_date: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword sku: SQL pool SKU. + :paramtype sku: ~azure.mgmt.synapse.models.Sku + :keyword max_size_bytes: Maximum size in bytes. + :paramtype max_size_bytes: long + :keyword collation: Collation mode. + :paramtype collation: str + :keyword source_database_id: Source database to create from. + :paramtype source_database_id: str + :keyword recoverable_database_id: Backup database to restore from. + :paramtype recoverable_database_id: str + :keyword provisioning_state: Resource state. + :paramtype provisioning_state: str + :keyword status: Resource status. + :paramtype status: str + :keyword restore_point_in_time: Snapshot time to restore. + :paramtype restore_point_in_time: ~datetime.datetime + :keyword create_mode: Specifies the mode of sql pool creation. + + Default: regular sql pool creation. + + PointInTimeRestore: Creates a sql pool by restoring a point in time backup of an existing sql + pool. sourceDatabaseId must be specified as the resource ID of the existing sql pool, and + restorePointInTime must be specified. + + Recovery: Creates a sql pool by a geo-replicated backup. sourceDatabaseId must be specified + as the recoverableDatabaseId to restore. + + Restore: Creates a sql pool by restoring a backup of a deleted sql pool. SourceDatabaseId + should be the sql pool's original resource ID. SourceDatabaseId and sourceDatabaseDeletionDate + must be specified. Possible values include: "Default", "PointInTimeRestore", "Recovery", + "Restore". + :paramtype create_mode: str or ~azure.mgmt.synapse.models.CreateMode + :keyword creation_date: Date the SQL pool was created. + :paramtype creation_date: ~datetime.datetime + :keyword storage_account_type: The storage account type used to store backups for this sql + pool. Possible values include: "GRS", "LRS", "ZRS". + :paramtype storage_account_type: str or ~azure.mgmt.synapse.models.StorageAccountType + :keyword source_database_deletion_date: Specifies the time that the sql pool was deleted. + :paramtype source_database_deletion_date: ~datetime.datetime + """ super(SqlPool, self).__init__(tags=tags, location=location, **kwargs) self.sku = sku self.max_size_bytes = max_size_bytes @@ -8749,20 +10503,19 @@ class SqlPoolBlobAuditingPolicy(ProxyResource): :vartype type: str :ivar kind: Resource kind. :vartype kind: str - :param state: Specifies the state of the policy. If state is Enabled, storageEndpoint or + :ivar state: Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. Possible values include: "Enabled", "Disabled". - :type state: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyState - :param storage_endpoint: Specifies the blob storage endpoint (e.g. + :vartype state: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyState + :ivar storage_endpoint: Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. - :type storage_endpoint: str - :param storage_account_access_key: Specifies the identifier key of the auditing storage - account. If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is - required. - :type storage_account_access_key: str - :param retention_days: Specifies the number of days to keep in the audit logs in the storage + :vartype storage_endpoint: str + :ivar storage_account_access_key: Specifies the identifier key of the auditing storage account. + If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is required. + :vartype storage_account_access_key: str + :ivar retention_days: Specifies the number of days to keep in the audit logs in the storage account. - :type retention_days: int - :param audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit. + :vartype retention_days: int + :ivar audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit. The recommended set of action groups to use is the following combination - this will audit all the queries and stored procedures executed against the database, as well as successful and @@ -8830,13 +10583,13 @@ class SqlPoolBlobAuditingPolicy(ProxyResource): For more information, see `Database-Level Audit Actions `_. - :type audit_actions_and_groups: list[str] - :param storage_account_subscription_id: Specifies the blob storage subscription Id. - :type storage_account_subscription_id: str - :param is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is the + :vartype audit_actions_and_groups: list[str] + :ivar storage_account_subscription_id: Specifies the blob storage subscription Id. + :vartype storage_account_subscription_id: str + :ivar is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is the storage's secondary key. - :type is_storage_secondary_key_in_use: bool - :param is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure + :vartype is_storage_secondary_key_in_use: bool + :ivar is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure Monitor. In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and 'isAzureMonitorTargetEnabled' as true. @@ -8852,7 +10605,7 @@ class SqlPoolBlobAuditingPolicy(ProxyResource): For more information, see `Diagnostic Settings REST API `_ or `Diagnostic Settings PowerShell `_. - :type is_azure_monitor_target_enabled: bool + :vartype is_azure_monitor_target_enabled: bool """ _validation = { @@ -8890,6 +10643,112 @@ def __init__( is_azure_monitor_target_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword state: Specifies the state of the policy. If state is Enabled, storageEndpoint or + isAzureMonitorTargetEnabled are required. Possible values include: "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyState + :keyword storage_endpoint: Specifies the blob storage endpoint (e.g. + https://MyAccount.blob.core.windows.net). If state is Enabled, storageEndpoint is required. + :paramtype storage_endpoint: str + :keyword storage_account_access_key: Specifies the identifier key of the auditing storage + account. If state is Enabled and storageEndpoint is specified, storageAccountAccessKey is + required. + :paramtype storage_account_access_key: str + :keyword retention_days: Specifies the number of days to keep in the audit logs in the storage + account. + :paramtype retention_days: int + :keyword audit_actions_and_groups: Specifies the Actions-Groups and Actions to audit. + + The recommended set of action groups to use is the following combination - this will audit all + the queries and stored procedures executed against the database, as well as successful and + failed logins: + + BATCH_COMPLETED_GROUP, + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP, + FAILED_DATABASE_AUTHENTICATION_GROUP. + + This above combination is also the set that is configured by default when enabling auditing + from the Azure portal. + + The supported action groups to audit are (note: choose only specific groups that cover your + auditing needs. Using unnecessary groups could lead to very large quantities of audit records): + + APPLICATION_ROLE_CHANGE_PASSWORD_GROUP + BACKUP_RESTORE_GROUP + DATABASE_LOGOUT_GROUP + DATABASE_OBJECT_CHANGE_GROUP + DATABASE_OBJECT_OWNERSHIP_CHANGE_GROUP + DATABASE_OBJECT_PERMISSION_CHANGE_GROUP + DATABASE_OPERATION_GROUP + DATABASE_PERMISSION_CHANGE_GROUP + DATABASE_PRINCIPAL_CHANGE_GROUP + DATABASE_PRINCIPAL_IMPERSONATION_GROUP + DATABASE_ROLE_MEMBER_CHANGE_GROUP + FAILED_DATABASE_AUTHENTICATION_GROUP + SCHEMA_OBJECT_ACCESS_GROUP + SCHEMA_OBJECT_CHANGE_GROUP + SCHEMA_OBJECT_OWNERSHIP_CHANGE_GROUP + SCHEMA_OBJECT_PERMISSION_CHANGE_GROUP + SUCCESSFUL_DATABASE_AUTHENTICATION_GROUP + USER_CHANGE_PASSWORD_GROUP + BATCH_STARTED_GROUP + BATCH_COMPLETED_GROUP + + These are groups that cover all sql statements and stored procedures executed against the + database, and should not be used in combination with other groups as this will result in + duplicate audit logs. + + For more information, see `Database-Level Audit Action Groups + `_. + + For Database auditing policy, specific Actions can also be specified (note that Actions cannot + be specified for Server auditing policy). The supported actions to audit are: + SELECT + UPDATE + INSERT + DELETE + EXECUTE + RECEIVE + REFERENCES + + The general form for defining an action to be audited is: + {action} ON {object} BY {principal} + + Note that :code:`` in the above format can refer to an object like a table, view, or + stored procedure, or an entire database or schema. For the latter cases, the forms + DATABASE::{db_name} and SCHEMA::{schema_name} are used, respectively. + + For example: + SELECT on dbo.myTable by public + SELECT on DATABASE::myDatabase by public + SELECT on SCHEMA::mySchema by public + + For more information, see `Database-Level Audit Actions + `_. + :paramtype audit_actions_and_groups: list[str] + :keyword storage_account_subscription_id: Specifies the blob storage subscription Id. + :paramtype storage_account_subscription_id: str + :keyword is_storage_secondary_key_in_use: Specifies whether storageAccountAccessKey value is + the storage's secondary key. + :paramtype is_storage_secondary_key_in_use: bool + :keyword is_azure_monitor_target_enabled: Specifies whether audit events are sent to Azure + Monitor. + In order to send the events to Azure Monitor, specify 'state' as 'Enabled' and + 'isAzureMonitorTargetEnabled' as true. + + When using REST API to configure auditing, Diagnostic Settings with 'SQLSecurityAuditEvents' + diagnostic logs category on the database should be also created. + Note that for server level audit you should use the 'master' database as {databaseName}. + + Diagnostic Settings URI format: + PUT + https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/providers/microsoft.insights/diagnosticSettings/{settingsName}?api-version=2017-05-01-preview + + For more information, see `Diagnostic Settings REST API + `_ + or `Diagnostic Settings PowerShell `_. + :paramtype is_azure_monitor_target_enabled: bool + """ super(SqlPoolBlobAuditingPolicy, self).__init__(**kwargs) self.kind = None self.state = state @@ -8927,6 +10786,8 @@ def __init__( self, **kwargs ): + """ + """ super(SqlPoolBlobAuditingPolicyListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -8957,6 +10818,8 @@ def __init__( self, **kwargs ): + """ + """ super(SqlPoolBlobAuditingPolicySqlPoolOperationListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -8975,12 +10838,12 @@ class SqlPoolColumn(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param column_type: The column data type. Possible values include: "image", "text", + :ivar column_type: The column data type. Possible values include: "image", "text", "uniqueidentifier", "date", "time", "datetime2", "datetimeoffset", "tinyint", "smallint", "int", "smalldatetime", "real", "money", "datetime", "float", "sql_variant", "ntext", "bit", "decimal", "numeric", "smallmoney", "bigint", "hierarchyid", "geometry", "geography", "varbinary", "varchar", "binary", "char", "timestamp", "nvarchar", "nchar", "xml", "sysname". - :type column_type: str or ~azure.mgmt.synapse.models.ColumnDataType + :vartype column_type: str or ~azure.mgmt.synapse.models.ColumnDataType :ivar is_computed: Indicates whether column value is computed or not. :vartype is_computed: bool """ @@ -9006,6 +10869,14 @@ def __init__( column_type: Optional[Union[str, "ColumnDataType"]] = None, **kwargs ): + """ + :keyword column_type: The column data type. Possible values include: "image", "text", + "uniqueidentifier", "date", "time", "datetime2", "datetimeoffset", "tinyint", "smallint", + "int", "smalldatetime", "real", "money", "datetime", "float", "sql_variant", "ntext", "bit", + "decimal", "numeric", "smallmoney", "bigint", "hierarchyid", "geometry", "geography", + "varbinary", "varchar", "binary", "char", "timestamp", "nvarchar", "nchar", "xml", "sysname". + :paramtype column_type: str or ~azure.mgmt.synapse.models.ColumnDataType + """ super(SqlPoolColumn, self).__init__(**kwargs) self.column_type = column_type self.is_computed = None @@ -9036,6 +10907,8 @@ def __init__( self, **kwargs ): + """ + """ super(SqlPoolColumnListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -9058,20 +10931,20 @@ class SqlPoolConnectionPolicy(ProxyResource): :vartype kind: str :ivar location: Resource location. :vartype location: str - :param security_enabled_access: The state of security access. - :type security_enabled_access: str - :param proxy_dns_name: The fully qualified host name of the auditing proxy. - :type proxy_dns_name: str - :param proxy_port: The port number of the auditing proxy. - :type proxy_port: str - :param visibility: The visibility of the auditing proxy. - :type visibility: str - :param use_server_default: Whether server default is enabled or disabled. - :type use_server_default: str - :param redirection_state: The state of proxy redirection. - :type redirection_state: str - :param state: The connection policy state. - :type state: str + :ivar security_enabled_access: The state of security access. + :vartype security_enabled_access: str + :ivar proxy_dns_name: The fully qualified host name of the auditing proxy. + :vartype proxy_dns_name: str + :ivar proxy_port: The port number of the auditing proxy. + :vartype proxy_port: str + :ivar visibility: The visibility of the auditing proxy. + :vartype visibility: str + :ivar use_server_default: Whether server default is enabled or disabled. + :vartype use_server_default: str + :ivar redirection_state: The state of proxy redirection. + :vartype redirection_state: str + :ivar state: The connection policy state. + :vartype state: str """ _validation = { @@ -9109,6 +10982,22 @@ def __init__( state: Optional[str] = None, **kwargs ): + """ + :keyword security_enabled_access: The state of security access. + :paramtype security_enabled_access: str + :keyword proxy_dns_name: The fully qualified host name of the auditing proxy. + :paramtype proxy_dns_name: str + :keyword proxy_port: The port number of the auditing proxy. + :paramtype proxy_port: str + :keyword visibility: The visibility of the auditing proxy. + :paramtype visibility: str + :keyword use_server_default: Whether server default is enabled or disabled. + :paramtype use_server_default: str + :keyword redirection_state: The state of proxy redirection. + :paramtype redirection_state: str + :keyword state: The connection policy state. + :paramtype state: str + """ super(SqlPoolConnectionPolicy, self).__init__(**kwargs) self.kind = None self.location = None @@ -9124,10 +11013,10 @@ def __init__( class SqlPoolInfoListResult(msrest.serialization.Model): """List of SQL pools. - :param next_link: Link to the next page of results. - :type next_link: str - :param value: List of SQL pools. - :type value: list[~azure.mgmt.synapse.models.SqlPool] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + :ivar value: List of SQL pools. + :vartype value: list[~azure.mgmt.synapse.models.SqlPool] """ _attribute_map = { @@ -9142,6 +11031,12 @@ def __init__( value: Optional[List["SqlPool"]] = None, **kwargs ): + """ + :keyword next_link: Link to the next page of results. + :paramtype next_link: str + :keyword value: List of SQL pools. + :paramtype value: list[~azure.mgmt.synapse.models.SqlPool] + """ super(SqlPoolInfoListResult, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -9235,6 +11130,8 @@ def __init__( self, **kwargs ): + """ + """ super(SqlPoolOperation, self).__init__(**kwargs) self.database_name = None self.operation = None @@ -9255,27 +11152,27 @@ def __init__( class SqlPoolPatchInfo(msrest.serialization.Model): """A SQL Analytics pool patch info. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: The geo-location where the resource lives. - :type location: str - :param sku: SQL pool SKU. - :type sku: ~azure.mgmt.synapse.models.Sku - :param max_size_bytes: Maximum size in bytes. - :type max_size_bytes: long - :param collation: Collation mode. - :type collation: str - :param source_database_id: Source database to create from. - :type source_database_id: str - :param recoverable_database_id: Backup database to restore from. - :type recoverable_database_id: str - :param provisioning_state: Resource state. - :type provisioning_state: str - :param status: Resource status. - :type status: str - :param restore_point_in_time: Snapshot time to restore. - :type restore_point_in_time: ~datetime.datetime - :param create_mode: Specifies the mode of sql pool creation. + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar sku: SQL pool SKU. + :vartype sku: ~azure.mgmt.synapse.models.Sku + :ivar max_size_bytes: Maximum size in bytes. + :vartype max_size_bytes: long + :ivar collation: Collation mode. + :vartype collation: str + :ivar source_database_id: Source database to create from. + :vartype source_database_id: str + :ivar recoverable_database_id: Backup database to restore from. + :vartype recoverable_database_id: str + :ivar provisioning_state: Resource state. + :vartype provisioning_state: str + :ivar status: Resource status. + :vartype status: str + :ivar restore_point_in_time: Snapshot time to restore. + :vartype restore_point_in_time: ~datetime.datetime + :ivar create_mode: Specifies the mode of sql pool creation. Default: regular sql pool creation. @@ -9290,14 +11187,14 @@ class SqlPoolPatchInfo(msrest.serialization.Model): should be the sql pool's original resource ID. SourceDatabaseId and sourceDatabaseDeletionDate must be specified. Possible values include: "Default", "PointInTimeRestore", "Recovery", "Restore". - :type create_mode: str or ~azure.mgmt.synapse.models.CreateMode - :param creation_date: Date the SQL pool was created. - :type creation_date: ~datetime.datetime - :param storage_account_type: The storage account type used to store backups for this sql pool. + :vartype create_mode: str or ~azure.mgmt.synapse.models.CreateMode + :ivar creation_date: Date the SQL pool was created. + :vartype creation_date: ~datetime.datetime + :ivar storage_account_type: The storage account type used to store backups for this sql pool. Possible values include: "GRS", "LRS", "ZRS". - :type storage_account_type: str or ~azure.mgmt.synapse.models.StorageAccountType - :param source_database_deletion_date: Specifies the time that the sql pool was deleted. - :type source_database_deletion_date: ~datetime.datetime + :vartype storage_account_type: str or ~azure.mgmt.synapse.models.StorageAccountType + :ivar source_database_deletion_date: Specifies the time that the sql pool was deleted. + :vartype source_database_deletion_date: ~datetime.datetime """ _attribute_map = { @@ -9336,6 +11233,51 @@ def __init__( source_database_deletion_date: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. + :paramtype location: str + :keyword sku: SQL pool SKU. + :paramtype sku: ~azure.mgmt.synapse.models.Sku + :keyword max_size_bytes: Maximum size in bytes. + :paramtype max_size_bytes: long + :keyword collation: Collation mode. + :paramtype collation: str + :keyword source_database_id: Source database to create from. + :paramtype source_database_id: str + :keyword recoverable_database_id: Backup database to restore from. + :paramtype recoverable_database_id: str + :keyword provisioning_state: Resource state. + :paramtype provisioning_state: str + :keyword status: Resource status. + :paramtype status: str + :keyword restore_point_in_time: Snapshot time to restore. + :paramtype restore_point_in_time: ~datetime.datetime + :keyword create_mode: Specifies the mode of sql pool creation. + + Default: regular sql pool creation. + + PointInTimeRestore: Creates a sql pool by restoring a point in time backup of an existing sql + pool. sourceDatabaseId must be specified as the resource ID of the existing sql pool, and + restorePointInTime must be specified. + + Recovery: Creates a sql pool by a geo-replicated backup. sourceDatabaseId must be specified + as the recoverableDatabaseId to restore. + + Restore: Creates a sql pool by restoring a backup of a deleted sql pool. SourceDatabaseId + should be the sql pool's original resource ID. SourceDatabaseId and sourceDatabaseDeletionDate + must be specified. Possible values include: "Default", "PointInTimeRestore", "Recovery", + "Restore". + :paramtype create_mode: str or ~azure.mgmt.synapse.models.CreateMode + :keyword creation_date: Date the SQL pool was created. + :paramtype creation_date: ~datetime.datetime + :keyword storage_account_type: The storage account type used to store backups for this sql + pool. Possible values include: "GRS", "LRS", "ZRS". + :paramtype storage_account_type: str or ~azure.mgmt.synapse.models.StorageAccountType + :keyword source_database_deletion_date: Specifies the time that the sql pool was deleted. + :paramtype source_database_deletion_date: ~datetime.datetime + """ super(SqlPoolPatchInfo, self).__init__(**kwargs) self.tags = tags self.location = location @@ -9384,6 +11326,8 @@ def __init__( self, **kwargs ): + """ + """ super(SqlPoolSchema, self).__init__(**kwargs) @@ -9412,6 +11356,8 @@ def __init__( self, **kwargs ): + """ + """ super(SqlPoolSchemaListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -9430,26 +11376,26 @@ class SqlPoolSecurityAlertPolicy(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param state: Specifies the state of the policy, whether it is enabled or disabled or a policy + :ivar state: Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific Sql pool. Possible values include: "New", "Enabled", "Disabled". - :type state: str or ~azure.mgmt.synapse.models.SecurityAlertPolicyState - :param disabled_alerts: Specifies an array of alerts that are disabled. Allowed values are: + :vartype state: str or ~azure.mgmt.synapse.models.SecurityAlertPolicyState + :ivar disabled_alerts: Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. - :type disabled_alerts: list[str] - :param email_addresses: Specifies an array of e-mail addresses to which the alert is sent. - :type email_addresses: list[str] - :param email_account_admins: Specifies that the alert is sent to the account administrators. - :type email_account_admins: bool - :param storage_endpoint: Specifies the blob storage endpoint (e.g. + :vartype disabled_alerts: list[str] + :ivar email_addresses: Specifies an array of e-mail addresses to which the alert is sent. + :vartype email_addresses: list[str] + :ivar email_account_admins: Specifies that the alert is sent to the account administrators. + :vartype email_account_admins: bool + :ivar storage_endpoint: Specifies the blob storage endpoint (e.g. https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. - :type storage_endpoint: str - :param storage_account_access_key: Specifies the identifier key of the Threat Detection audit + :vartype storage_endpoint: str + :ivar storage_account_access_key: Specifies the identifier key of the Threat Detection audit storage account. - :type storage_account_access_key: str - :param retention_days: Specifies the number of days to keep in the Threat Detection audit logs. - :type retention_days: int + :vartype storage_account_access_key: str + :ivar retention_days: Specifies the number of days to keep in the Threat Detection audit logs. + :vartype retention_days: int :ivar creation_time: Specifies the UTC creation time of the policy. :vartype creation_time: ~datetime.datetime """ @@ -9487,6 +11433,29 @@ def __init__( retention_days: Optional[int] = None, **kwargs ): + """ + :keyword state: Specifies the state of the policy, whether it is enabled or disabled or a + policy has not been applied yet on the specific Sql pool. Possible values include: "New", + "Enabled", "Disabled". + :paramtype state: str or ~azure.mgmt.synapse.models.SecurityAlertPolicyState + :keyword disabled_alerts: Specifies an array of alerts that are disabled. Allowed values are: + Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly, Data_Exfiltration, Unsafe_Action. + :paramtype disabled_alerts: list[str] + :keyword email_addresses: Specifies an array of e-mail addresses to which the alert is sent. + :paramtype email_addresses: list[str] + :keyword email_account_admins: Specifies that the alert is sent to the account administrators. + :paramtype email_account_admins: bool + :keyword storage_endpoint: Specifies the blob storage endpoint (e.g. + https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection + audit logs. + :paramtype storage_endpoint: str + :keyword storage_account_access_key: Specifies the identifier key of the Threat Detection audit + storage account. + :paramtype storage_account_access_key: str + :keyword retention_days: Specifies the number of days to keep in the Threat Detection audit + logs. + :paramtype retention_days: int + """ super(SqlPoolSecurityAlertPolicy, self).__init__(**kwargs) self.state = state self.disabled_alerts = disabled_alerts @@ -9529,6 +11498,8 @@ def __init__( self, **kwargs ): + """ + """ super(SqlPoolTable, self).__init__(**kwargs) @@ -9557,6 +11528,8 @@ def __init__( self, **kwargs ): + """ + """ super(SqlPoolTableListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -9607,6 +11580,8 @@ def __init__( self, **kwargs ): + """ + """ super(SqlPoolUsage, self).__init__(**kwargs) self.name = None self.resource_name = None @@ -9624,8 +11599,8 @@ class SqlPoolUsageListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of usages for the Sql pool. - :type value: list[~azure.mgmt.synapse.models.SqlPoolUsage] + :ivar value: Required. The list of usages for the Sql pool. + :vartype value: list[~azure.mgmt.synapse.models.SqlPoolUsage] :ivar next_link: Link to retrieve next page of results. :vartype next_link: str """ @@ -9646,6 +11621,10 @@ def __init__( value: List["SqlPoolUsage"], **kwargs ): + """ + :keyword value: Required. The list of usages for the Sql pool. + :paramtype value: list[~azure.mgmt.synapse.models.SqlPoolUsage] + """ super(SqlPoolUsageListResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -9664,20 +11643,20 @@ class SqlPoolVulnerabilityAssessment(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param storage_container_path: A blob storage container path to hold the scan results (e.g. + :ivar storage_container_path: A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/). It is required if server level vulnerability assessment policy doesn't set. - :type storage_container_path: str - :param storage_container_sas_key: A shared access signature (SAS Key) that has write access to + :vartype storage_container_path: str + :ivar storage_container_sas_key: A shared access signature (SAS Key) that has write access to the blob container specified in 'storageContainerPath' parameter. If 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. - :type storage_container_sas_key: str - :param storage_account_access_key: Specifies the identifier key of the storage account for + :vartype storage_container_sas_key: str + :ivar storage_account_access_key: Specifies the identifier key of the storage account for vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, storageAccountAccessKey is required. - :type storage_account_access_key: str - :param recurring_scans: The recurring scans settings. - :type recurring_scans: + :vartype storage_account_access_key: str + :ivar recurring_scans: The recurring scans settings. + :vartype recurring_scans: ~azure.mgmt.synapse.models.VulnerabilityAssessmentRecurringScansProperties """ @@ -9706,6 +11685,23 @@ def __init__( recurring_scans: Optional["VulnerabilityAssessmentRecurringScansProperties"] = None, **kwargs ): + """ + :keyword storage_container_path: A blob storage container path to hold the scan results (e.g. + https://myStorage.blob.core.windows.net/VaScans/). It is required if server level + vulnerability assessment policy doesn't set. + :paramtype storage_container_path: str + :keyword storage_container_sas_key: A shared access signature (SAS Key) that has write access + to the blob container specified in 'storageContainerPath' parameter. If + 'storageAccountAccessKey' isn't specified, StorageContainerSasKey is required. + :paramtype storage_container_sas_key: str + :keyword storage_account_access_key: Specifies the identifier key of the storage account for + vulnerability assessment scan results. If 'StorageContainerSasKey' isn't specified, + storageAccountAccessKey is required. + :paramtype storage_account_access_key: str + :keyword recurring_scans: The recurring scans settings. + :paramtype recurring_scans: + ~azure.mgmt.synapse.models.VulnerabilityAssessmentRecurringScansProperties + """ super(SqlPoolVulnerabilityAssessment, self).__init__(**kwargs) self.storage_container_path = storage_container_path self.storage_container_sas_key = storage_container_sas_key @@ -9738,6 +11734,8 @@ def __init__( self, **kwargs ): + """ + """ super(SqlPoolVulnerabilityAssessmentListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -9756,8 +11754,8 @@ class SqlPoolVulnerabilityAssessmentRuleBaseline(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param baseline_results: The rule baseline result. - :type baseline_results: + :ivar baseline_results: The rule baseline result. + :vartype baseline_results: list[~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessmentRuleBaselineItem] """ @@ -9780,6 +11778,11 @@ def __init__( baseline_results: Optional[List["SqlPoolVulnerabilityAssessmentRuleBaselineItem"]] = None, **kwargs ): + """ + :keyword baseline_results: The rule baseline result. + :paramtype baseline_results: + list[~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessmentRuleBaselineItem] + """ super(SqlPoolVulnerabilityAssessmentRuleBaseline, self).__init__(**kwargs) self.baseline_results = baseline_results @@ -9789,8 +11792,8 @@ class SqlPoolVulnerabilityAssessmentRuleBaselineItem(msrest.serialization.Model) All required parameters must be populated in order to send to Azure. - :param result: Required. The rule baseline result. - :type result: list[str] + :ivar result: Required. The rule baseline result. + :vartype result: list[str] """ _validation = { @@ -9807,6 +11810,10 @@ def __init__( result: List[str], **kwargs ): + """ + :keyword result: Required. The rule baseline result. + :paramtype result: list[str] + """ super(SqlPoolVulnerabilityAssessmentRuleBaselineItem, self).__init__(**kwargs) self.result = result @@ -9847,6 +11854,8 @@ def __init__( self, **kwargs ): + """ + """ super(SqlPoolVulnerabilityAssessmentScansExport, self).__init__(**kwargs) self.exported_report_location = None @@ -9859,15 +11868,15 @@ class SsisObjectMetadata(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of metadata.Constant filled by server. Possible values include: + :ivar type: Required. Type of metadata.Constant filled by server. Possible values include: "Folder", "Project", "Package", "Environment". - :type type: str or ~azure.mgmt.synapse.models.SsisObjectMetadataType - :param id: Metadata id. - :type id: long - :param name: Metadata name. - :type name: str - :param description: Metadata description. - :type description: str + :vartype type: str or ~azure.mgmt.synapse.models.SsisObjectMetadataType + :ivar id: Metadata id. + :vartype id: long + :ivar name: Metadata name. + :vartype name: str + :ivar description: Metadata description. + :vartype description: str """ _validation = { @@ -9893,6 +11902,14 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword id: Metadata id. + :paramtype id: long + :keyword name: Metadata name. + :paramtype name: str + :keyword description: Metadata description. + :paramtype description: str + """ super(SsisObjectMetadata, self).__init__(**kwargs) self.type = None # type: Optional[str] self.id = id @@ -9905,19 +11922,19 @@ class SsisEnvironment(SsisObjectMetadata): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of metadata.Constant filled by server. Possible values include: + :ivar type: Required. Type of metadata.Constant filled by server. Possible values include: "Folder", "Project", "Package", "Environment". - :type type: str or ~azure.mgmt.synapse.models.SsisObjectMetadataType - :param id: Metadata id. - :type id: long - :param name: Metadata name. - :type name: str - :param description: Metadata description. - :type description: str - :param folder_id: Folder id which contains environment. - :type folder_id: long - :param variables: Variable in environment. - :type variables: list[~azure.mgmt.synapse.models.SsisVariable] + :vartype type: str or ~azure.mgmt.synapse.models.SsisObjectMetadataType + :ivar id: Metadata id. + :vartype id: long + :ivar name: Metadata name. + :vartype name: str + :ivar description: Metadata description. + :vartype description: str + :ivar folder_id: Folder id which contains environment. + :vartype folder_id: long + :ivar variables: Variable in environment. + :vartype variables: list[~azure.mgmt.synapse.models.SsisVariable] """ _validation = { @@ -9943,6 +11960,18 @@ def __init__( variables: Optional[List["SsisVariable"]] = None, **kwargs ): + """ + :keyword id: Metadata id. + :paramtype id: long + :keyword name: Metadata name. + :paramtype name: str + :keyword description: Metadata description. + :paramtype description: str + :keyword folder_id: Folder id which contains environment. + :paramtype folder_id: long + :keyword variables: Variable in environment. + :paramtype variables: list[~azure.mgmt.synapse.models.SsisVariable] + """ super(SsisEnvironment, self).__init__(id=id, name=name, description=description, **kwargs) self.type = 'Environment' # type: str self.folder_id = folder_id @@ -9952,14 +11981,14 @@ def __init__( class SsisEnvironmentReference(msrest.serialization.Model): """Ssis environment reference. - :param id: Environment reference id. - :type id: long - :param environment_folder_name: Environment folder name. - :type environment_folder_name: str - :param environment_name: Environment name. - :type environment_name: str - :param reference_type: Reference type. - :type reference_type: str + :ivar id: Environment reference id. + :vartype id: long + :ivar environment_folder_name: Environment folder name. + :vartype environment_folder_name: str + :ivar environment_name: Environment name. + :vartype environment_name: str + :ivar reference_type: Reference type. + :vartype reference_type: str """ _attribute_map = { @@ -9978,6 +12007,16 @@ def __init__( reference_type: Optional[str] = None, **kwargs ): + """ + :keyword id: Environment reference id. + :paramtype id: long + :keyword environment_folder_name: Environment folder name. + :paramtype environment_folder_name: str + :keyword environment_name: Environment name. + :paramtype environment_name: str + :keyword reference_type: Reference type. + :paramtype reference_type: str + """ super(SsisEnvironmentReference, self).__init__(**kwargs) self.id = id self.environment_folder_name = environment_folder_name @@ -9990,15 +12029,15 @@ class SsisFolder(SsisObjectMetadata): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of metadata.Constant filled by server. Possible values include: + :ivar type: Required. Type of metadata.Constant filled by server. Possible values include: "Folder", "Project", "Package", "Environment". - :type type: str or ~azure.mgmt.synapse.models.SsisObjectMetadataType - :param id: Metadata id. - :type id: long - :param name: Metadata name. - :type name: str - :param description: Metadata description. - :type description: str + :vartype type: str or ~azure.mgmt.synapse.models.SsisObjectMetadataType + :ivar id: Metadata id. + :vartype id: long + :ivar name: Metadata name. + :vartype name: str + :ivar description: Metadata description. + :vartype description: str """ _validation = { @@ -10020,6 +12059,14 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword id: Metadata id. + :paramtype id: long + :keyword name: Metadata name. + :paramtype name: str + :keyword description: Metadata description. + :paramtype description: str + """ super(SsisFolder, self).__init__(id=id, name=name, description=description, **kwargs) self.type = 'Folder' # type: str @@ -10027,10 +12074,10 @@ def __init__( class SsisObjectMetadataListResponse(msrest.serialization.Model): """A list of SSIS object metadata. - :param value: List of SSIS object metadata. - :type value: list[~azure.mgmt.synapse.models.SsisObjectMetadata] - :param next_link: The link to the next page of results, if any remaining results exist. - :type next_link: str + :ivar value: List of SSIS object metadata. + :vartype value: list[~azure.mgmt.synapse.models.SsisObjectMetadata] + :ivar next_link: The link to the next page of results, if any remaining results exist. + :vartype next_link: str """ _attribute_map = { @@ -10045,6 +12092,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of SSIS object metadata. + :paramtype value: list[~azure.mgmt.synapse.models.SsisObjectMetadata] + :keyword next_link: The link to the next page of results, if any remaining results exist. + :paramtype next_link: str + """ super(SsisObjectMetadataListResponse, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -10053,14 +12106,14 @@ def __init__( class SsisObjectMetadataStatusResponse(msrest.serialization.Model): """The status of the operation. - :param status: The status of the operation. - :type status: str - :param name: The operation name. - :type name: str - :param properties: The operation properties. - :type properties: str - :param error: The operation error message. - :type error: str + :ivar status: The status of the operation. + :vartype status: str + :ivar name: The operation name. + :vartype name: str + :ivar properties: The operation properties. + :vartype properties: str + :ivar error: The operation error message. + :vartype error: str """ _attribute_map = { @@ -10079,6 +12132,16 @@ def __init__( error: Optional[str] = None, **kwargs ): + """ + :keyword status: The status of the operation. + :paramtype status: str + :keyword name: The operation name. + :paramtype name: str + :keyword properties: The operation properties. + :paramtype properties: str + :keyword error: The operation error message. + :paramtype error: str + """ super(SsisObjectMetadataStatusResponse, self).__init__(**kwargs) self.status = status self.name = name @@ -10091,23 +12154,23 @@ class SsisPackage(SsisObjectMetadata): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of metadata.Constant filled by server. Possible values include: + :ivar type: Required. Type of metadata.Constant filled by server. Possible values include: "Folder", "Project", "Package", "Environment". - :type type: str or ~azure.mgmt.synapse.models.SsisObjectMetadataType - :param id: Metadata id. - :type id: long - :param name: Metadata name. - :type name: str - :param description: Metadata description. - :type description: str - :param folder_id: Folder id which contains package. - :type folder_id: long - :param project_version: Project version which contains package. - :type project_version: long - :param project_id: Project id which contains package. - :type project_id: long - :param parameters: Parameters in package. - :type parameters: list[~azure.mgmt.synapse.models.SsisParameter] + :vartype type: str or ~azure.mgmt.synapse.models.SsisObjectMetadataType + :ivar id: Metadata id. + :vartype id: long + :ivar name: Metadata name. + :vartype name: str + :ivar description: Metadata description. + :vartype description: str + :ivar folder_id: Folder id which contains package. + :vartype folder_id: long + :ivar project_version: Project version which contains package. + :vartype project_version: long + :ivar project_id: Project id which contains package. + :vartype project_id: long + :ivar parameters: Parameters in package. + :vartype parameters: list[~azure.mgmt.synapse.models.SsisParameter] """ _validation = { @@ -10137,6 +12200,22 @@ def __init__( parameters: Optional[List["SsisParameter"]] = None, **kwargs ): + """ + :keyword id: Metadata id. + :paramtype id: long + :keyword name: Metadata name. + :paramtype name: str + :keyword description: Metadata description. + :paramtype description: str + :keyword folder_id: Folder id which contains package. + :paramtype folder_id: long + :keyword project_version: Project version which contains package. + :paramtype project_version: long + :keyword project_id: Project id which contains package. + :paramtype project_id: long + :keyword parameters: Parameters in package. + :paramtype parameters: list[~azure.mgmt.synapse.models.SsisParameter] + """ super(SsisPackage, self).__init__(id=id, name=name, description=description, **kwargs) self.type = 'Package' # type: str self.folder_id = folder_id @@ -10148,30 +12227,30 @@ def __init__( class SsisParameter(msrest.serialization.Model): """Ssis parameter. - :param id: Parameter id. - :type id: long - :param name: Parameter name. - :type name: str - :param description: Parameter description. - :type description: str - :param data_type: Parameter type. - :type data_type: str - :param required: Whether parameter is required. - :type required: bool - :param sensitive: Whether parameter is sensitive. - :type sensitive: bool - :param design_default_value: Design default value of parameter. - :type design_default_value: str - :param default_value: Default value of parameter. - :type default_value: str - :param sensitive_default_value: Default sensitive value of parameter. - :type sensitive_default_value: str - :param value_type: Parameter value type. - :type value_type: str - :param value_set: Parameter value set. - :type value_set: bool - :param variable: Parameter reference variable. - :type variable: str + :ivar id: Parameter id. + :vartype id: long + :ivar name: Parameter name. + :vartype name: str + :ivar description: Parameter description. + :vartype description: str + :ivar data_type: Parameter type. + :vartype data_type: str + :ivar required: Whether parameter is required. + :vartype required: bool + :ivar sensitive: Whether parameter is sensitive. + :vartype sensitive: bool + :ivar design_default_value: Design default value of parameter. + :vartype design_default_value: str + :ivar default_value: Default value of parameter. + :vartype default_value: str + :ivar sensitive_default_value: Default sensitive value of parameter. + :vartype sensitive_default_value: str + :ivar value_type: Parameter value type. + :vartype value_type: str + :ivar value_set: Parameter value set. + :vartype value_set: bool + :ivar variable: Parameter reference variable. + :vartype variable: str """ _attribute_map = { @@ -10206,6 +12285,32 @@ def __init__( variable: Optional[str] = None, **kwargs ): + """ + :keyword id: Parameter id. + :paramtype id: long + :keyword name: Parameter name. + :paramtype name: str + :keyword description: Parameter description. + :paramtype description: str + :keyword data_type: Parameter type. + :paramtype data_type: str + :keyword required: Whether parameter is required. + :paramtype required: bool + :keyword sensitive: Whether parameter is sensitive. + :paramtype sensitive: bool + :keyword design_default_value: Design default value of parameter. + :paramtype design_default_value: str + :keyword default_value: Default value of parameter. + :paramtype default_value: str + :keyword sensitive_default_value: Default sensitive value of parameter. + :paramtype sensitive_default_value: str + :keyword value_type: Parameter value type. + :paramtype value_type: str + :keyword value_set: Parameter value set. + :paramtype value_set: bool + :keyword variable: Parameter reference variable. + :paramtype variable: str + """ super(SsisParameter, self).__init__(**kwargs) self.id = id self.name = name @@ -10226,23 +12331,23 @@ class SsisProject(SsisObjectMetadata): All required parameters must be populated in order to send to Azure. - :param type: Required. Type of metadata.Constant filled by server. Possible values include: + :ivar type: Required. Type of metadata.Constant filled by server. Possible values include: "Folder", "Project", "Package", "Environment". - :type type: str or ~azure.mgmt.synapse.models.SsisObjectMetadataType - :param id: Metadata id. - :type id: long - :param name: Metadata name. - :type name: str - :param description: Metadata description. - :type description: str - :param folder_id: Folder id which contains project. - :type folder_id: long - :param version: Project version. - :type version: long - :param environment_refs: Environment reference in project. - :type environment_refs: list[~azure.mgmt.synapse.models.SsisEnvironmentReference] - :param parameters: Parameters in project. - :type parameters: list[~azure.mgmt.synapse.models.SsisParameter] + :vartype type: str or ~azure.mgmt.synapse.models.SsisObjectMetadataType + :ivar id: Metadata id. + :vartype id: long + :ivar name: Metadata name. + :vartype name: str + :ivar description: Metadata description. + :vartype description: str + :ivar folder_id: Folder id which contains project. + :vartype folder_id: long + :ivar version: Project version. + :vartype version: long + :ivar environment_refs: Environment reference in project. + :vartype environment_refs: list[~azure.mgmt.synapse.models.SsisEnvironmentReference] + :ivar parameters: Parameters in project. + :vartype parameters: list[~azure.mgmt.synapse.models.SsisParameter] """ _validation = { @@ -10272,6 +12377,22 @@ def __init__( parameters: Optional[List["SsisParameter"]] = None, **kwargs ): + """ + :keyword id: Metadata id. + :paramtype id: long + :keyword name: Metadata name. + :paramtype name: str + :keyword description: Metadata description. + :paramtype description: str + :keyword folder_id: Folder id which contains project. + :paramtype folder_id: long + :keyword version: Project version. + :paramtype version: long + :keyword environment_refs: Environment reference in project. + :paramtype environment_refs: list[~azure.mgmt.synapse.models.SsisEnvironmentReference] + :keyword parameters: Parameters in project. + :paramtype parameters: list[~azure.mgmt.synapse.models.SsisParameter] + """ super(SsisProject, self).__init__(id=id, name=name, description=description, **kwargs) self.type = 'Project' # type: str self.folder_id = folder_id @@ -10283,20 +12404,20 @@ def __init__( class SsisVariable(msrest.serialization.Model): """Ssis variable. - :param id: Variable id. - :type id: long - :param name: Variable name. - :type name: str - :param description: Variable description. - :type description: str - :param data_type: Variable type. - :type data_type: str - :param sensitive: Whether variable is sensitive. - :type sensitive: bool - :param value: Variable value. - :type value: str - :param sensitive_value: Variable sensitive value. - :type sensitive_value: str + :ivar id: Variable id. + :vartype id: long + :ivar name: Variable name. + :vartype name: str + :ivar description: Variable description. + :vartype description: str + :ivar data_type: Variable type. + :vartype data_type: str + :ivar sensitive: Whether variable is sensitive. + :vartype sensitive: bool + :ivar value: Variable value. + :vartype value: str + :ivar sensitive_value: Variable sensitive value. + :vartype sensitive_value: str """ _attribute_map = { @@ -10321,6 +12442,22 @@ def __init__( sensitive_value: Optional[str] = None, **kwargs ): + """ + :keyword id: Variable id. + :paramtype id: long + :keyword name: Variable name. + :paramtype name: str + :keyword description: Variable description. + :paramtype description: str + :keyword data_type: Variable type. + :paramtype data_type: str + :keyword sensitive: Whether variable is sensitive. + :paramtype sensitive: bool + :keyword value: Variable value. + :paramtype value: str + :keyword sensitive_value: Variable sensitive value. + :paramtype sensitive_value: str + """ super(SsisVariable, self).__init__(**kwargs) self.id = id self.name = name @@ -10334,20 +12471,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.synapse.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.synapse.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.synapse.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure.mgmt.synapse.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -10370,6 +12507,22 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.synapse.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.synapse.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -10382,20 +12535,20 @@ def __init__( class TableLevelSharingProperties(msrest.serialization.Model): """Tables that will be included and excluded in the follower database. - :param tables_to_include: List of tables to include in the follower database. - :type tables_to_include: list[str] - :param tables_to_exclude: List of tables to exclude from the follower database. - :type tables_to_exclude: list[str] - :param external_tables_to_include: List of external tables to include in the follower database. - :type external_tables_to_include: list[str] - :param external_tables_to_exclude: List of external tables exclude from the follower database. - :type external_tables_to_exclude: list[str] - :param materialized_views_to_include: List of materialized views to include in the follower + :ivar tables_to_include: List of tables to include in the follower database. + :vartype tables_to_include: list[str] + :ivar tables_to_exclude: List of tables to exclude from the follower database. + :vartype tables_to_exclude: list[str] + :ivar external_tables_to_include: List of external tables to include in the follower database. + :vartype external_tables_to_include: list[str] + :ivar external_tables_to_exclude: List of external tables exclude from the follower database. + :vartype external_tables_to_exclude: list[str] + :ivar materialized_views_to_include: List of materialized views to include in the follower database. - :type materialized_views_to_include: list[str] - :param materialized_views_to_exclude: List of materialized views exclude from the follower + :vartype materialized_views_to_include: list[str] + :ivar materialized_views_to_exclude: List of materialized views exclude from the follower database. - :type materialized_views_to_exclude: list[str] + :vartype materialized_views_to_exclude: list[str] """ _attribute_map = { @@ -10418,6 +12571,24 @@ def __init__( materialized_views_to_exclude: Optional[List[str]] = None, **kwargs ): + """ + :keyword tables_to_include: List of tables to include in the follower database. + :paramtype tables_to_include: list[str] + :keyword tables_to_exclude: List of tables to exclude from the follower database. + :paramtype tables_to_exclude: list[str] + :keyword external_tables_to_include: List of external tables to include in the follower + database. + :paramtype external_tables_to_include: list[str] + :keyword external_tables_to_exclude: List of external tables exclude from the follower + database. + :paramtype external_tables_to_exclude: list[str] + :keyword materialized_views_to_include: List of materialized views to include in the follower + database. + :paramtype materialized_views_to_include: list[str] + :keyword materialized_views_to_exclude: List of materialized views exclude from the follower + database. + :paramtype materialized_views_to_exclude: list[str] + """ super(TableLevelSharingProperties, self).__init__(**kwargs) self.tables_to_include = tables_to_include self.tables_to_exclude = tables_to_exclude @@ -10479,6 +12650,8 @@ def __init__( self, **kwargs ): + """ + """ super(TopQueries, self).__init__(**kwargs) self.aggregation_function = None self.execution_type = None @@ -10495,8 +12668,8 @@ class TopQueriesListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. The list of top queries. - :type value: list[~azure.mgmt.synapse.models.TopQueries] + :ivar value: Required. The list of top queries. + :vartype value: list[~azure.mgmt.synapse.models.TopQueries] """ _validation = { @@ -10513,6 +12686,10 @@ def __init__( value: List["TopQueries"], **kwargs ): + """ + :keyword value: Required. The list of top queries. + :paramtype value: list[~azure.mgmt.synapse.models.TopQueries] + """ super(TopQueriesListResult, self).__init__(**kwargs) self.value = value @@ -10532,9 +12709,9 @@ class TransparentDataEncryption(ProxyResource): :vartype type: str :ivar location: Resource location. :vartype location: str - :param status: The status of the database transparent data encryption. Possible values include: + :ivar status: The status of the database transparent data encryption. Possible values include: "Enabled", "Disabled". - :type status: str or ~azure.mgmt.synapse.models.TransparentDataEncryptionStatus + :vartype status: str or ~azure.mgmt.synapse.models.TransparentDataEncryptionStatus """ _validation = { @@ -10558,6 +12735,11 @@ def __init__( status: Optional[Union[str, "TransparentDataEncryptionStatus"]] = None, **kwargs ): + """ + :keyword status: The status of the database transparent data encryption. Possible values + include: "Enabled", "Disabled". + :paramtype status: str or ~azure.mgmt.synapse.models.TransparentDataEncryptionStatus + """ super(TransparentDataEncryption, self).__init__(**kwargs) self.location = None self.status = status @@ -10588,6 +12770,8 @@ def __init__( self, **kwargs ): + """ + """ super(TransparentDataEncryptionListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -10596,9 +12780,9 @@ def __init__( class UpdateIntegrationRuntimeNodeRequest(msrest.serialization.Model): """Update integration runtime node request. - :param concurrent_jobs_limit: The number of concurrent jobs permitted to run on the integration + :ivar concurrent_jobs_limit: The number of concurrent jobs permitted to run on the integration runtime node. Values between 1 and maxConcurrentJobs(inclusive) are allowed. - :type concurrent_jobs_limit: int + :vartype concurrent_jobs_limit: int """ _validation = { @@ -10615,6 +12799,11 @@ def __init__( concurrent_jobs_limit: Optional[int] = None, **kwargs ): + """ + :keyword concurrent_jobs_limit: The number of concurrent jobs permitted to run on the + integration runtime node. Values between 1 and maxConcurrentJobs(inclusive) are allowed. + :paramtype concurrent_jobs_limit: int + """ super(UpdateIntegrationRuntimeNodeRequest, self).__init__(**kwargs) self.concurrent_jobs_limit = concurrent_jobs_limit @@ -10622,13 +12811,13 @@ def __init__( class UpdateIntegrationRuntimeRequest(msrest.serialization.Model): """Update integration runtime request. - :param auto_update: Enables or disables the auto-update feature of the self-hosted integration + :ivar auto_update: Enables or disables the auto-update feature of the self-hosted integration runtime. See https://go.microsoft.com/fwlink/?linkid=854189. Possible values include: "On", "Off". - :type auto_update: str or ~azure.mgmt.synapse.models.IntegrationRuntimeAutoUpdate - :param update_delay_offset: The time offset (in hours) in the day, e.g., PT03H is 3 hours. The + :vartype auto_update: str or ~azure.mgmt.synapse.models.IntegrationRuntimeAutoUpdate + :ivar update_delay_offset: The time offset (in hours) in the day, e.g., PT03H is 3 hours. The integration runtime auto update will happen on that time. - :type update_delay_offset: str + :vartype update_delay_offset: str """ _attribute_map = { @@ -10643,6 +12832,15 @@ def __init__( update_delay_offset: Optional[str] = None, **kwargs ): + """ + :keyword auto_update: Enables or disables the auto-update feature of the self-hosted + integration runtime. See https://go.microsoft.com/fwlink/?linkid=854189. Possible values + include: "On", "Off". + :paramtype auto_update: str or ~azure.mgmt.synapse.models.IntegrationRuntimeAutoUpdate + :keyword update_delay_offset: The time offset (in hours) in the day, e.g., PT03H is 3 hours. + The integration runtime auto update will happen on that time. + :paramtype update_delay_offset: str + """ super(UpdateIntegrationRuntimeRequest, self).__init__(**kwargs) self.auto_update = auto_update self.update_delay_offset = update_delay_offset @@ -10673,6 +12871,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedManagedIdentity, self).__init__(**kwargs) self.client_id = None self.principal_id = None @@ -10681,8 +12881,8 @@ def __init__( class VirtualNetworkProfile(msrest.serialization.Model): """Virtual Network Profile. - :param compute_subnet_id: Subnet ID used for computes in workspace. - :type compute_subnet_id: str + :ivar compute_subnet_id: Subnet ID used for computes in workspace. + :vartype compute_subnet_id: str """ _attribute_map = { @@ -10695,6 +12895,10 @@ def __init__( compute_subnet_id: Optional[str] = None, **kwargs ): + """ + :keyword compute_subnet_id: Subnet ID used for computes in workspace. + :paramtype compute_subnet_id: str + """ super(VirtualNetworkProfile, self).__init__(**kwargs) self.compute_subnet_id = compute_subnet_id @@ -10702,13 +12906,13 @@ def __init__( class VulnerabilityAssessmentRecurringScansProperties(msrest.serialization.Model): """Properties of a Vulnerability Assessment recurring scans. - :param is_enabled: Recurring scans state. - :type is_enabled: bool - :param email_subscription_admins: Specifies that the schedule scan notification will be is sent + :ivar is_enabled: Recurring scans state. + :vartype is_enabled: bool + :ivar email_subscription_admins: Specifies that the schedule scan notification will be is sent to the subscription administrators. - :type email_subscription_admins: bool - :param emails: Specifies an array of e-mail addresses to which the scan notification is sent. - :type emails: list[str] + :vartype email_subscription_admins: bool + :ivar emails: Specifies an array of e-mail addresses to which the scan notification is sent. + :vartype emails: list[str] """ _attribute_map = { @@ -10725,6 +12929,15 @@ def __init__( emails: Optional[List[str]] = None, **kwargs ): + """ + :keyword is_enabled: Recurring scans state. + :paramtype is_enabled: bool + :keyword email_subscription_admins: Specifies that the schedule scan notification will be is + sent to the subscription administrators. + :paramtype email_subscription_admins: bool + :keyword emails: Specifies an array of e-mail addresses to which the scan notification is sent. + :paramtype emails: list[str] + """ super(VulnerabilityAssessmentRecurringScansProperties, self).__init__(**kwargs) self.is_enabled = is_enabled self.email_subscription_admins = email_subscription_admins @@ -10756,6 +12969,8 @@ def __init__( self, **kwargs ): + """ + """ super(VulnerabilityAssessmentScanError, self).__init__(**kwargs) self.code = None self.message = None @@ -10825,6 +13040,8 @@ def __init__( self, **kwargs ): + """ + """ super(VulnerabilityAssessmentScanRecord, self).__init__(**kwargs) self.scan_id = None self.trigger_type = None @@ -10861,6 +13078,8 @@ def __init__( self, **kwargs ): + """ + """ super(VulnerabilityAssessmentScanRecordListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -10879,18 +13098,18 @@ class WorkloadClassifier(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param member_name: The workload classifier member name. - :type member_name: str - :param label: The workload classifier label. - :type label: str - :param context: The workload classifier context. - :type context: str - :param start_time: The workload classifier start time for classification. - :type start_time: str - :param end_time: The workload classifier end time for classification. - :type end_time: str - :param importance: The workload classifier importance. - :type importance: str + :ivar member_name: The workload classifier member name. + :vartype member_name: str + :ivar label: The workload classifier label. + :vartype label: str + :ivar context: The workload classifier context. + :vartype context: str + :ivar start_time: The workload classifier start time for classification. + :vartype start_time: str + :ivar end_time: The workload classifier end time for classification. + :vartype end_time: str + :ivar importance: The workload classifier importance. + :vartype importance: str """ _validation = { @@ -10922,6 +13141,20 @@ def __init__( importance: Optional[str] = None, **kwargs ): + """ + :keyword member_name: The workload classifier member name. + :paramtype member_name: str + :keyword label: The workload classifier label. + :paramtype label: str + :keyword context: The workload classifier context. + :paramtype context: str + :keyword start_time: The workload classifier start time for classification. + :paramtype start_time: str + :keyword end_time: The workload classifier end time for classification. + :paramtype end_time: str + :keyword importance: The workload classifier importance. + :paramtype importance: str + """ super(WorkloadClassifier, self).__init__(**kwargs) self.member_name = member_name self.label = label @@ -10956,6 +13189,8 @@ def __init__( self, **kwargs ): + """ + """ super(WorkloadClassifierListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -10974,18 +13209,18 @@ class WorkloadGroup(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param min_resource_percent: The workload group minimum percentage resource. - :type min_resource_percent: int - :param max_resource_percent: The workload group cap percentage resource. - :type max_resource_percent: int - :param min_resource_percent_per_request: The workload group request minimum grant percentage. - :type min_resource_percent_per_request: float - :param max_resource_percent_per_request: The workload group request maximum grant percentage. - :type max_resource_percent_per_request: float - :param importance: The workload group importance level. - :type importance: str - :param query_execution_timeout: The workload group query execution timeout. - :type query_execution_timeout: int + :ivar min_resource_percent: The workload group minimum percentage resource. + :vartype min_resource_percent: int + :ivar max_resource_percent: The workload group cap percentage resource. + :vartype max_resource_percent: int + :ivar min_resource_percent_per_request: The workload group request minimum grant percentage. + :vartype min_resource_percent_per_request: float + :ivar max_resource_percent_per_request: The workload group request maximum grant percentage. + :vartype max_resource_percent_per_request: float + :ivar importance: The workload group importance level. + :vartype importance: str + :ivar query_execution_timeout: The workload group query execution timeout. + :vartype query_execution_timeout: int """ _validation = { @@ -11017,6 +13252,20 @@ def __init__( query_execution_timeout: Optional[int] = None, **kwargs ): + """ + :keyword min_resource_percent: The workload group minimum percentage resource. + :paramtype min_resource_percent: int + :keyword max_resource_percent: The workload group cap percentage resource. + :paramtype max_resource_percent: int + :keyword min_resource_percent_per_request: The workload group request minimum grant percentage. + :paramtype min_resource_percent_per_request: float + :keyword max_resource_percent_per_request: The workload group request maximum grant percentage. + :paramtype max_resource_percent_per_request: float + :keyword importance: The workload group importance level. + :paramtype importance: str + :keyword query_execution_timeout: The workload group query execution timeout. + :paramtype query_execution_timeout: int + """ super(WorkloadGroup, self).__init__(**kwargs) self.min_resource_percent = min_resource_percent self.max_resource_percent = max_resource_percent @@ -11051,6 +13300,8 @@ def __init__( self, **kwargs ): + """ + """ super(WorkloadGroupListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -11071,61 +13322,62 @@ class Workspace(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param identity: Identity of the workspace. - :type identity: ~azure.mgmt.synapse.models.ManagedIdentity - :param default_data_lake_storage: Workspace default data lake storage account details. - :type default_data_lake_storage: ~azure.mgmt.synapse.models.DataLakeStorageAccountDetails - :param sql_administrator_login_password: SQL administrator login password. - :type sql_administrator_login_password: str - :param managed_resource_group_name: Workspace managed resource group. The resource group name + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar identity: Identity of the workspace. + :vartype identity: ~azure.mgmt.synapse.models.ManagedIdentity + :ivar default_data_lake_storage: Workspace default data lake storage account details. + :vartype default_data_lake_storage: ~azure.mgmt.synapse.models.DataLakeStorageAccountDetails + :ivar sql_administrator_login_password: SQL administrator login password. + :vartype sql_administrator_login_password: str + :ivar managed_resource_group_name: Workspace managed resource group. The resource group name uniquely identifies the resource group within the user subscriptionId. The resource group name must be no longer than 90 characters long, and must be alphanumeric characters (Char.IsLetterOrDigit()) and '-', '_', '(', ')' and'.'. Note that the name cannot end with '.'. - :type managed_resource_group_name: str + :vartype managed_resource_group_name: str :ivar provisioning_state: Resource provisioning state. :vartype provisioning_state: str - :param sql_administrator_login: Login for workspace SQL active directory administrator. - :type sql_administrator_login: str - :param virtual_network_profile: Virtual Network profile. - :type virtual_network_profile: ~azure.mgmt.synapse.models.VirtualNetworkProfile - :param connectivity_endpoints: Connectivity endpoints. - :type connectivity_endpoints: dict[str, str] - :param managed_virtual_network: Setting this to 'default' will ensure that all compute for this + :ivar sql_administrator_login: Login for workspace SQL active directory administrator. + :vartype sql_administrator_login: str + :ivar virtual_network_profile: Virtual Network profile. + :vartype virtual_network_profile: ~azure.mgmt.synapse.models.VirtualNetworkProfile + :ivar connectivity_endpoints: Connectivity endpoints. + :vartype connectivity_endpoints: dict[str, str] + :ivar managed_virtual_network: Setting this to 'default' will ensure that all compute for this workspace is in a virtual network managed on behalf of the user. - :type managed_virtual_network: str - :param private_endpoint_connections: Private endpoint connections to the workspace. - :type private_endpoint_connections: list[~azure.mgmt.synapse.models.PrivateEndpointConnection] - :param encryption: The encryption details of the workspace. - :type encryption: ~azure.mgmt.synapse.models.EncryptionDetails + :vartype managed_virtual_network: str + :ivar private_endpoint_connections: Private endpoint connections to the workspace. + :vartype private_endpoint_connections: + list[~azure.mgmt.synapse.models.PrivateEndpointConnection] + :ivar encryption: The encryption details of the workspace. + :vartype encryption: ~azure.mgmt.synapse.models.EncryptionDetails :ivar workspace_uid: The workspace unique identifier. :vartype workspace_uid: str :ivar extra_properties: Workspace level configs and feature flags. :vartype extra_properties: dict[str, any] - :param managed_virtual_network_settings: Managed Virtual Network Settings. - :type managed_virtual_network_settings: + :ivar managed_virtual_network_settings: Managed Virtual Network Settings. + :vartype managed_virtual_network_settings: ~azure.mgmt.synapse.models.ManagedVirtualNetworkSettings - :param workspace_repository_configuration: Git integration settings. - :type workspace_repository_configuration: + :ivar workspace_repository_configuration: Git integration settings. + :vartype workspace_repository_configuration: ~azure.mgmt.synapse.models.WorkspaceRepositoryConfiguration - :param purview_configuration: Purview Configuration. - :type purview_configuration: ~azure.mgmt.synapse.models.PurviewConfiguration + :ivar purview_configuration: Purview Configuration. + :vartype purview_configuration: ~azure.mgmt.synapse.models.PurviewConfiguration :ivar adla_resource_id: The ADLA resource ID. :vartype adla_resource_id: str - :param public_network_access: Enable or Disable public network access to workspace. Possible + :ivar public_network_access: Enable or Disable public network access to workspace. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.synapse.models.WorkspacePublicNetworkAccess - :param csp_workspace_admin_properties: Initial workspace AAD admin properties for a CSP + :vartype public_network_access: str or ~azure.mgmt.synapse.models.WorkspacePublicNetworkAccess + :ivar csp_workspace_admin_properties: Initial workspace AAD admin properties for a CSP subscription. - :type csp_workspace_admin_properties: ~azure.mgmt.synapse.models.CspWorkspaceAdminProperties + :vartype csp_workspace_admin_properties: ~azure.mgmt.synapse.models.CspWorkspaceAdminProperties :ivar settings: Workspace settings. :vartype settings: dict[str, any] - :param azure_ad_only_authentication: Enable or Disable AzureADOnlyAuthentication on All + :ivar azure_ad_only_authentication: Enable or Disable AzureADOnlyAuthentication on All Workspace subresource. - :type azure_ad_only_authentication: bool + :vartype azure_ad_only_authentication: bool """ _validation = { @@ -11192,6 +13444,56 @@ def __init__( azure_ad_only_authentication: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: Identity of the workspace. + :paramtype identity: ~azure.mgmt.synapse.models.ManagedIdentity + :keyword default_data_lake_storage: Workspace default data lake storage account details. + :paramtype default_data_lake_storage: ~azure.mgmt.synapse.models.DataLakeStorageAccountDetails + :keyword sql_administrator_login_password: SQL administrator login password. + :paramtype sql_administrator_login_password: str + :keyword managed_resource_group_name: Workspace managed resource group. The resource group name + uniquely identifies the resource group within the user subscriptionId. The resource group name + must be no longer than 90 characters long, and must be alphanumeric characters + (Char.IsLetterOrDigit()) and '-', '_', '(', ')' and'.'. Note that the name cannot end with '.'. + :paramtype managed_resource_group_name: str + :keyword sql_administrator_login: Login for workspace SQL active directory administrator. + :paramtype sql_administrator_login: str + :keyword virtual_network_profile: Virtual Network profile. + :paramtype virtual_network_profile: ~azure.mgmt.synapse.models.VirtualNetworkProfile + :keyword connectivity_endpoints: Connectivity endpoints. + :paramtype connectivity_endpoints: dict[str, str] + :keyword managed_virtual_network: Setting this to 'default' will ensure that all compute for + this workspace is in a virtual network managed on behalf of the user. + :paramtype managed_virtual_network: str + :keyword private_endpoint_connections: Private endpoint connections to the workspace. + :paramtype private_endpoint_connections: + list[~azure.mgmt.synapse.models.PrivateEndpointConnection] + :keyword encryption: The encryption details of the workspace. + :paramtype encryption: ~azure.mgmt.synapse.models.EncryptionDetails + :keyword managed_virtual_network_settings: Managed Virtual Network Settings. + :paramtype managed_virtual_network_settings: + ~azure.mgmt.synapse.models.ManagedVirtualNetworkSettings + :keyword workspace_repository_configuration: Git integration settings. + :paramtype workspace_repository_configuration: + ~azure.mgmt.synapse.models.WorkspaceRepositoryConfiguration + :keyword purview_configuration: Purview Configuration. + :paramtype purview_configuration: ~azure.mgmt.synapse.models.PurviewConfiguration + :keyword public_network_access: Enable or Disable public network access to workspace. Possible + values include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.synapse.models.WorkspacePublicNetworkAccess + :keyword csp_workspace_admin_properties: Initial workspace AAD admin properties for a CSP + subscription. + :paramtype csp_workspace_admin_properties: + ~azure.mgmt.synapse.models.CspWorkspaceAdminProperties + :keyword azure_ad_only_authentication: Enable or Disable AzureADOnlyAuthentication on All + Workspace subresource. + :paramtype azure_ad_only_authentication: bool + """ super(Workspace, self).__init__(tags=tags, location=location, **kwargs) self.identity = identity self.default_data_lake_storage = default_data_lake_storage @@ -11229,14 +13531,14 @@ class WorkspaceAadAdminInfo(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tenant_id: Tenant ID of the workspace active directory administrator. - :type tenant_id: str - :param login: Login of the workspace active directory administrator. - :type login: str - :param administrator_type: Workspace active directory administrator type. - :type administrator_type: str - :param sid: Object ID of the workspace active directory administrator. - :type sid: str + :ivar tenant_id: Tenant ID of the workspace active directory administrator. + :vartype tenant_id: str + :ivar login: Login of the workspace active directory administrator. + :vartype login: str + :ivar administrator_type: Workspace active directory administrator type. + :vartype administrator_type: str + :ivar sid: Object ID of the workspace active directory administrator. + :vartype sid: str """ _validation = { @@ -11264,6 +13566,16 @@ def __init__( sid: Optional[str] = None, **kwargs ): + """ + :keyword tenant_id: Tenant ID of the workspace active directory administrator. + :paramtype tenant_id: str + :keyword login: Login of the workspace active directory administrator. + :paramtype login: str + :keyword administrator_type: Workspace active directory administrator type. + :paramtype administrator_type: str + :keyword sid: Object ID of the workspace active directory administrator. + :paramtype sid: str + """ super(WorkspaceAadAdminInfo, self).__init__(**kwargs) self.tenant_id = tenant_id self.login = login @@ -11274,10 +13586,10 @@ def __init__( class WorkspaceInfoListResult(msrest.serialization.Model): """List of workspaces. - :param next_link: Link to the next page of results. - :type next_link: str - :param value: List of workspaces. - :type value: list[~azure.mgmt.synapse.models.Workspace] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + :ivar value: List of workspaces. + :vartype value: list[~azure.mgmt.synapse.models.Workspace] """ _attribute_map = { @@ -11292,6 +13604,12 @@ def __init__( value: Optional[List["Workspace"]] = None, **kwargs ): + """ + :keyword next_link: Link to the next page of results. + :paramtype next_link: str + :keyword value: List of workspaces. + :paramtype value: list[~azure.mgmt.synapse.models.Workspace] + """ super(WorkspaceInfoListResult, self).__init__(**kwargs) self.next_link = next_link self.value = value @@ -11300,10 +13618,10 @@ def __init__( class WorkspaceKeyDetails(msrest.serialization.Model): """Details of the customer managed key associated with the workspace. - :param name: Workspace Key sub-resource name. - :type name: str - :param key_vault_url: Workspace Key sub-resource key vault url. - :type key_vault_url: str + :ivar name: Workspace Key sub-resource name. + :vartype name: str + :ivar key_vault_url: Workspace Key sub-resource key vault url. + :vartype key_vault_url: str """ _attribute_map = { @@ -11318,6 +13636,12 @@ def __init__( key_vault_url: Optional[str] = None, **kwargs ): + """ + :keyword name: Workspace Key sub-resource name. + :paramtype name: str + :keyword key_vault_url: Workspace Key sub-resource key vault url. + :paramtype key_vault_url: str + """ super(WorkspaceKeyDetails, self).__init__(**kwargs) self.name = name self.key_vault_url = key_vault_url @@ -11328,27 +13652,27 @@ class WorkspacePatchInfo(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param identity: The identity of the workspace. - :type identity: ~azure.mgmt.synapse.models.ManagedIdentity - :param sql_administrator_login_password: SQL administrator login password. - :type sql_administrator_login_password: str - :param managed_virtual_network_settings: Managed Virtual Network Settings. - :type managed_virtual_network_settings: + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: The identity of the workspace. + :vartype identity: ~azure.mgmt.synapse.models.ManagedIdentity + :ivar sql_administrator_login_password: SQL administrator login password. + :vartype sql_administrator_login_password: str + :ivar managed_virtual_network_settings: Managed Virtual Network Settings. + :vartype managed_virtual_network_settings: ~azure.mgmt.synapse.models.ManagedVirtualNetworkSettings - :param workspace_repository_configuration: Git integration settings. - :type workspace_repository_configuration: + :ivar workspace_repository_configuration: Git integration settings. + :vartype workspace_repository_configuration: ~azure.mgmt.synapse.models.WorkspaceRepositoryConfiguration - :param purview_configuration: Purview Configuration. - :type purview_configuration: ~azure.mgmt.synapse.models.PurviewConfiguration + :ivar purview_configuration: Purview Configuration. + :vartype purview_configuration: ~azure.mgmt.synapse.models.PurviewConfiguration :ivar provisioning_state: Resource provisioning state. :vartype provisioning_state: str - :param encryption: The encryption details of the workspace. - :type encryption: ~azure.mgmt.synapse.models.EncryptionDetails - :param public_network_access: Enable or Disable public network access to workspace. Possible + :ivar encryption: The encryption details of the workspace. + :vartype encryption: ~azure.mgmt.synapse.models.EncryptionDetails + :ivar public_network_access: Enable or Disable public network access to workspace. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or ~azure.mgmt.synapse.models.WorkspacePublicNetworkAccess + :vartype public_network_access: str or ~azure.mgmt.synapse.models.WorkspacePublicNetworkAccess """ _validation = { @@ -11380,6 +13704,28 @@ def __init__( public_network_access: Optional[Union[str, "WorkspacePublicNetworkAccess"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: The identity of the workspace. + :paramtype identity: ~azure.mgmt.synapse.models.ManagedIdentity + :keyword sql_administrator_login_password: SQL administrator login password. + :paramtype sql_administrator_login_password: str + :keyword managed_virtual_network_settings: Managed Virtual Network Settings. + :paramtype managed_virtual_network_settings: + ~azure.mgmt.synapse.models.ManagedVirtualNetworkSettings + :keyword workspace_repository_configuration: Git integration settings. + :paramtype workspace_repository_configuration: + ~azure.mgmt.synapse.models.WorkspaceRepositoryConfiguration + :keyword purview_configuration: Purview Configuration. + :paramtype purview_configuration: ~azure.mgmt.synapse.models.PurviewConfiguration + :keyword encryption: The encryption details of the workspace. + :paramtype encryption: ~azure.mgmt.synapse.models.EncryptionDetails + :keyword public_network_access: Enable or Disable public network access to workspace. Possible + values include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.synapse.models.WorkspacePublicNetworkAccess + """ super(WorkspacePatchInfo, self).__init__(**kwargs) self.tags = tags self.identity = identity @@ -11395,25 +13741,25 @@ def __init__( class WorkspaceRepositoryConfiguration(msrest.serialization.Model): """Git integration settings. - :param type: Type of workspace repositoryID configuration. Example WorkspaceVSTSConfiguration, + :ivar type: Type of workspace repositoryID configuration. Example WorkspaceVSTSConfiguration, WorkspaceGitHubConfiguration. - :type type: str - :param host_name: GitHub Enterprise host name. For example: https://github.mydomain.com. - :type host_name: str - :param account_name: Account name. - :type account_name: str - :param project_name: VSTS project name. - :type project_name: str - :param repository_name: Repository name. - :type repository_name: str - :param collaboration_branch: Collaboration branch. - :type collaboration_branch: str - :param root_folder: Root folder to use in the repository. - :type root_folder: str - :param last_commit_id: The last commit ID. - :type last_commit_id: str - :param tenant_id: The VSTS tenant ID. - :type tenant_id: str + :vartype type: str + :ivar host_name: GitHub Enterprise host name. For example: https://github.mydomain.com. + :vartype host_name: str + :ivar account_name: Account name. + :vartype account_name: str + :ivar project_name: VSTS project name. + :vartype project_name: str + :ivar repository_name: Repository name. + :vartype repository_name: str + :ivar collaboration_branch: Collaboration branch. + :vartype collaboration_branch: str + :ivar root_folder: Root folder to use in the repository. + :vartype root_folder: str + :ivar last_commit_id: The last commit ID. + :vartype last_commit_id: str + :ivar tenant_id: The VSTS tenant ID. + :vartype tenant_id: str """ _attribute_map = { @@ -11442,6 +13788,27 @@ def __init__( tenant_id: Optional[str] = None, **kwargs ): + """ + :keyword type: Type of workspace repositoryID configuration. Example + WorkspaceVSTSConfiguration, WorkspaceGitHubConfiguration. + :paramtype type: str + :keyword host_name: GitHub Enterprise host name. For example: https://github.mydomain.com. + :paramtype host_name: str + :keyword account_name: Account name. + :paramtype account_name: str + :keyword project_name: VSTS project name. + :paramtype project_name: str + :keyword repository_name: Repository name. + :paramtype repository_name: str + :keyword collaboration_branch: Collaboration branch. + :paramtype collaboration_branch: str + :keyword root_folder: Root folder to use in the repository. + :paramtype root_folder: str + :keyword last_commit_id: The last commit ID. + :paramtype last_commit_id: str + :keyword tenant_id: The VSTS tenant ID. + :paramtype tenant_id: str + """ super(WorkspaceRepositoryConfiguration, self).__init__(**kwargs) self.type = type self.host_name = host_name diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_synapse_management_client_enums.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_synapse_management_client_enums.py index b9ee2a3bfecca..214d96be3e545 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_synapse_management_client_enums.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_synapse_management_client_enums.py @@ -6,31 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AzureADOnlyAuthenticationName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AzureADOnlyAuthenticationName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" -class AzureScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AzureScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Scale type. """ @@ -38,11 +23,11 @@ class AzureScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "manual" NONE = "none" -class BlobAuditingPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BlobAuditingPolicyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" -class BlobAuditingPolicyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BlobAuditingPolicyState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the state of the policy. If state is Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. """ @@ -50,21 +35,21 @@ class BlobAuditingPolicyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum ENABLED = "Enabled" DISABLED = "Disabled" -class BlobStorageEventType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BlobStorageEventType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The name of blob storage event type to process. """ MICROSOFT_STORAGE_BLOB_CREATED = "Microsoft.Storage.BlobCreated" MICROSOFT_STORAGE_BLOB_RENAMED = "Microsoft.Storage.BlobRenamed" -class ClusterPrincipalRole(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClusterPrincipalRole(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Cluster principal role. """ ALL_DATABASES_ADMIN = "AllDatabasesAdmin" ALL_DATABASES_VIEWER = "AllDatabasesViewer" -class ColumnDataType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ColumnDataType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The column data type. """ @@ -103,25 +88,25 @@ class ColumnDataType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): XML = "xml" SYSNAME = "sysname" -class Compression(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Compression(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The compression type """ NONE = "None" G_ZIP = "GZip" -class ConfigurationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConfigurationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the spark config properties file. """ FILE = "File" ARTIFACT = "Artifact" -class ConnectionPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ConnectionPolicyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -130,7 +115,7 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class CreateMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreateMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the mode of sql pool creation. Default: regular sql pool creation. @@ -152,7 +137,7 @@ class CreateMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RECOVERY = "Recovery" RESTORE = "Restore" -class DatabasePrincipalRole(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DatabasePrincipalRole(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Database principal role. """ @@ -163,7 +148,7 @@ class DatabasePrincipalRole(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) UNRESTRICTED_VIEWER = "UnrestrictedViewer" VIEWER = "Viewer" -class DataConnectionKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataConnectionKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Kind of the endpoint for the data connection """ @@ -171,7 +156,7 @@ class DataConnectionKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): EVENT_GRID = "EventGrid" IOT_HUB = "IotHub" -class DataFlowComputeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataFlowComputeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Compute type of the cluster which will execute data flow job. """ @@ -179,7 +164,7 @@ class DataFlowComputeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MEMORY_OPTIMIZED = "MemoryOptimized" COMPUTE_OPTIMIZED = "ComputeOptimized" -class DataMaskingFunction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataMaskingFunction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The masking function that is used for the data masking rule. """ @@ -190,7 +175,7 @@ class DataMaskingFunction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SSN = "SSN" TEXT = "Text" -class DataMaskingRuleState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataMaskingRuleState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The rule state. Used to delete a rule. To delete an existing rule, specify the schemaName, tableName, columnName, maskingFunction, and specify ruleState as disabled. However, if the rule doesn't already exist, the rule will be created with ruleState set to enabled, regardless of @@ -200,18 +185,18 @@ class DataMaskingRuleState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DISABLED = "Disabled" ENABLED = "Enabled" -class DataMaskingState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataMaskingState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the data masking policy. """ DISABLED = "Disabled" ENABLED = "Enabled" -class DataWarehouseUserActivityName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataWarehouseUserActivityName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CURRENT = "current" -class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DayOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Day of maintenance window. """ @@ -223,7 +208,7 @@ class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" -class DefaultPrincipalsModificationKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultPrincipalsModificationKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The default principals modification kind """ @@ -231,11 +216,11 @@ class DefaultPrincipalsModificationKind(with_metaclass(_CaseInsensitiveEnumMeta, REPLACE = "Replace" NONE = "None" -class EncryptionProtectorName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionProtectorName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CURRENT = "current" -class EventGridDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EventGridDataFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The data format of the message. Optionally the data format can be added to each message. """ @@ -256,7 +241,7 @@ class EventGridDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): APACHEAVRO = "APACHEAVRO" W3_CLOGFILE = "W3CLOGFILE" -class EventHubDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EventHubDataFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The data format of the message. Optionally the data format can be added to each message. """ @@ -277,46 +262,46 @@ class EventHubDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): APACHEAVRO = "APACHEAVRO" W3_CLOGFILE = "W3CLOGFILE" -class GeoBackupPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GeoBackupPolicyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "Default" -class GeoBackupPolicyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class GeoBackupPolicyState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the geo backup policy. """ DISABLED = "Disabled" ENABLED = "Enabled" -class IntegrationRuntimeAuthKeyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IntegrationRuntimeAuthKeyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The name of the authentication key to regenerate. """ AUTH_KEY1 = "authKey1" AUTH_KEY2 = "authKey2" -class IntegrationRuntimeAutoUpdate(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IntegrationRuntimeAutoUpdate(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of integration runtime auto update. """ ON = "On" OFF = "Off" -class IntegrationRuntimeEdition(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IntegrationRuntimeEdition(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The edition for the SSIS Integration Runtime """ STANDARD = "Standard" ENTERPRISE = "Enterprise" -class IntegrationRuntimeEntityReferenceType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IntegrationRuntimeEntityReferenceType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of this referenced entity. """ INTEGRATION_RUNTIME_REFERENCE = "IntegrationRuntimeReference" LINKED_SERVICE_REFERENCE = "LinkedServiceReference" -class IntegrationRuntimeInternalChannelEncryptionMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IntegrationRuntimeInternalChannelEncryptionMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """It is used to set the encryption mode for node-node communication channel (when more than 2 self-hosted integration runtime nodes exist). """ @@ -325,14 +310,14 @@ class IntegrationRuntimeInternalChannelEncryptionMode(with_metaclass(_CaseInsens SSL_ENCRYPTED = "SslEncrypted" NOT_ENCRYPTED = "NotEncrypted" -class IntegrationRuntimeLicenseType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IntegrationRuntimeLicenseType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """License type for bringing your own license scenario. """ BASE_PRICE = "BasePrice" LICENSE_INCLUDED = "LicenseIncluded" -class IntegrationRuntimeSsisCatalogPricingTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IntegrationRuntimeSsisCatalogPricingTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The pricing tier for the catalog database. The valid values could be found in https://azure.microsoft.com/en-us/pricing/details/sql-database/ """ @@ -342,7 +327,7 @@ class IntegrationRuntimeSsisCatalogPricingTier(with_metaclass(_CaseInsensitiveEn PREMIUM = "Premium" PREMIUM_RS = "PremiumRS" -class IntegrationRuntimeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IntegrationRuntimeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of integration runtime. """ @@ -357,14 +342,14 @@ class IntegrationRuntimeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum OFFLINE = "Offline" ACCESS_DENIED = "AccessDenied" -class IntegrationRuntimeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IntegrationRuntimeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of integration runtime. """ MANAGED = "Managed" SELF_HOSTED = "SelfHosted" -class IntegrationRuntimeUpdateResult(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IntegrationRuntimeUpdateResult(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The result of the last integration runtime node update. """ @@ -372,7 +357,7 @@ class IntegrationRuntimeUpdateResult(with_metaclass(_CaseInsensitiveEnumMeta, st SUCCEED = "Succeed" FAIL = "Fail" -class IotHubDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IotHubDataFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The data format of the message. Optionally the data format can be added to each message. """ @@ -393,21 +378,21 @@ class IotHubDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): APACHEAVRO = "APACHEAVRO" W3_CLOGFILE = "W3CLOGFILE" -class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Kind of the database """ READ_WRITE = "ReadWrite" READ_ONLY_FOLLOWING = "ReadOnlyFollowing" -class LanguageExtensionName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LanguageExtensionName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Language extension that can run within KQL query. """ PYTHON = "PYTHON" R = "R" -class ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentityActualState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentityActualState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Actual state """ @@ -417,14 +402,14 @@ class ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedId DISABLED = "Disabled" UNKNOWN = "Unknown" -class ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentityDesiredState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentityDesiredState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Desired state """ ENABLED = "Enabled" DISABLED = "Disabled" -class ManagedIntegrationRuntimeNodeStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedIntegrationRuntimeNodeStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The managed integration runtime node status. """ @@ -433,7 +418,7 @@ class ManagedIntegrationRuntimeNodeStatus(with_metaclass(_CaseInsensitiveEnumMet RECYCLING = "Recycling" UNAVAILABLE = "Unavailable" -class ManagementOperationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagementOperationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The operation state. """ @@ -444,7 +429,7 @@ class ManagementOperationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu CANCEL_IN_PROGRESS = "CancelInProgress" CANCELLED = "Cancelled" -class NodeSize(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NodeSize(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The level of compute power that each node in the Big Data pool has. """ @@ -456,7 +441,7 @@ class NodeSize(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): XX_LARGE = "XXLarge" XXX_LARGE = "XXXLarge" -class NodeSizeFamily(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NodeSizeFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The kind of nodes that the Big Data pool provides. """ @@ -465,7 +450,7 @@ class NodeSizeFamily(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HARDWARE_ACCELERATED_FPGA = "HardwareAcceleratedFPGA" HARDWARE_ACCELERATED_GPU = "HardwareAcceleratedGPU" -class OperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperationStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Operation status """ @@ -474,7 +459,7 @@ class OperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" CANCELED = "Canceled" -class PrincipalType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrincipalType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Principal type. """ @@ -482,7 +467,7 @@ class PrincipalType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): GROUP = "Group" USER = "User" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Resource provisioning state """ @@ -492,7 +477,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" DELETE_ERROR = "DeleteError" -class QueryAggregationFunction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class QueryAggregationFunction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The function that is used to aggregate each query's metrics. """ @@ -501,7 +486,7 @@ class QueryAggregationFunction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu AVG = "avg" SUM = "sum" -class QueryExecutionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class QueryExecutionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The execution type that is used to filter the query instances that are returned. """ @@ -511,7 +496,7 @@ class QueryExecutionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ABORTED = "aborted" EXCEPTION = "exception" -class QueryMetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class QueryMetricUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The unit of measurement """ @@ -519,7 +504,7 @@ class QueryMetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): KB = "KB" MICROSECONDS = "microseconds" -class QueryObservedMetricType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class QueryObservedMetricType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of metric to use for ordering the top metrics. """ @@ -529,19 +514,19 @@ class QueryObservedMetricType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum DURATION = "duration" EXECUTION_COUNT = "executionCount" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Message providing the reason why the given name is invalid. """ INVALID = "Invalid" ALREADY_EXISTS = "AlreadyExists" -class RecommendedSensitivityLabelUpdateKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RecommendedSensitivityLabelUpdateKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ENABLE = "enable" DISABLE = "disable" -class ReplicationRole(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReplicationRole(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The role of the Sql pool in the replication link. """ @@ -551,7 +536,7 @@ class ReplicationRole(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SOURCE = "Source" COPY = "Copy" -class ReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReplicationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The replication state for the replication link. """ @@ -560,7 +545,7 @@ class ReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CATCH_UP = "CATCH_UP" SUSPENDED = "SUSPENDED" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of managed identity for the workspace """ @@ -568,7 +553,7 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED = "SystemAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" -class ResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioned state of the resource. """ @@ -580,22 +565,22 @@ class ResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, En MOVING = "Moving" CANCELED = "Canceled" -class RestorePointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RestorePointType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of restore point """ CONTINUOUS = "CONTINUOUS" DISCRETE = "DISCRETE" -class SecurityAlertPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SecurityAlertPolicyName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" -class SecurityAlertPolicyNameAutoGenerated(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SecurityAlertPolicyNameAutoGenerated(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "Default" -class SecurityAlertPolicyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SecurityAlertPolicyState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the state of the policy, whether it is enabled or disabled or a policy has not been applied yet on the specific Sql pool. """ @@ -604,7 +589,7 @@ class SecurityAlertPolicyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu ENABLED = "Enabled" DISABLED = "Disabled" -class SelfHostedIntegrationRuntimeNodeStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SelfHostedIntegrationRuntimeNodeStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the integration runtime node. """ @@ -616,7 +601,7 @@ class SelfHostedIntegrationRuntimeNodeStatus(with_metaclass(_CaseInsensitiveEnum INITIALIZING = "Initializing" INITIALIZE_FAILED = "InitializeFailed" -class SensitivityLabelRank(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SensitivityLabelRank(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): NONE = "None" LOW = "Low" @@ -624,31 +609,31 @@ class SensitivityLabelRank(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HIGH = "High" CRITICAL = "Critical" -class SensitivityLabelSource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SensitivityLabelSource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CURRENT = "current" RECOMMENDED = "recommended" -class SensitivityLabelUpdateKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SensitivityLabelUpdateKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SET = "set" REMOVE = "remove" -class ServerKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ServerKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The encryption protector type like 'ServiceManaged', 'AzureKeyVault'. """ SERVICE_MANAGED = "ServiceManaged" AZURE_KEY_VAULT = "AzureKeyVault" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU name. """ COMPUTE_OPTIMIZED = "Compute optimized" STORAGE_OPTIMIZED = "Storage optimized" -class SkuSize(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuSize(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU size. """ @@ -657,7 +642,7 @@ class SkuSize(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MEDIUM = "Medium" LARGE = "Large" -class SsisObjectMetadataType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SsisObjectMetadataType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of SSIS object metadata. """ @@ -666,7 +651,7 @@ class SsisObjectMetadataType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) PACKAGE = "Package" ENVIRONMENT = "Environment" -class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class State(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the resource. """ @@ -680,7 +665,7 @@ class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STARTING = "Starting" UPDATING = "Updating" -class StateValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StateValue(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """property configuration state """ @@ -688,7 +673,7 @@ class StateValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): IN_CONSISTENT = "InConsistent" UPDATING = "Updating" -class StorageAccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StorageAccountType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The storage account type used to store backups for this sql pool. """ @@ -696,34 +681,34 @@ class StorageAccountType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): LRS = "LRS" ZRS = "ZRS" -class TransparentDataEncryptionName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TransparentDataEncryptionName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): CURRENT = "current" -class TransparentDataEncryptionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TransparentDataEncryptionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the database transparent data encryption. """ ENABLED = "Enabled" DISABLED = "Disabled" -class Type(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Type(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of resource, for instance Microsoft.Synapse/workspaces/kustoPools/databases. """ MICROSOFT_SYNAPSE_WORKSPACES_KUSTO_POOLS_DATABASES = "Microsoft.Synapse/workspaces/kustoPools/databases" MICROSOFT_SYNAPSE_WORKSPACES_KUSTO_POOLS_ATTACHED_DATABASE_CONFIGURATIONS = "Microsoft.Synapse/workspaces/kustoPools/attachedDatabaseConfigurations" -class VulnerabilityAssessmentName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VulnerabilityAssessmentName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" -class VulnerabilityAssessmentPolicyBaselineName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VulnerabilityAssessmentPolicyBaselineName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MASTER = "master" DEFAULT = "default" -class VulnerabilityAssessmentScanState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VulnerabilityAssessmentScanState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The scan status. """ @@ -732,14 +717,14 @@ class VulnerabilityAssessmentScanState(with_metaclass(_CaseInsensitiveEnumMeta, FAILED_TO_RUN = "FailedToRun" IN_PROGRESS = "InProgress" -class VulnerabilityAssessmentScanTriggerType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VulnerabilityAssessmentScanTriggerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The scan trigger type. """ ON_DEMAND = "OnDemand" RECURRING = "Recurring" -class WorkspacePublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class WorkspacePublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Enable or Disable public network access to workspace """ diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_azure_ad_only_authentications_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_azure_ad_only_authentications_operations.py index 748ad871e5822..5009204606099 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_azure_ad_only_authentications_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_azure_ad_only_authentications_operations.py @@ -5,25 +5,146 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + azure_ad_only_authentication_name: Union[str, "_models.AzureADOnlyAuthenticationName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/azureADOnlyAuthentications/{azureADOnlyAuthenticationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "azureADOnlyAuthenticationName": _SERIALIZER.url("azure_ad_only_authentication_name", azure_ad_only_authentication_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + azure_ad_only_authentication_name: Union[str, "_models.AzureADOnlyAuthenticationName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/azureADOnlyAuthentications/{azureADOnlyAuthenticationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "azureADOnlyAuthenticationName": _SERIALIZER.url("azure_ad_only_authentication_name", azure_ad_only_authentication_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/azureADOnlyAuthentications') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AzureADOnlyAuthenticationsOperations(object): """AzureADOnlyAuthenticationsOperations operations. @@ -47,14 +168,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - azure_ad_only_authentication_name, # type: Union[str, "_models.AzureADOnlyAuthenticationName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.AzureADOnlyAuthentication" + resource_group_name: str, + workspace_name: str, + azure_ad_only_authentication_name: Union[str, "_models.AzureADOnlyAuthenticationName"], + **kwargs: Any + ) -> "_models.AzureADOnlyAuthentication": """Get Azure Active Directory only authentication property. Gets a Azure Active Directory only authentication property. @@ -64,7 +185,8 @@ def get( :param workspace_name: The name of the workspace. :type workspace_name: str :param azure_ad_only_authentication_name: name of the property. - :type azure_ad_only_authentication_name: str or ~azure.mgmt.synapse.models.AzureADOnlyAuthenticationName + :type azure_ad_only_authentication_name: str or + ~azure.mgmt.synapse.models.AzureADOnlyAuthenticationName :keyword callable cls: A custom type or function that will be passed the direct response :return: AzureADOnlyAuthentication, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.AzureADOnlyAuthentication @@ -75,34 +197,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'azureADOnlyAuthenticationName': self._serialize.url("azure_ad_only_authentication_name", azure_ad_only_authentication_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + azure_ad_only_authentication_name=azure_ad_only_authentication_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AzureADOnlyAuthentication', pipeline_response) @@ -111,56 +223,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/azureADOnlyAuthentications/{azureADOnlyAuthenticationName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - azure_ad_only_authentication_name, # type: Union[str, "_models.AzureADOnlyAuthenticationName"] - azure_ad_only_authentication_info, # type: "_models.AzureADOnlyAuthentication" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.AzureADOnlyAuthentication"] + resource_group_name: str, + workspace_name: str, + azure_ad_only_authentication_name: Union[str, "_models.AzureADOnlyAuthenticationName"], + azure_ad_only_authentication_info: "_models.AzureADOnlyAuthentication", + **kwargs: Any + ) -> Optional["_models.AzureADOnlyAuthentication"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.AzureADOnlyAuthentication"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'azureADOnlyAuthenticationName': self._serialize.url("azure_ad_only_authentication_name", azure_ad_only_authentication_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(azure_ad_only_authentication_info, 'AzureADOnlyAuthentication') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + azure_ad_only_authentication_name=azure_ad_only_authentication_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(azure_ad_only_authentication_info, 'AzureADOnlyAuthentication') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -173,17 +275,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/azureADOnlyAuthentications/{azureADOnlyAuthenticationName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - workspace_name, # type: str - azure_ad_only_authentication_name, # type: Union[str, "_models.AzureADOnlyAuthenticationName"] - azure_ad_only_authentication_info, # type: "_models.AzureADOnlyAuthentication" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AzureADOnlyAuthentication"] + resource_group_name: str, + workspace_name: str, + azure_ad_only_authentication_name: Union[str, "_models.AzureADOnlyAuthenticationName"], + azure_ad_only_authentication_info: "_models.AzureADOnlyAuthentication", + **kwargs: Any + ) -> LROPoller["_models.AzureADOnlyAuthentication"]: """Create or Update Azure Active Directory only authentication property. Create or Update a Azure Active Directory only authentication property for the workspaces. @@ -193,20 +297,25 @@ def begin_create( :param workspace_name: The name of the workspace. :type workspace_name: str :param azure_ad_only_authentication_name: name of the property. - :type azure_ad_only_authentication_name: str or ~azure.mgmt.synapse.models.AzureADOnlyAuthenticationName + :type azure_ad_only_authentication_name: str or + ~azure.mgmt.synapse.models.AzureADOnlyAuthenticationName :param azure_ad_only_authentication_info: Azure Active Directory Property. :type azure_ad_only_authentication_info: ~azure.mgmt.synapse.models.AzureADOnlyAuthentication :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either AzureADOnlyAuthentication or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AzureADOnlyAuthentication or the result + of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.AzureADOnlyAuthentication] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureADOnlyAuthentication"] lro_delay = kwargs.pop( 'polling_interval', @@ -219,28 +328,21 @@ def begin_create( workspace_name=workspace_name, azure_ad_only_authentication_name=azure_ad_only_authentication_name, azure_ad_only_authentication_info=azure_ad_only_authentication_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AzureADOnlyAuthentication', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'azureADOnlyAuthenticationName': self._serialize.url("azure_ad_only_authentication_name", azure_ad_only_authentication_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -252,15 +354,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/azureADOnlyAuthentications/{azureADOnlyAuthenticationName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AzureADOnlyAuthenticationListResult"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.AzureADOnlyAuthenticationListResult"]: """Gets a list of Azure Active Directory only authentication property. Gets a list of Azure Active Directory only authentication property for a workspace. @@ -270,8 +373,10 @@ def list( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AzureADOnlyAuthenticationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.AzureADOnlyAuthenticationListResult] + :return: An iterator like instance of either AzureADOnlyAuthenticationListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.AzureADOnlyAuthenticationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AzureADOnlyAuthenticationListResult"] @@ -279,36 +384,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AzureADOnlyAuthenticationListResult', pipeline_response) + deserialized = self._deserialize("AzureADOnlyAuthenticationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -321,12 +423,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_big_data_pools_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_big_data_pools_operations.py index 70e8b88f7d13a..a0ee578a4f6fc 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_big_data_pools_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_big_data_pools_operations.py @@ -5,25 +5,232 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + big_data_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "bigDataPoolName": _SERIALIZER.url("big_data_pool_name", big_data_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + big_data_pool_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "bigDataPoolName": _SERIALIZER.url("big_data_pool_name", big_data_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + big_data_pool_name: str, + *, + json: JSONType = None, + content: Any = None, + force: Optional[bool] = False, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "bigDataPoolName": _SERIALIZER.url("big_data_pool_name", big_data_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if force is not None: + query_parameters['force'] = _SERIALIZER.query("force", force, 'bool') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + big_data_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "bigDataPoolName": _SERIALIZER.url("big_data_pool_name", big_data_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_workspace_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class BigDataPoolsOperations(object): """BigDataPoolsOperations operations. @@ -47,14 +254,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - big_data_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BigDataPoolResourceInfo" + resource_group_name: str, + workspace_name: str, + big_data_pool_name: str, + **kwargs: Any + ) -> "_models.BigDataPoolResourceInfo": """Get Big Data pool. Get a Big Data pool. @@ -75,34 +282,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'bigDataPoolName': self._serialize.url("big_data_pool_name", big_data_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + big_data_pool_name=big_data_pool_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BigDataPoolResourceInfo', pipeline_response) @@ -111,17 +308,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - workspace_name, # type: str - big_data_pool_name, # type: str - big_data_pool_patch_info, # type: "_models.BigDataPoolPatchInfo" - **kwargs # type: Any - ): - # type: (...) -> "_models.BigDataPoolResourceInfo" + resource_group_name: str, + workspace_name: str, + big_data_pool_name: str, + big_data_pool_patch_info: "_models.BigDataPoolPatchInfo", + **kwargs: Any + ) -> "_models.BigDataPoolResourceInfo": """Update a Big Data pool. Patch a Big Data pool. @@ -144,39 +343,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'bigDataPoolName': self._serialize.url("big_data_pool_name", big_data_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(big_data_pool_patch_info, 'BigDataPoolPatchInfo') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + big_data_pool_name=big_data_pool_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(big_data_pool_patch_info, 'BigDataPoolPatchInfo') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('BigDataPoolResourceInfo', pipeline_response) @@ -185,59 +374,48 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - big_data_pool_name, # type: str - big_data_pool_info, # type: "_models.BigDataPoolResourceInfo" - force=False, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> "_models.BigDataPoolResourceInfo" + resource_group_name: str, + workspace_name: str, + big_data_pool_name: str, + big_data_pool_info: "_models.BigDataPoolResourceInfo", + force: Optional[bool] = False, + **kwargs: Any + ) -> "_models.BigDataPoolResourceInfo": cls = kwargs.pop('cls', None) # type: ClsType["_models.BigDataPoolResourceInfo"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'bigDataPoolName': self._serialize.url("big_data_pool_name", big_data_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force is not None: - query_parameters['force'] = self._serialize.query("force", force, 'bool') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(big_data_pool_info, 'BigDataPoolResourceInfo') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(big_data_pool_info, 'BigDataPoolResourceInfo') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + big_data_pool_name=big_data_pool_name, + content_type=content_type, + json=_json, + force=force, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('BigDataPoolResourceInfo', pipeline_response) @@ -249,18 +427,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - big_data_pool_name, # type: str - big_data_pool_info, # type: "_models.BigDataPoolResourceInfo" - force=False, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BigDataPoolResourceInfo"] + resource_group_name: str, + workspace_name: str, + big_data_pool_name: str, + big_data_pool_info: "_models.BigDataPoolResourceInfo", + force: Optional[bool] = False, + **kwargs: Any + ) -> LROPoller["_models.BigDataPoolResourceInfo"]: """Create a Big Data pool. Create a new Big Data pool. @@ -277,15 +457,19 @@ def begin_create_or_update( :type force: bool :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BigDataPoolResourceInfo or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BigDataPoolResourceInfo or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.BigDataPoolResourceInfo] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BigDataPoolResourceInfo"] lro_delay = kwargs.pop( 'polling_interval', @@ -299,28 +483,21 @@ def begin_create_or_update( big_data_pool_name=big_data_pool_name, big_data_pool_info=big_data_pool_info, force=force, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BigDataPoolResourceInfo', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'bigDataPoolName': self._serialize.url("big_data_pool_name", big_data_pool_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -332,50 +509,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - big_data_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional[Any] + resource_group_name: str, + workspace_name: str, + big_data_pool_name: str, + **kwargs: Any + ) -> Optional[Any]: cls = kwargs.pop('cls', None) # type: ClsType[Optional[Any]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'bigDataPoolName': self._serialize.url("big_data_pool_name", big_data_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + big_data_pool_name=big_data_pool_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -388,16 +554,18 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - workspace_name, # type: str - big_data_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[Any] + resource_group_name: str, + workspace_name: str, + big_data_pool_name: str, + **kwargs: Any + ) -> LROPoller[Any]: """Delete a Big Data pool. Delete a Big Data pool from the workspace. @@ -410,15 +578,17 @@ def begin_delete( :type big_data_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either any or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[any] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[Any] lro_delay = kwargs.pop( 'polling_interval', @@ -433,25 +603,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('object', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'bigDataPoolName': self._serialize.url("big_data_pool_name", big_data_pool_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -463,15 +625,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} # type: ignore + @distributed_trace def list_by_workspace( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BigDataPoolResourceInfoListResult"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.BigDataPoolResourceInfoListResult"]: """List the Big Data pools in a workspace. List Big Data pools in a workspace. @@ -481,8 +644,10 @@ def list_by_workspace( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BigDataPoolResourceInfoListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.BigDataPoolResourceInfoListResult] + :return: An iterator like instance of either BigDataPoolResourceInfoListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.BigDataPoolResourceInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.BigDataPoolResourceInfoListResult"] @@ -490,36 +655,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BigDataPoolResourceInfoListResult', pipeline_response) + deserialized = self._deserialize("BigDataPoolResourceInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -532,12 +694,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_data_masking_policies_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_data_masking_policies_operations.py index 56847c63cb302..fe7baf01c08c2 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_data_masking_policies_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_data_masking_policies_operations.py @@ -5,22 +5,112 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + data_masking_policy_name = "Default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "dataMaskingPolicyName": _SERIALIZER.url("data_masking_policy_name", data_masking_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + data_masking_policy_name = "Default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "dataMaskingPolicyName": _SERIALIZER.url("data_masking_policy_name", data_masking_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DataMaskingPoliciesOperations(object): """DataMaskingPoliciesOperations operations. @@ -44,15 +134,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - parameters, # type: "_models.DataMaskingPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataMaskingPolicy" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + parameters: "_models.DataMaskingPolicy", + **kwargs: Any + ) -> "_models.DataMaskingPolicy": """Creates or updates a Sql pool data masking policy. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -73,41 +163,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - data_masking_policy_name = "Default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'dataMaskingPolicyName': self._serialize.url("data_masking_policy_name", data_masking_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataMaskingPolicy') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataMaskingPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DataMaskingPolicy', pipeline_response) @@ -116,16 +194,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DataMaskingPolicy" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> "_models.DataMaskingPolicy": """Gets a Sql pool data masking policy. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -144,36 +224,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - data_masking_policy_name = "Default" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'dataMaskingPolicyName': self._serialize.url("data_masking_policy_name", data_masking_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DataMaskingPolicy', pipeline_response) @@ -182,4 +250,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_data_masking_rules_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_data_masking_rules_operations.py index 21ac86a526d1d..e7d5c8e50b8ba 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_data_masking_rules_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_data_masking_rules_operations.py @@ -5,23 +5,156 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + data_masking_rule_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + data_masking_policy_name = "Default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "dataMaskingPolicyName": _SERIALIZER.url("data_masking_policy_name", data_masking_policy_name, 'str'), + "dataMaskingRuleName": _SERIALIZER.url("data_masking_rule_name", data_masking_rule_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + data_masking_rule_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + data_masking_policy_name = "Default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "dataMaskingPolicyName": _SERIALIZER.url("data_masking_policy_name", data_masking_policy_name, 'str'), + "dataMaskingRuleName": _SERIALIZER.url("data_masking_rule_name", data_masking_rule_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_sql_pool_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + data_masking_policy_name = "Default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "dataMaskingPolicyName": _SERIALIZER.url("data_masking_policy_name", data_masking_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DataMaskingRulesOperations(object): """DataMaskingRulesOperations operations. @@ -45,16 +178,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - data_masking_rule_name, # type: str - parameters, # type: "_models.DataMaskingRule" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataMaskingRule" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + data_masking_rule_name: str, + parameters: "_models.DataMaskingRule", + **kwargs: Any + ) -> "_models.DataMaskingRule": """Creates or updates a Sql pool data masking rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -77,42 +210,30 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - data_masking_policy_name = "Default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'dataMaskingPolicyName': self._serialize.url("data_masking_policy_name", data_masking_policy_name, 'str'), - 'dataMaskingRuleName': self._serialize.url("data_masking_rule_name", data_masking_rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DataMaskingRule') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + data_masking_rule_name=data_masking_rule_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataMaskingRule') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -125,17 +246,19 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - data_masking_rule_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DataMaskingRule" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + data_masking_rule_name: str, + **kwargs: Any + ) -> "_models.DataMaskingRule": """Gets the specific Sql pool data masking rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -156,37 +279,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - data_masking_policy_name = "Default" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'dataMaskingPolicyName': self._serialize.url("data_masking_policy_name", data_masking_policy_name, 'str'), - 'dataMaskingRuleName': self._serialize.url("data_masking_rule_name", data_masking_rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + data_masking_rule_name=data_masking_rule_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DataMaskingRule', pipeline_response) @@ -195,16 +306,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules/{dataMaskingRuleName}'} # type: ignore + + @distributed_trace def list_by_sql_pool( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataMaskingRuleListResult"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> Iterable["_models.DataMaskingRuleListResult"]: """Gets a list of Sql pool data masking rules. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -214,7 +327,8 @@ def list_by_sql_pool( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataMaskingRuleListResult or the result of cls(response) + :return: An iterator like instance of either DataMaskingRuleListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.DataMaskingRuleListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -223,39 +337,35 @@ def list_by_sql_pool( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - data_masking_policy_name = "Default" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_sql_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'dataMaskingPolicyName': self._serialize.url("data_masking_policy_name", data_masking_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_sql_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list_by_sql_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_sql_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataMaskingRuleListResult', pipeline_response) + deserialized = self._deserialize("DataMaskingRuleListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -268,12 +378,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_extended_sql_pool_blob_auditing_policies_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_extended_sql_pool_blob_auditing_policies_operations.py index 7e8782089d3dd..4a6fc5478ff52 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_extended_sql_pool_blob_auditing_policies_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_extended_sql_pool_blob_auditing_policies_operations.py @@ -5,23 +5,150 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + blob_auditing_policy_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/extendedAuditingSettings/{blobAuditingPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "blobAuditingPolicyName": _SERIALIZER.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + blob_auditing_policy_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/extendedAuditingSettings/{blobAuditingPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "blobAuditingPolicyName": _SERIALIZER.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_sql_pool_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/extendedAuditingSettings') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ExtendedSqlPoolBlobAuditingPoliciesOperations(object): """ExtendedSqlPoolBlobAuditingPoliciesOperations operations. @@ -45,14 +172,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ExtendedSqlPoolBlobAuditingPolicy" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> "_models.ExtendedSqlPoolBlobAuditingPolicy": """Gets an extended Sql pool's blob auditing policy. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -71,30 +198,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - blob_auditing_policy_name = "default" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -108,17 +223,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/extendedAuditingSettings/{blobAuditingPolicyName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - parameters, # type: "_models.ExtendedSqlPoolBlobAuditingPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.ExtendedSqlPoolBlobAuditingPolicy" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + parameters: "_models.ExtendedSqlPoolBlobAuditingPolicy", + **kwargs: Any + ) -> "_models.ExtendedSqlPoolBlobAuditingPolicy": """Creates or updates an extended Sql pool's blob auditing policy. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -139,35 +256,23 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - blob_auditing_policy_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ExtendedSqlPoolBlobAuditingPolicy') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ExtendedSqlPoolBlobAuditingPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,16 +290,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/extendedAuditingSettings/{blobAuditingPolicyName}'} # type: ignore + + @distributed_trace def list_by_sql_pool( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtendedSqlPoolBlobAuditingPolicyListResult"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtendedSqlPoolBlobAuditingPolicyListResult"]: """Lists extended auditing settings of a Sql pool. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -204,8 +311,10 @@ def list_by_sql_pool( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtendedSqlPoolBlobAuditingPolicyListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.ExtendedSqlPoolBlobAuditingPolicyListResult] + :return: An iterator like instance of either ExtendedSqlPoolBlobAuditingPolicyListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.ExtendedSqlPoolBlobAuditingPolicyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtendedSqlPoolBlobAuditingPolicyListResult"] @@ -213,37 +322,35 @@ def list_by_sql_pool( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_sql_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_sql_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list_by_sql_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_sql_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExtendedSqlPoolBlobAuditingPolicyListResult', pipeline_response) + deserialized = self._deserialize("ExtendedSqlPoolBlobAuditingPolicyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -261,6 +368,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_auth_keys_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_auth_keys_operations.py index 41c31120b88f3..a1fc6606de764 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_auth_keys_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_auth_keys_operations.py @@ -5,22 +5,108 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_regenerate_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/regenerateAuthKey') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/listAuthKeys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class IntegrationRuntimeAuthKeysOperations(object): """IntegrationRuntimeAuthKeysOperations operations. @@ -44,15 +130,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def regenerate( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - regenerate_key_parameters, # type: "_models.IntegrationRuntimeRegenerateKeyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.IntegrationRuntimeAuthKeys" + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + regenerate_key_parameters: "_models.IntegrationRuntimeRegenerateKeyParameters", + **kwargs: Any + ) -> "_models.IntegrationRuntimeAuthKeys": """Regenerate integration runtime authentication key. Regenerate the authentication key for an integration runtime. @@ -65,7 +151,8 @@ def regenerate( :type integration_runtime_name: str :param regenerate_key_parameters: The parameters for regenerating integration runtime authentication key. - :type regenerate_key_parameters: ~azure.mgmt.synapse.models.IntegrationRuntimeRegenerateKeyParameters + :type regenerate_key_parameters: + ~azure.mgmt.synapse.models.IntegrationRuntimeRegenerateKeyParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: IntegrationRuntimeAuthKeys, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeAuthKeys @@ -76,39 +163,29 @@ def regenerate( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.regenerate.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(regenerate_key_parameters, 'IntegrationRuntimeRegenerateKeyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_regenerate_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + content_type=content_type, + json=_json, + template_url=self.regenerate.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(regenerate_key_parameters, 'IntegrationRuntimeRegenerateKeyParameters') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IntegrationRuntimeAuthKeys', pipeline_response) @@ -117,16 +194,18 @@ def regenerate( return cls(pipeline_response, deserialized, {}) return deserialized + regenerate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/regenerateAuthKey'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IntegrationRuntimeAuthKeys" + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any + ) -> "_models.IntegrationRuntimeAuthKeys": """List integration runtime authentication keys. List authentication keys in an integration runtime. @@ -147,34 +226,24 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IntegrationRuntimeAuthKeys', pipeline_response) @@ -183,4 +252,6 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/listAuthKeys'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_connection_infos_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_connection_infos_operations.py index f2784c8a86a49..ade65ed312ca2 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_connection_infos_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_connection_infos_operations.py @@ -5,22 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/getConnectionInfo') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class IntegrationRuntimeConnectionInfosOperations(object): """IntegrationRuntimeConnectionInfosOperations operations. @@ -44,14 +83,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IntegrationRuntimeConnectionInfo" + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any + ) -> "_models.IntegrationRuntimeConnectionInfo": """Get integration runtime connection info. Get connection info for an integration runtime. @@ -72,34 +111,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IntegrationRuntimeConnectionInfo', pipeline_response) @@ -108,4 +137,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/getConnectionInfo'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_credentials_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_credentials_operations.py index eb9211a2e4e48..6f18dfb82ae0d 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_credentials_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_credentials_operations.py @@ -5,22 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _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_sync_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/syncCredentials') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class IntegrationRuntimeCredentialsOperations(object): """IntegrationRuntimeCredentialsOperations operations. @@ -44,14 +83,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def sync( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any + ) -> None: """Sync integration runtime credentials. Force the integration runtime to synchronize credentials across integration runtime nodes, and @@ -75,37 +114,28 @@ def sync( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.sync.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_sync_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self.sync.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) sync.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/syncCredentials'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_monitoring_data_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_monitoring_data_operations.py index ad41ca0d0a45b..8ce9fba647f9a 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_monitoring_data_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_monitoring_data_operations.py @@ -5,22 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _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, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/monitoringData') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class IntegrationRuntimeMonitoringDataOperations(object): """IntegrationRuntimeMonitoringDataOperations operations. @@ -44,14 +83,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IntegrationRuntimeMonitoringData" + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any + ) -> "_models.IntegrationRuntimeMonitoringData": """Get integration runtime monitoring data. Get monitoring data for an integration runtime. @@ -72,34 +111,24 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IntegrationRuntimeMonitoringData', pipeline_response) @@ -108,4 +137,6 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/monitoringData'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_node_ip_address_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_node_ip_address_operations.py index 87e7c236ddf6b..38461ecdbde1e 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_node_ip_address_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_node_ip_address_operations.py @@ -5,22 +5,63 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + node_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}/ipAddress') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, 'str'), + "nodeName": _SERIALIZER.url("node_name", node_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class IntegrationRuntimeNodeIpAddressOperations(object): """IntegrationRuntimeNodeIpAddressOperations operations. @@ -44,15 +85,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - node_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IntegrationRuntimeNodeIpAddress" + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + node_name: str, + **kwargs: Any + ) -> "_models.IntegrationRuntimeNodeIpAddress": """Get integration runtime node IP address. Get the IP address of an integration runtime node. @@ -75,35 +116,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - 'nodeName': self._serialize.url("node_name", node_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + node_name=node_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IntegrationRuntimeNodeIpAddress', pipeline_response) @@ -112,4 +143,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}/ipAddress'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_nodes_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_nodes_operations.py index 395f03b3c4f0c..a6f03f93bb683 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_nodes_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_nodes_operations.py @@ -5,22 +5,151 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + node_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, 'str'), + "nodeName": _SERIALIZER.url("node_name", node_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + node_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, 'str'), + "nodeName": _SERIALIZER.url("node_name", node_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + node_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, 'str'), + "nodeName": _SERIALIZER.url("node_name", node_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class IntegrationRuntimeNodesOperations(object): """IntegrationRuntimeNodesOperations operations. @@ -44,15 +173,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - node_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SelfHostedIntegrationRuntimeNode" + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + node_name: str, + **kwargs: Any + ) -> "_models.SelfHostedIntegrationRuntimeNode": """Get integration runtime node. Get an integration runtime node. @@ -75,35 +204,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - 'nodeName': self._serialize.url("node_name", node_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + node_name=node_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SelfHostedIntegrationRuntimeNode', pipeline_response) @@ -112,18 +231,20 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - node_name, # type: str - update_integration_runtime_node_request, # type: "_models.UpdateIntegrationRuntimeNodeRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.SelfHostedIntegrationRuntimeNode" + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + node_name: str, + update_integration_runtime_node_request: "_models.UpdateIntegrationRuntimeNodeRequest", + **kwargs: Any + ) -> "_models.SelfHostedIntegrationRuntimeNode": """Create integration runtime node. Create an integration runtime node. @@ -138,7 +259,8 @@ def update( :type node_name: str :param update_integration_runtime_node_request: The parameters for updating an integration runtime node. - :type update_integration_runtime_node_request: ~azure.mgmt.synapse.models.UpdateIntegrationRuntimeNodeRequest + :type update_integration_runtime_node_request: + ~azure.mgmt.synapse.models.UpdateIntegrationRuntimeNodeRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: SelfHostedIntegrationRuntimeNode, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.SelfHostedIntegrationRuntimeNode @@ -149,40 +271,30 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - 'nodeName': self._serialize.url("node_name", node_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(update_integration_runtime_node_request, 'UpdateIntegrationRuntimeNodeRequest') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + node_name=node_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(update_integration_runtime_node_request, 'UpdateIntegrationRuntimeNodeRequest') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SelfHostedIntegrationRuntimeNode', pipeline_response) @@ -191,17 +303,19 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - node_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + node_name: str, + **kwargs: Any + ) -> None: """Delete integration runtime node. Delete an integration runtime node. @@ -224,38 +338,29 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - 'nodeName': self._serialize.url("node_name", node_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + node_name=node_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_object_metadata_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_object_metadata_operations.py index aa1d234f8bd2b..f91e20f0018ee 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_object_metadata_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_object_metadata_operations.py @@ -5,24 +5,110 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/getObjectMetadata') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_refresh_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/refreshObjectMetadata') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class IntegrationRuntimeObjectMetadataOperations(object): """IntegrationRuntimeObjectMetadataOperations operations. @@ -46,15 +132,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - get_metadata_request=None, # type: Optional["_models.GetSsisObjectMetadataRequest"] - **kwargs # type: Any - ): - # type: (...) -> "_models.SsisObjectMetadataListResponse" + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + get_metadata_request: Optional["_models.GetSsisObjectMetadataRequest"] = None, + **kwargs: Any + ) -> "_models.SsisObjectMetadataListResponse": """Get integration runtime object metadata. Get object metadata from an integration runtime. @@ -77,42 +163,32 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if get_metadata_request is not None: - body_content = self._serialize.body(get_metadata_request, 'GetSsisObjectMetadataRequest') + _json = self._serialize.body(get_metadata_request, 'GetSsisObjectMetadataRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + content_type=content_type, + json=_json, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SsisObjectMetadataListResponse', pipeline_response) @@ -121,50 +197,40 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/getObjectMetadata'} # type: ignore + def _refresh_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.SsisObjectMetadataStatusResponse"] + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any + ) -> Optional["_models.SsisObjectMetadataStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SsisObjectMetadataStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._refresh_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_refresh_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self._refresh_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -174,16 +240,18 @@ def _refresh_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/refreshObjectMetadata'} # type: ignore + + @distributed_trace def begin_refresh( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.SsisObjectMetadataStatusResponse"] + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any + ) -> LROPoller["_models.SsisObjectMetadataStatusResponse"]: """Refresh integration runtime object metadata. Refresh the object metadata in an integration runtime. @@ -196,15 +264,19 @@ def begin_refresh( :type integration_runtime_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either SsisObjectMetadataStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.SsisObjectMetadataStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SsisObjectMetadataStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.SsisObjectMetadataStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SsisObjectMetadataStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -219,25 +291,17 @@ def begin_refresh( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('SsisObjectMetadataStatusResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -249,4 +313,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/refreshObjectMetadata'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_status_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_status_operations.py index b85efa01a48a3..4fd010b2a2359 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_status_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtime_status_operations.py @@ -5,22 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/getStatus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class IntegrationRuntimeStatusOperations(object): """IntegrationRuntimeStatusOperations operations. @@ -44,14 +83,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IntegrationRuntimeStatusResponse" + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any + ) -> "_models.IntegrationRuntimeStatusResponse": """Get integration runtime status. Get the integration runtime status. @@ -72,34 +111,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IntegrationRuntimeStatusResponse', pipeline_response) @@ -108,4 +137,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/getStatus'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtimes_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtimes_operations.py index 4de9a3e95db2d..50a14e47a111a 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtimes_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_integration_runtimes_operations.py @@ -5,25 +5,458 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + *, + if_none_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_none_match is not None: + header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + *, + json: JSONType = None, + content: Any = None, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_upgrade_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/upgrade') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_workspace_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/start') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/stop') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_outbound_network_dependencies_endpoints_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/outboundNetworkDependenciesEndpoints') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_enable_interactive_query_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/enableInteractiveQuery') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_disable_interactive_query_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/disableInteractiveQuery') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class IntegrationRuntimesOperations(object): """IntegrationRuntimesOperations operations. @@ -47,15 +480,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def update( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - update_integration_runtime_request, # type: "_models.UpdateIntegrationRuntimeRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.IntegrationRuntimeResource" + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + update_integration_runtime_request: "_models.UpdateIntegrationRuntimeRequest", + **kwargs: Any + ) -> "_models.IntegrationRuntimeResource": """Update integration runtime. Update an integration runtime. @@ -67,7 +500,8 @@ def update( :param integration_runtime_name: Integration runtime name. :type integration_runtime_name: str :param update_integration_runtime_request: The parameters for updating an integration runtime. - :type update_integration_runtime_request: ~azure.mgmt.synapse.models.UpdateIntegrationRuntimeRequest + :type update_integration_runtime_request: + ~azure.mgmt.synapse.models.UpdateIntegrationRuntimeRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: IntegrationRuntimeResource, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeResource @@ -78,39 +512,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(update_integration_runtime_request, 'UpdateIntegrationRuntimeRequest') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(update_integration_runtime_request, 'UpdateIntegrationRuntimeRequest') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IntegrationRuntimeResource', pipeline_response) @@ -119,17 +543,19 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - if_none_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.IntegrationRuntimeResource"] + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> Optional["_models.IntegrationRuntimeResource"]: """Get integration runtime. Get an integration runtime. @@ -154,36 +580,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + if_none_match=if_none_match, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 304]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -194,59 +609,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - integration_runtime, # type: "_models.IntegrationRuntimeResource" - if_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.IntegrationRuntimeResource"] + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + integration_runtime: "_models.IntegrationRuntimeResource", + if_match: Optional[str] = None, + **kwargs: Any + ) -> Optional["_models.IntegrationRuntimeResource"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.IntegrationRuntimeResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(integration_runtime, 'IntegrationRuntimeResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(integration_runtime, 'IntegrationRuntimeResource') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -256,18 +660,20 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - integration_runtime, # type: "_models.IntegrationRuntimeResource" - if_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.IntegrationRuntimeResource"] + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + integration_runtime: "_models.IntegrationRuntimeResource", + if_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller["_models.IntegrationRuntimeResource"]: """Create integration runtime. Create an integration runtime. @@ -285,15 +691,19 @@ def begin_create( :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either IntegrationRuntimeResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IntegrationRuntimeResource or the result + of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.IntegrationRuntimeResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -307,28 +717,21 @@ def begin_create( integration_runtime_name=integration_runtime_name, integration_runtime=integration_runtime, if_match=if_match, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('IntegrationRuntimeResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -340,64 +743,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete integration runtime. Delete an integration runtime. @@ -410,15 +803,17 @@ def begin_delete( :type integration_runtime_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -433,22 +828,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -460,16 +847,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} # type: ignore + @distributed_trace def upgrade( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any + ) -> None: """Upgrade integration runtime. Upgrade an integration runtime. @@ -490,34 +878,24 @@ def upgrade( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.upgrade.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_upgrade_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self.upgrade.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -525,13 +903,14 @@ def upgrade( upgrade.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/upgrade'} # type: ignore + + @distributed_trace def list_by_workspace( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.IntegrationRuntimeListResponse"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.IntegrationRuntimeListResponse"]: """List integration runtimes. List all integration runtimes. @@ -541,7 +920,8 @@ def list_by_workspace( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either IntegrationRuntimeListResponse or the result of cls(response) + :return: An iterator like instance of either IntegrationRuntimeListResponse or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.IntegrationRuntimeListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -550,36 +930,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('IntegrationRuntimeListResponse', pipeline_response) + deserialized = self._deserialize("IntegrationRuntimeListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -592,12 +969,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -605,46 +983,34 @@ def get_next(next_link=None): def _start_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.IntegrationRuntimeStatusResponse"] + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any + ) -> Optional["_models.IntegrationRuntimeStatusResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.IntegrationRuntimeStatusResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_start_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -654,16 +1020,18 @@ def _start_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.IntegrationRuntimeStatusResponse"] + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any + ) -> LROPoller["_models.IntegrationRuntimeStatusResponse"]: """Start integration runtime. Start an integration runtime. @@ -676,15 +1044,19 @@ def begin_start( :type integration_runtime_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either IntegrationRuntimeStatusResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.IntegrationRuntimeStatusResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IntegrationRuntimeStatusResponse or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.IntegrationRuntimeStatusResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeStatusResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -699,25 +1071,17 @@ def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('IntegrationRuntimeStatusResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -729,64 +1093,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/start'} # type: ignore def _stop_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_stop_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/stop'} # type: ignore + + @distributed_trace def begin_stop( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Stop integration runtime. Stop an integration runtime. @@ -799,15 +1153,17 @@ def begin_stop( :type integration_runtime_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -822,22 +1178,14 @@ def begin_stop( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -849,16 +1197,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/stop'} # type: ignore + @distributed_trace def list_outbound_network_dependencies_endpoints( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse" + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any + ) -> "_models.IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse": """Gets list of outbound network dependencies for a given Azure-SSIS integration runtime. Gets the list of outbound network dependencies for a given Azure-SSIS integration runtime. @@ -870,8 +1219,10 @@ def list_outbound_network_dependencies_endpoints( :param integration_runtime_name: Integration runtime name. :type integration_runtime_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse, or the result of cls(response) - :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse + :return: IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse, or the result of + cls(response) + :rtype: + ~azure.mgmt.synapse.models.IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse"] @@ -879,34 +1230,24 @@ def list_outbound_network_dependencies_endpoints( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_outbound_network_dependencies_endpoints.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_outbound_network_dependencies_endpoints_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self.list_outbound_network_dependencies_endpoints.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IntegrationRuntimeOutboundNetworkDependenciesEndpointsResponse', pipeline_response) @@ -915,64 +1256,55 @@ def list_outbound_network_dependencies_endpoints( return cls(pipeline_response, deserialized, {}) return deserialized + list_outbound_network_dependencies_endpoints.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/outboundNetworkDependenciesEndpoints'} # type: ignore + def _enable_interactive_query_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._enable_interactive_query_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_enable_interactive_query_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self._enable_interactive_query_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _enable_interactive_query_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/enableInteractiveQuery'} # type: ignore + + @distributed_trace def begin_enable_interactive_query( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Enable interactive query in integration runtime. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -983,15 +1315,17 @@ def begin_enable_interactive_query( :type integration_runtime_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1006,22 +1340,14 @@ def begin_enable_interactive_query( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1033,64 +1359,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_enable_interactive_query.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/enableInteractiveQuery'} # type: ignore def _disable_interactive_query_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._disable_interactive_query_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_disable_interactive_query_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + template_url=self._disable_interactive_query_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _disable_interactive_query_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/disableInteractiveQuery'} # type: ignore + + @distributed_trace def begin_disable_interactive_query( self, - resource_group_name, # type: str - workspace_name, # type: str - integration_runtime_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Disable interactive query in integration runtime. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1101,15 +1417,17 @@ def begin_disable_interactive_query( :type integration_runtime_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1124,22 +1442,14 @@ def begin_disable_interactive_query( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1151,4 +1461,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_disable_interactive_query.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/disableInteractiveQuery'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_ip_firewall_rules_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_ip_firewall_rules_operations.py index abe3c38b36dd9..bf1fca5eace75 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_ip_firewall_rules_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_ip_firewall_rules_operations.py @@ -5,25 +5,227 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_workspace_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + rule_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + rule_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + rule_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "ruleName": _SERIALIZER.url("rule_name", rule_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_replace_all_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/replaceAllIpFirewallRules') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class IpFirewallRulesOperations(object): """IpFirewallRulesOperations operations. @@ -47,13 +249,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_workspace( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.IpFirewallRuleInfoListResult"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.IpFirewallRuleInfoListResult"]: """Returns a list of firewall rules. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -61,7 +263,8 @@ def list_by_workspace( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either IpFirewallRuleInfoListResult or the result of cls(response) + :return: An iterator like instance of either IpFirewallRuleInfoListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.IpFirewallRuleInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -70,36 +273,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('IpFirewallRuleInfoListResult', pipeline_response) + deserialized = self._deserialize("IpFirewallRuleInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,12 +312,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -125,52 +326,40 @@ def get_next(next_link=None): def _create_or_update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - rule_name, # type: str - ip_firewall_rule_info, # type: "_models.IpFirewallRuleInfo" - **kwargs # type: Any - ): - # type: (...) -> "_models.IpFirewallRuleInfo" + resource_group_name: str, + workspace_name: str, + rule_name: str, + ip_firewall_rule_info: "_models.IpFirewallRuleInfo", + **kwargs: Any + ) -> "_models.IpFirewallRuleInfo": cls = kwargs.pop('cls', None) # type: ClsType["_models.IpFirewallRuleInfo"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(ip_firewall_rule_info, 'IpFirewallRuleInfo') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(ip_firewall_rule_info, 'IpFirewallRuleInfo') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('IpFirewallRuleInfo', pipeline_response) @@ -182,17 +371,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - rule_name, # type: str - ip_firewall_rule_info, # type: "_models.IpFirewallRuleInfo" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.IpFirewallRuleInfo"] + resource_group_name: str, + workspace_name: str, + rule_name: str, + ip_firewall_rule_info: "_models.IpFirewallRuleInfo", + **kwargs: Any + ) -> LROPoller["_models.IpFirewallRuleInfo"]: """Creates or updates a firewall rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -205,15 +396,19 @@ def begin_create_or_update( :type ip_firewall_rule_info: ~azure.mgmt.synapse.models.IpFirewallRuleInfo :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either IpFirewallRuleInfo or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either IpFirewallRuleInfo or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.IpFirewallRuleInfo] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.IpFirewallRuleInfo"] lro_delay = kwargs.pop( 'polling_interval', @@ -226,28 +421,21 @@ def begin_create_or_update( workspace_name=workspace_name, rule_name=rule_name, ip_firewall_rule_info=ip_firewall_rule_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('IpFirewallRuleInfo', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -259,50 +447,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - rule_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional[Any] + resource_group_name: str, + workspace_name: str, + rule_name: str, + **kwargs: Any + ) -> Optional[Any]: cls = kwargs.pop('cls', None) # type: ClsType[Optional[Any]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -312,16 +489,18 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - workspace_name, # type: str - rule_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[Any] + resource_group_name: str, + workspace_name: str, + rule_name: str, + **kwargs: Any + ) -> LROPoller[Any]: """Deletes a firewall rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -332,15 +511,17 @@ def begin_delete( :type rule_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either any or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[any] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[Any] lro_delay = kwargs.pop( 'polling_interval', @@ -355,25 +536,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('object', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -385,16 +558,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - rule_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.IpFirewallRuleInfo" + resource_group_name: str, + workspace_name: str, + rule_name: str, + **kwargs: Any + ) -> "_models.IpFirewallRuleInfo": """Get a firewall rule. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -413,34 +587,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('IpFirewallRuleInfo', pipeline_response) @@ -449,54 +613,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}'} # type: ignore + def _replace_all_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - request, # type: "_models.ReplaceAllIpFirewallRulesRequest" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ReplaceAllFirewallRulesOperationResponse"] + resource_group_name: str, + workspace_name: str, + request: "_models.ReplaceAllIpFirewallRulesRequest", + **kwargs: Any + ) -> Optional["_models.ReplaceAllFirewallRulesOperationResponse"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ReplaceAllFirewallRulesOperationResponse"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._replace_all_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(request, 'ReplaceAllIpFirewallRulesRequest') + + request = build_replace_all_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self._replace_all_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(request, 'ReplaceAllIpFirewallRulesRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -506,16 +660,18 @@ def _replace_all_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _replace_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/replaceAllIpFirewallRules'} # type: ignore + + @distributed_trace def begin_replace_all( self, - resource_group_name, # type: str - workspace_name, # type: str - request, # type: "_models.ReplaceAllIpFirewallRulesRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ReplaceAllFirewallRulesOperationResponse"] + resource_group_name: str, + workspace_name: str, + request: "_models.ReplaceAllIpFirewallRulesRequest", + **kwargs: Any + ) -> LROPoller["_models.ReplaceAllFirewallRulesOperationResponse"]: """Replaces firewall rules. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -526,15 +682,20 @@ def begin_replace_all( :type request: ~azure.mgmt.synapse.models.ReplaceAllIpFirewallRulesRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ReplaceAllFirewallRulesOperationResponse or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.ReplaceAllFirewallRulesOperationResponse] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ReplaceAllFirewallRulesOperationResponse + or the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.ReplaceAllFirewallRulesOperationResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplaceAllFirewallRulesOperationResponse"] lro_delay = kwargs.pop( 'polling_interval', @@ -546,27 +707,21 @@ def begin_replace_all( resource_group_name=resource_group_name, workspace_name=workspace_name, request=request, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ReplaceAllFirewallRulesOperationResponse', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -578,4 +733,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_replace_all.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/replaceAllIpFirewallRules'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_keys_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_keys_operations.py index 0753093d92a3d..3ef96a4a0684c 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_keys_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_keys_operations.py @@ -5,23 +5,181 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_workspace_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/keys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + key_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/keys/{keyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "keyName": _SERIALIZER.url("key_name", key_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + key_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/keys/{keyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "keyName": _SERIALIZER.url("key_name", key_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + key_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/keys/{keyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "keyName": _SERIALIZER.url("key_name", key_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class KeysOperations(object): """KeysOperations operations. @@ -45,13 +203,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_workspace( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyInfoListResult"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.KeyInfoListResult"]: """Returns a list of keys in a workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -68,36 +226,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('KeyInfoListResult', pipeline_response) + deserialized = self._deserialize("KeyInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,25 +265,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/keys'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Key" + resource_group_name: str, + workspace_name: str, + key_name: str, + **kwargs: Any + ) -> "_models.Key": """Gets a workspace key. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -147,34 +303,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'keyName': self._serialize.url("key_name", key_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + key_name=key_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Key', pipeline_response) @@ -183,17 +329,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/keys/{keyName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - key_name, # type: str - key_properties, # type: "_models.Key" - **kwargs # type: Any - ): - # type: (...) -> "_models.Key" + resource_group_name: str, + workspace_name: str, + key_name: str, + key_properties: "_models.Key", + **kwargs: Any + ) -> "_models.Key": """Creates or updates a workspace key. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -214,39 +362,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'keyName': self._serialize.url("key_name", key_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(key_properties, 'Key') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + key_name=key_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(key_properties, 'Key') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Key', pipeline_response) @@ -255,16 +393,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/keys/{keyName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - workspace_name, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Key"] + resource_group_name: str, + workspace_name: str, + key_name: str, + **kwargs: Any + ) -> Optional["_models.Key"]: """Deletes a workspace key. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -283,34 +423,24 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'keyName': self._serialize.url("key_name", key_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + key_name=key_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -321,4 +451,6 @@ def delete( return cls(pipeline_response, deserialized, {}) return deserialized + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/keys/{keyName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_operations_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_operations_operations.py index 9847f7e3f5e12..2498de9d9299e 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_operations_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_operations_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Synapse/kustooperations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class KustoOperationsOperations(object): """KustoOperationsOperations operations. @@ -45,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists available operations for the Kusto sub-resources inside Microsoft.Synapse provider. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,30 +89,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,12 +122,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_attached_database_configurations_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_attached_database_configurations_operations.py index d7d859967fa78..8ae369c24062c 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_attached_database_configurations_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_attached_database_configurations_operations.py @@ -5,25 +5,191 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_kusto_pool_request( + workspace_name: str, + kusto_pool_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + workspace_name: str, + kusto_pool_name: str, + attached_database_configuration_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "attachedDatabaseConfigurationName": _SERIALIZER.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + workspace_name: str, + kusto_pool_name: str, + attached_database_configuration_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "attachedDatabaseConfigurationName": _SERIALIZER.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + workspace_name: str, + kusto_pool_name: str, + attached_database_configuration_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "attachedDatabaseConfigurationName": _SERIALIZER.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class KustoPoolAttachedDatabaseConfigurationsOperations(object): """KustoPoolAttachedDatabaseConfigurationsOperations operations. @@ -47,14 +213,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_kusto_pool( self, - workspace_name, # type: str - kusto_pool_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AttachedDatabaseConfigurationListResult"] + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.AttachedDatabaseConfigurationListResult"]: """Returns the list of attached database configurations of the given Kusto Pool. :param workspace_name: The name of the workspace. @@ -64,8 +230,10 @@ def list_by_kusto_pool( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either AttachedDatabaseConfigurationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.AttachedDatabaseConfigurationListResult] + :return: An iterator like instance of either AttachedDatabaseConfigurationListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.AttachedDatabaseConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AttachedDatabaseConfigurationListResult"] @@ -73,37 +241,35 @@ def list_by_kusto_pool( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_kusto_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_kusto_pool_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_kusto_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_kusto_pool_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AttachedDatabaseConfigurationListResult', pipeline_response) + deserialized = self._deserialize("AttachedDatabaseConfigurationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,26 +282,27 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_kusto_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations'} # type: ignore + @distributed_trace def get( self, - workspace_name, # type: str - kusto_pool_name, # type: str - attached_database_configuration_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AttachedDatabaseConfiguration" + workspace_name: str, + kusto_pool_name: str, + attached_database_configuration_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.AttachedDatabaseConfiguration": """Returns an attached database configuration. :param workspace_name: The name of the workspace. @@ -156,35 +323,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + attached_database_configuration_name=attached_database_configuration_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) @@ -193,58 +350,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore + def _create_or_update_initial( self, - workspace_name, # type: str - kusto_pool_name, # type: str - attached_database_configuration_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.AttachedDatabaseConfiguration" - **kwargs # type: Any - ): - # type: (...) -> "_models.AttachedDatabaseConfiguration" + workspace_name: str, + kusto_pool_name: str, + attached_database_configuration_name: str, + resource_group_name: str, + parameters: "_models.AttachedDatabaseConfiguration", + **kwargs: Any + ) -> "_models.AttachedDatabaseConfiguration": cls = kwargs.pop('cls', None) # type: ClsType["_models.AttachedDatabaseConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AttachedDatabaseConfiguration') + + request = build_create_or_update_request_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + attached_database_configuration_name=attached_database_configuration_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'AttachedDatabaseConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) @@ -259,18 +406,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - workspace_name, # type: str - kusto_pool_name, # type: str - attached_database_configuration_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.AttachedDatabaseConfiguration" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AttachedDatabaseConfiguration"] + workspace_name: str, + kusto_pool_name: str, + attached_database_configuration_name: str, + resource_group_name: str, + parameters: "_models.AttachedDatabaseConfiguration", + **kwargs: Any + ) -> LROPoller["_models.AttachedDatabaseConfiguration"]: """Creates or updates an attached database configuration. :param workspace_name: The name of the workspace. @@ -285,15 +434,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.synapse.models.AttachedDatabaseConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either AttachedDatabaseConfiguration or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either AttachedDatabaseConfiguration or the + result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.AttachedDatabaseConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.AttachedDatabaseConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -307,29 +460,21 @@ def begin_create_or_update( attached_database_configuration_name=attached_database_configuration_name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -341,67 +486,57 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore def _delete_initial( self, - workspace_name, # type: str - kusto_pool_name, # type: str - attached_database_configuration_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + workspace_name: str, + kusto_pool_name: str, + attached_database_configuration_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + attached_database_configuration_name=attached_database_configuration_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - workspace_name, # type: str - kusto_pool_name, # type: str - attached_database_configuration_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + workspace_name: str, + kusto_pool_name: str, + attached_database_configuration_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the attached database configuration with the given name. :param workspace_name: The name of the workspace. @@ -414,15 +549,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -438,23 +575,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -466,4 +594,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_child_resource_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_child_resource_operations.py index db0f31f5a3d50..1f48485c7ac1b 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_child_resource_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_child_resource_operations.py @@ -5,22 +5,71 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_check_name_availability_request( + workspace_name: str, + kusto_pool_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/checkNameAvailability') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class KustoPoolChildResourceOperations(object): """KustoPoolChildResourceOperations operations. @@ -44,15 +93,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - workspace_name, # type: str - kusto_pool_name, # type: str - resource_group_name, # type: str - resource_name, # type: "_models.DatabaseCheckNameRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameResult" + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + resource_name: "_models.DatabaseCheckNameRequest", + **kwargs: Any + ) -> "_models.CheckNameResult": """Checks that the Kusto Pool child resource name is valid and is not already in use. :param workspace_name: The name of the workspace. @@ -73,39 +122,29 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(resource_name, 'DatabaseCheckNameRequest') + + request = build_check_name_availability_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource_name, 'DatabaseCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameResult', pipeline_response) @@ -114,4 +153,6 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/checkNameAvailability'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_data_connections_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_data_connections_operations.py index 830b7c43f76ae..26a717edbb472 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_data_connections_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_data_connections_operations.py @@ -5,25 +5,345 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_check_name_availability_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_data_connection_validation_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnectionValidation') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_database_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + data_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "dataConnectionName": _SERIALIZER.url("data_connection_name", data_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + data_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "dataConnectionName": _SERIALIZER.url("data_connection_name", data_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + data_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "dataConnectionName": _SERIALIZER.url("data_connection_name", data_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + data_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "dataConnectionName": _SERIALIZER.url("data_connection_name", data_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class KustoPoolDataConnectionsOperations(object): """KustoPoolDataConnectionsOperations operations. @@ -47,16 +367,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - resource_group_name, # type: str - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - data_connection_name, # type: "_models.DataConnectionCheckNameRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameResult" + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + data_connection_name: "_models.DataConnectionCheckNameRequest", + **kwargs: Any + ) -> "_models.CheckNameResult": """Checks that the data connection name is valid and is not already in use. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -79,40 +399,30 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(data_connection_name, 'DataConnectionCheckNameRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(data_connection_name, 'DataConnectionCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameResult', pipeline_response) @@ -121,58 +431,48 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/checkNameAvailability'} # type: ignore + def _data_connection_validation_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - parameters, # type: "_models.DataConnectionValidation" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.DataConnectionValidationListResult"] + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + parameters: "_models.DataConnectionValidation", + **kwargs: Any + ) -> Optional["_models.DataConnectionValidationListResult"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DataConnectionValidationListResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._data_connection_validation_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataConnectionValidation') + + request = build_data_connection_validation_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + content_type=content_type, + json=_json, + template_url=self._data_connection_validation_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataConnectionValidation') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -182,18 +482,20 @@ def _data_connection_validation_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _data_connection_validation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnectionValidation'} # type: ignore + + @distributed_trace def begin_data_connection_validation( self, - resource_group_name, # type: str - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - parameters, # type: "_models.DataConnectionValidation" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DataConnectionValidationListResult"] + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + parameters: "_models.DataConnectionValidation", + **kwargs: Any + ) -> LROPoller["_models.DataConnectionValidationListResult"]: """Checks that the data connection parameters are valid. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -208,15 +510,20 @@ def begin_data_connection_validation( :type parameters: ~azure.mgmt.synapse.models.DataConnectionValidation :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DataConnectionValidationListResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.DataConnectionValidationListResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DataConnectionValidationListResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.DataConnectionValidationListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnectionValidationListResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -230,29 +537,21 @@ def begin_data_connection_validation( kusto_pool_name=kusto_pool_name, database_name=database_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DataConnectionValidationListResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -264,17 +563,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_data_connection_validation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnectionValidation'} # type: ignore + @distributed_trace def list_by_database( self, - resource_group_name, # type: str - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataConnectionListResult"] + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + **kwargs: Any + ) -> Iterable["_models.DataConnectionListResult"]: """Returns the list of data connections of the given Kusto pool database. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -286,7 +586,8 @@ def list_by_database( :param database_name: The name of the database in the Kusto pool. :type database_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataConnectionListResult or the result of cls(response) + :return: An iterator like instance of either DataConnectionListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.DataConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -295,38 +596,37 @@ def list_by_database( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_database.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_database_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + template_url=self.list_by_database.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_database_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataConnectionListResult', pipeline_response) + deserialized = self._deserialize("DataConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -339,27 +639,28 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - data_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DataConnection" + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + data_connection_name: str, + **kwargs: Any + ) -> "_models.DataConnection": """Returns a data connection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -382,36 +683,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + data_connection_name=data_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DataConnection', pipeline_response) @@ -420,60 +711,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - data_connection_name, # type: str - parameters, # type: "_models.DataConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataConnection" + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + data_connection_name: str, + parameters: "_models.DataConnection", + **kwargs: Any + ) -> "_models.DataConnection": cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DataConnection') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + data_connection_name=data_connection_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('DataConnection', pipeline_response) @@ -485,19 +766,21 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - data_connection_name, # type: str - parameters, # type: "_models.DataConnection" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DataConnection"] + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + data_connection_name: str, + parameters: "_models.DataConnection", + **kwargs: Any + ) -> LROPoller["_models.DataConnection"]: """Creates or updates a data connection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -514,15 +797,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.synapse.models.DataConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DataConnection or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DataConnection or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.DataConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -537,30 +824,21 @@ def begin_create_or_update( database_name=database_name, data_connection_name=data_connection_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DataConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -572,60 +850,49 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - data_connection_name, # type: str - parameters, # type: "_models.DataConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataConnection" + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + data_connection_name: str, + parameters: "_models.DataConnection", + **kwargs: Any + ) -> "_models.DataConnection": cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataConnection') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + data_connection_name=data_connection_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DataConnection') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('DataConnection', pipeline_response) @@ -637,19 +904,21 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - data_connection_name, # type: str - parameters, # type: "_models.DataConnection" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DataConnection"] + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + data_connection_name: str, + parameters: "_models.DataConnection", + **kwargs: Any + ) -> LROPoller["_models.DataConnection"]: """Updates a data connection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -666,15 +935,19 @@ def begin_update( :type parameters: ~azure.mgmt.synapse.models.DataConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DataConnection or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DataConnection or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.DataConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -689,30 +962,21 @@ def begin_update( database_name=database_name, data_connection_name=data_connection_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DataConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -724,70 +988,60 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - data_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + data_connection_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + data_connection_name=data_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - data_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + data_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the data connection with the given name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -802,15 +1056,17 @@ def begin_delete( :type data_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -827,24 +1083,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -856,4 +1102,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_database_principal_assignments_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_database_principal_assignments_operations.py index 784adcf975581..bc240860f05af 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_database_principal_assignments_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_database_principal_assignments_operations.py @@ -5,25 +5,247 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_check_name_availability_request( + workspace_name: str, + kusto_pool_name: str, + database_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/checkPrincipalAssignmentNameAvailability') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + workspace_name: str, + kusto_pool_name: str, + database_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + workspace_name: str, + kusto_pool_name: str, + database_name: str, + principal_assignment_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "principalAssignmentName": _SERIALIZER.url("principal_assignment_name", principal_assignment_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + workspace_name: str, + kusto_pool_name: str, + database_name: str, + principal_assignment_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "principalAssignmentName": _SERIALIZER.url("principal_assignment_name", principal_assignment_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + workspace_name: str, + kusto_pool_name: str, + database_name: str, + principal_assignment_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "principalAssignmentName": _SERIALIZER.url("principal_assignment_name", principal_assignment_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class KustoPoolDatabasePrincipalAssignmentsOperations(object): """KustoPoolDatabasePrincipalAssignmentsOperations operations. @@ -47,16 +269,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - resource_group_name, # type: str - principal_assignment_name, # type: "_models.DatabasePrincipalAssignmentCheckNameRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameResult" + workspace_name: str, + kusto_pool_name: str, + database_name: str, + resource_group_name: str, + principal_assignment_name: "_models.DatabasePrincipalAssignmentCheckNameRequest", + **kwargs: Any + ) -> "_models.CheckNameResult": """Checks that the database principal assignment is valid and is not already in use. :param workspace_name: The name of the workspace. @@ -68,7 +290,8 @@ def check_name_availability( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param principal_assignment_name: The name of the resource. - :type principal_assignment_name: ~azure.mgmt.synapse.models.DatabasePrincipalAssignmentCheckNameRequest + :type principal_assignment_name: + ~azure.mgmt.synapse.models.DatabasePrincipalAssignmentCheckNameRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameResult, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.CheckNameResult @@ -79,40 +302,30 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(principal_assignment_name, 'DatabasePrincipalAssignmentCheckNameRequest') + + request = build_check_name_availability_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(principal_assignment_name, 'DatabasePrincipalAssignmentCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameResult', pipeline_response) @@ -121,17 +334,19 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/checkPrincipalAssignmentNameAvailability'} # type: ignore + + @distributed_trace def list( self, - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DatabasePrincipalAssignmentListResult"] + workspace_name: str, + kusto_pool_name: str, + database_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DatabasePrincipalAssignmentListResult"]: """Lists all Kusto pool database principalAssignments. :param workspace_name: The name of the workspace. @@ -143,8 +358,10 @@ def list( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DatabasePrincipalAssignmentListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.DatabasePrincipalAssignmentListResult] + :return: An iterator like instance of either DatabasePrincipalAssignmentListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.DatabasePrincipalAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabasePrincipalAssignmentListResult"] @@ -152,38 +369,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DatabasePrincipalAssignmentListResult', pipeline_response) + deserialized = self._deserialize("DatabasePrincipalAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -196,27 +412,28 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments'} # type: ignore + @distributed_trace def get( self, - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - principal_assignment_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DatabasePrincipalAssignment" + workspace_name: str, + kusto_pool_name: str, + database_name: str, + principal_assignment_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DatabasePrincipalAssignment": """Gets a Kusto pool database principalAssignment. :param workspace_name: The name of the workspace. @@ -239,36 +456,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + principal_assignment_name=principal_assignment_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DatabasePrincipalAssignment', pipeline_response) @@ -277,60 +484,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore + def _create_or_update_initial( self, - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - principal_assignment_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.DatabasePrincipalAssignment" - **kwargs # type: Any - ): - # type: (...) -> "_models.DatabasePrincipalAssignment" + workspace_name: str, + kusto_pool_name: str, + database_name: str, + principal_assignment_name: str, + resource_group_name: str, + parameters: "_models.DatabasePrincipalAssignment", + **kwargs: Any + ) -> "_models.DatabasePrincipalAssignment": cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabasePrincipalAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DatabasePrincipalAssignment') + + request = build_create_or_update_request_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + principal_assignment_name=principal_assignment_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'DatabasePrincipalAssignment') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('DatabasePrincipalAssignment', pipeline_response) @@ -342,19 +539,21 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - principal_assignment_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.DatabasePrincipalAssignment" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DatabasePrincipalAssignment"] + workspace_name: str, + kusto_pool_name: str, + database_name: str, + principal_assignment_name: str, + resource_group_name: str, + parameters: "_models.DatabasePrincipalAssignment", + **kwargs: Any + ) -> LROPoller["_models.DatabasePrincipalAssignment"]: """Creates a Kusto pool database principalAssignment. :param workspace_name: The name of the workspace. @@ -371,15 +570,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.synapse.models.DatabasePrincipalAssignment :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either DatabasePrincipalAssignment or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DatabasePrincipalAssignment or the result + of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.DatabasePrincipalAssignment] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabasePrincipalAssignment"] lro_delay = kwargs.pop( 'polling_interval', @@ -394,30 +597,21 @@ def begin_create_or_update( principal_assignment_name=principal_assignment_name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('DatabasePrincipalAssignment', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -429,70 +623,60 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore def _delete_initial( self, - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - principal_assignment_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + workspace_name: str, + kusto_pool_name: str, + database_name: str, + principal_assignment_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + principal_assignment_name=principal_assignment_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + @distributed_trace def begin_delete( self, - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - principal_assignment_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + workspace_name: str, + kusto_pool_name: str, + database_name: str, + principal_assignment_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a Kusto pool principalAssignment. :param workspace_name: The name of the workspace. @@ -507,15 +691,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -532,24 +718,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -561,4 +737,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_databases_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_databases_operations.py index 3b37bf62ab73b..8d5ba858f7253 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_databases_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_databases_operations.py @@ -5,25 +5,239 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_kusto_pool_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class KustoPoolDatabasesOperations(object): """KustoPoolDatabasesOperations operations. @@ -47,14 +261,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_kusto_pool( self, - resource_group_name, # type: str - workspace_name, # type: str - kusto_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DatabaseListResult"] + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + **kwargs: Any + ) -> Iterable["_models.DatabaseListResult"]: """Returns the list of databases of the given Kusto pool. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -73,37 +287,35 @@ def list_by_kusto_pool( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_kusto_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_kusto_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + template_url=self.list_by_kusto_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_kusto_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DatabaseListResult', pipeline_response) + deserialized = self._deserialize("DatabaseListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,26 +328,27 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_kusto_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Database" + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + **kwargs: Any + ) -> "_models.Database": """Returns a database. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -156,35 +369,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Database', pipeline_response) @@ -193,58 +396,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - parameters, # type: "_models.Database" - **kwargs # type: Any - ): - # type: (...) -> "_models.Database" + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + parameters: "_models.Database", + **kwargs: Any + ) -> "_models.Database": cls = kwargs.pop('cls', None) # type: ClsType["_models.Database"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Database') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Database') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Database', pipeline_response) @@ -256,18 +449,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - parameters, # type: "_models.Database" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Database"] + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + parameters: "_models.Database", + **kwargs: Any + ) -> LROPoller["_models.Database"]: """Creates or updates a database. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -282,15 +477,18 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.synapse.models.Database :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Database or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.Database] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Database"] lro_delay = kwargs.pop( 'polling_interval', @@ -304,29 +502,21 @@ def begin_create_or_update( kusto_pool_name=kusto_pool_name, database_name=database_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Database', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -338,58 +528,47 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - parameters, # type: "_models.Database" - **kwargs # type: Any - ): - # type: (...) -> "_models.Database" + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + parameters: "_models.Database", + **kwargs: Any + ) -> "_models.Database": cls = kwargs.pop('cls', None) # type: ClsType["_models.Database"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Database') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Database') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Database', pipeline_response) @@ -401,18 +580,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - parameters, # type: "_models.Database" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Database"] + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + parameters: "_models.Database", + **kwargs: Any + ) -> LROPoller["_models.Database"]: """Updates a database. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -427,15 +608,18 @@ def begin_update( :type parameters: ~azure.mgmt.synapse.models.Database :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Database or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.Database] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Database"] lro_delay = kwargs.pop( 'polling_interval', @@ -449,29 +633,21 @@ def begin_update( kusto_pool_name=kusto_pool_name, database_name=database_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Database', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -483,67 +659,57 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - workspace_name, # type: str - kusto_pool_name, # type: str - database_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the database with the given name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -556,15 +722,17 @@ def begin_delete( :type database_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -580,23 +748,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -608,4 +767,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_principal_assignments_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_principal_assignments_operations.py index 41e182b779d0e..2125e79515607 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_principal_assignments_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_principal_assignments_operations.py @@ -5,25 +5,237 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_check_name_availability_request( + workspace_name: str, + kusto_pool_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/checkPrincipalAssignmentNameAvailability') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + workspace_name: str, + kusto_pool_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + workspace_name: str, + kusto_pool_name: str, + principal_assignment_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "principalAssignmentName": _SERIALIZER.url("principal_assignment_name", principal_assignment_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + workspace_name: str, + kusto_pool_name: str, + principal_assignment_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "principalAssignmentName": _SERIALIZER.url("principal_assignment_name", principal_assignment_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + workspace_name: str, + kusto_pool_name: str, + principal_assignment_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "principalAssignmentName": _SERIALIZER.url("principal_assignment_name", principal_assignment_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class KustoPoolPrincipalAssignmentsOperations(object): """KustoPoolPrincipalAssignmentsOperations operations. @@ -47,15 +259,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - workspace_name, # type: str - kusto_pool_name, # type: str - resource_group_name, # type: str - principal_assignment_name, # type: "_models.ClusterPrincipalAssignmentCheckNameRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameResult" + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + principal_assignment_name: "_models.ClusterPrincipalAssignmentCheckNameRequest", + **kwargs: Any + ) -> "_models.CheckNameResult": """Checks that the principal assignment name is valid and is not already in use. :param workspace_name: The name of the workspace. @@ -65,7 +277,8 @@ def check_name_availability( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param principal_assignment_name: The name of the principal assignment. - :type principal_assignment_name: ~azure.mgmt.synapse.models.ClusterPrincipalAssignmentCheckNameRequest + :type principal_assignment_name: + ~azure.mgmt.synapse.models.ClusterPrincipalAssignmentCheckNameRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameResult, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.CheckNameResult @@ -76,39 +289,29 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(principal_assignment_name, 'ClusterPrincipalAssignmentCheckNameRequest') + + request = build_check_name_availability_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(principal_assignment_name, 'ClusterPrincipalAssignmentCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameResult', pipeline_response) @@ -117,16 +320,18 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/checkPrincipalAssignmentNameAvailability'} # type: ignore + + @distributed_trace def list( self, - workspace_name, # type: str - kusto_pool_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ClusterPrincipalAssignmentListResult"] + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ClusterPrincipalAssignmentListResult"]: """Lists all Kusto pool principalAssignments. :param workspace_name: The name of the workspace. @@ -136,8 +341,10 @@ def list( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ClusterPrincipalAssignmentListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.ClusterPrincipalAssignmentListResult] + :return: An iterator like instance of either ClusterPrincipalAssignmentListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.ClusterPrincipalAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterPrincipalAssignmentListResult"] @@ -145,37 +352,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterPrincipalAssignmentListResult', pipeline_response) + deserialized = self._deserialize("ClusterPrincipalAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -188,26 +393,27 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments'} # type: ignore + @distributed_trace def get( self, - workspace_name, # type: str - kusto_pool_name, # type: str - principal_assignment_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ClusterPrincipalAssignment" + workspace_name: str, + kusto_pool_name: str, + principal_assignment_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.ClusterPrincipalAssignment": """Gets a Kusto pool principalAssignment. :param workspace_name: The name of the workspace. @@ -228,35 +434,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + principal_assignment_name=principal_assignment_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterPrincipalAssignment', pipeline_response) @@ -265,58 +461,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}'} # type: ignore + def _create_or_update_initial( self, - workspace_name, # type: str - kusto_pool_name, # type: str - principal_assignment_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.ClusterPrincipalAssignment" - **kwargs # type: Any - ): - # type: (...) -> "_models.ClusterPrincipalAssignment" + workspace_name: str, + kusto_pool_name: str, + principal_assignment_name: str, + resource_group_name: str, + parameters: "_models.ClusterPrincipalAssignment", + **kwargs: Any + ) -> "_models.ClusterPrincipalAssignment": cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterPrincipalAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ClusterPrincipalAssignment') + + request = build_create_or_update_request_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + principal_assignment_name=principal_assignment_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ClusterPrincipalAssignment') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ClusterPrincipalAssignment', pipeline_response) @@ -328,18 +514,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - workspace_name, # type: str - kusto_pool_name, # type: str - principal_assignment_name, # type: str - resource_group_name, # type: str - parameters, # type: "_models.ClusterPrincipalAssignment" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ClusterPrincipalAssignment"] + workspace_name: str, + kusto_pool_name: str, + principal_assignment_name: str, + resource_group_name: str, + parameters: "_models.ClusterPrincipalAssignment", + **kwargs: Any + ) -> LROPoller["_models.ClusterPrincipalAssignment"]: """Create a Kusto pool principalAssignment. :param workspace_name: The name of the workspace. @@ -354,15 +542,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.synapse.models.ClusterPrincipalAssignment :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ClusterPrincipalAssignment or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ClusterPrincipalAssignment or the result + of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.ClusterPrincipalAssignment] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterPrincipalAssignment"] lro_delay = kwargs.pop( 'polling_interval', @@ -376,29 +568,21 @@ def begin_create_or_update( principal_assignment_name=principal_assignment_name, resource_group_name=resource_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ClusterPrincipalAssignment', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -410,67 +594,57 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}'} # type: ignore def _delete_initial( self, - workspace_name, # type: str - kusto_pool_name, # type: str - principal_assignment_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + workspace_name: str, + kusto_pool_name: str, + principal_assignment_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + principal_assignment_name=principal_assignment_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + @distributed_trace def begin_delete( self, - workspace_name, # type: str - kusto_pool_name, # type: str - principal_assignment_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + workspace_name: str, + kusto_pool_name: str, + principal_assignment_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a Kusto pool principalAssignment. :param workspace_name: The name of the workspace. @@ -483,15 +657,17 @@ def begin_delete( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -507,23 +683,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -535,4 +702,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pools_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pools_operations.py index d71307be41752..09b3e0cd3b8af 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pools_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pools_operations.py @@ -5,25 +5,634 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_skus_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/locations/{location}/kustoPoolCheckNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_workspace_request( + resource_group_name: str, + subscription_id: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + workspace_name: str, + kusto_pool_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + workspace_name: str, + resource_group_name: str, + kusto_pool_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + workspace_name: str, + resource_group_name: str, + kusto_pool_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + workspace_name: str, + resource_group_name: str, + kusto_pool_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + workspace_name: str, + kusto_pool_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/stop') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + workspace_name: str, + kusto_pool_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/start') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_by_resource_request( + workspace_name: str, + kusto_pool_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/skus') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_language_extensions_request( + workspace_name: str, + kusto_pool_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/listLanguageExtensions') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_add_language_extensions_request_initial( + workspace_name: str, + kusto_pool_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/addLanguageExtensions') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_remove_language_extensions_request_initial( + workspace_name: str, + kusto_pool_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/removeLanguageExtensions') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_follower_databases_request( + workspace_name: str, + kusto_pool_name: str, + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/listFollowerDatabases') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_detach_follower_databases_request_initial( + workspace_name: str, + kusto_pool_name: str, + subscription_id: str, + resource_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/detachFollowerDatabases') + path_format_arguments = { + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "kustoPoolName": _SERIALIZER.url("kusto_pool_name", kusto_pool_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class KustoPoolsOperations(object): """KustoPoolsOperations operations. @@ -47,11 +656,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_skus( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SkuDescriptionList"] + **kwargs: Any + ) -> Iterable["_models.SkuDescriptionList"]: """Lists eligible SKUs for Kusto Pool resource. :keyword callable cls: A custom type or function that will be passed the direct response @@ -64,34 +673,29 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_skus.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + subscription_id=self._config.subscription_id, + template_url=self.list_skus.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SkuDescriptionList', pipeline_response) + deserialized = self._deserialize("SkuDescriptionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -104,24 +708,25 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/skus'} # type: ignore + @distributed_trace def check_name_availability( self, - location, # type: str - kusto_pool_name, # type: "_models.KustoPoolCheckNameRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameResult" + location: str, + kusto_pool_name: "_models.KustoPoolCheckNameRequest", + **kwargs: Any + ) -> "_models.CheckNameResult": """Checks that the kusto pool name is valid and is not already in use. :param location: The name of Azure region. @@ -138,37 +743,27 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'location': self._serialize.url("location", location, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(kusto_pool_name, 'KustoPoolCheckNameRequest') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(kusto_pool_name, 'KustoPoolCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameResult', pipeline_response) @@ -177,15 +772,17 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/locations/{location}/kustoPoolCheckNameAvailability'} # type: ignore + + @distributed_trace def list_by_workspace( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KustoPoolListResult" + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> "_models.KustoPoolListResult": """List Kusto pools. List all Kusto pools. @@ -204,33 +801,23 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_workspace_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('KustoPoolListResult', pipeline_response) @@ -239,16 +826,18 @@ def list_by_workspace( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools'} # type: ignore + + @distributed_trace def get( self, - workspace_name, # type: str - kusto_pool_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.KustoPool" + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.KustoPool": """Gets a Kusto pool. :param workspace_name: The name of the workspace. @@ -267,34 +856,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('KustoPool', pipeline_response) @@ -303,62 +882,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}'} # type: ignore + def _create_or_update_initial( self, - workspace_name, # type: str - resource_group_name, # type: str - kusto_pool_name, # type: str - parameters, # type: "_models.KustoPool" - if_match=None, # type: Optional[str] - if_none_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.KustoPool" + workspace_name: str, + resource_group_name: str, + kusto_pool_name: str, + parameters: "_models.KustoPool", + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.KustoPool": cls = kwargs.pop('cls', None) # type: ClsType["_models.KustoPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - if if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'KustoPool') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'KustoPool') + + request = build_create_or_update_request_initial( + workspace_name=workspace_name, + resource_group_name=resource_group_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + if_none_match=if_none_match, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('KustoPool', pipeline_response) @@ -370,19 +937,21 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - workspace_name, # type: str - resource_group_name, # type: str - kusto_pool_name, # type: str - parameters, # type: "_models.KustoPool" - if_match=None, # type: Optional[str] - if_none_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.KustoPool"] + workspace_name: str, + resource_group_name: str, + kusto_pool_name: str, + parameters: "_models.KustoPool", + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller["_models.KustoPool"]: """Create or update a Kusto pool. :param workspace_name: The name of the workspace. @@ -403,15 +972,18 @@ def begin_create_or_update( :type if_none_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either KustoPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.KustoPool] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.KustoPool"] lro_delay = kwargs.pop( 'polling_interval', @@ -426,28 +998,21 @@ def begin_create_or_update( parameters=parameters, if_match=if_match, if_none_match=if_none_match, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('KustoPool', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -459,59 +1024,47 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}'} # type: ignore def _update_initial( self, - workspace_name, # type: str - resource_group_name, # type: str - kusto_pool_name, # type: str - parameters, # type: "_models.KustoPoolUpdate" - if_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.KustoPool" + workspace_name: str, + resource_group_name: str, + kusto_pool_name: str, + parameters: "_models.KustoPoolUpdate", + if_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.KustoPool": cls = kwargs.pop('cls', None) # type: ClsType["_models.KustoPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'KustoPoolUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'KustoPoolUpdate') + + request = build_update_request_initial( + workspace_name=workspace_name, + resource_group_name=resource_group_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('KustoPool', pipeline_response) @@ -523,18 +1076,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}'} # type: ignore + + @distributed_trace def begin_update( self, - workspace_name, # type: str - resource_group_name, # type: str - kusto_pool_name, # type: str - parameters, # type: "_models.KustoPoolUpdate" - if_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.KustoPool"] + workspace_name: str, + resource_group_name: str, + kusto_pool_name: str, + parameters: "_models.KustoPoolUpdate", + if_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller["_models.KustoPool"]: """Update a Kusto Kusto Pool. :param workspace_name: The name of the workspace. @@ -551,15 +1106,18 @@ def begin_update( :type if_match: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either KustoPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.KustoPool] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.KustoPool"] lro_delay = kwargs.pop( 'polling_interval', @@ -573,28 +1131,21 @@ def begin_update( kusto_pool_name=kusto_pool_name, parameters=parameters, if_match=if_match, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('KustoPool', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -606,64 +1157,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}'} # type: ignore def _delete_initial( self, - workspace_name, # type: str - resource_group_name, # type: str - kusto_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + workspace_name: str, + resource_group_name: str, + kusto_pool_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + workspace_name=workspace_name, + resource_group_name=resource_group_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}'} # type: ignore + + @distributed_trace def begin_delete( self, - workspace_name, # type: str - resource_group_name, # type: str - kusto_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + workspace_name: str, + resource_group_name: str, + kusto_pool_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a Kusto pool. :param workspace_name: The name of the workspace. @@ -674,15 +1215,17 @@ def begin_delete( :type kusto_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -697,22 +1240,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -724,64 +1259,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}'} # type: ignore def _stop_initial( self, - workspace_name, # type: str - kusto_pool_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_stop_request_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/stop'} # type: ignore + + @distributed_trace def begin_stop( self, - workspace_name, # type: str - kusto_pool_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Stops a Kusto pool. :param workspace_name: The name of the workspace. @@ -792,15 +1317,17 @@ def begin_stop( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -815,22 +1342,14 @@ def begin_stop( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -842,64 +1361,54 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/stop'} # type: ignore def _start_initial( self, - workspace_name, # type: str - kusto_pool_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_start_request_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - workspace_name, # type: str - kusto_pool_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Starts a Kusto pool. :param workspace_name: The name of the workspace. @@ -910,15 +1419,17 @@ def begin_start( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -933,22 +1444,14 @@ def begin_start( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -960,16 +1463,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/start'} # type: ignore + @distributed_trace def list_skus_by_resource( self, - workspace_name, # type: str - kusto_pool_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListResourceSkusResult"] + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ListResourceSkusResult"]: """Returns the SKUs available for the provided resource. :param workspace_name: The name of the workspace. @@ -979,7 +1483,8 @@ def list_skus_by_resource( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListResourceSkusResult or the result of cls(response) + :return: An iterator like instance of either ListResourceSkusResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.ListResourceSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -988,37 +1493,35 @@ def list_skus_by_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_skus_by_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_by_resource_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_skus_by_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_by_resource_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ListResourceSkusResult', pipeline_response) + deserialized = self._deserialize("ListResourceSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1031,25 +1534,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_skus_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/skus'} # type: ignore + @distributed_trace def list_language_extensions( self, - workspace_name, # type: str - kusto_pool_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.LanguageExtensionsList"] + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.LanguageExtensionsList"]: """Returns a list of language extensions that can run within KQL queries. :param workspace_name: The name of the workspace. @@ -1059,7 +1563,8 @@ def list_language_extensions( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either LanguageExtensionsList or the result of cls(response) + :return: An iterator like instance of either LanguageExtensionsList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.LanguageExtensionsList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -1068,37 +1573,35 @@ def list_language_extensions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_language_extensions.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_language_extensions_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_language_extensions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_language_extensions_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('LanguageExtensionsList', pipeline_response) + deserialized = self._deserialize("LanguageExtensionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1111,12 +1614,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1124,67 +1628,56 @@ def get_next(next_link=None): def _add_language_extensions_initial( self, - workspace_name, # type: str - kusto_pool_name, # type: str - resource_group_name, # type: str - language_extensions_to_add, # type: "_models.LanguageExtensionsList" - **kwargs # type: Any - ): - # type: (...) -> None + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + language_extensions_to_add: "_models.LanguageExtensionsList", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._add_language_extensions_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(language_extensions_to_add, 'LanguageExtensionsList') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_add_language_extensions_request_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._add_language_extensions_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(language_extensions_to_add, 'LanguageExtensionsList') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _add_language_extensions_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/addLanguageExtensions'} # type: ignore + + @distributed_trace def begin_add_language_extensions( self, - workspace_name, # type: str - kusto_pool_name, # type: str - resource_group_name, # type: str - language_extensions_to_add, # type: "_models.LanguageExtensionsList" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + language_extensions_to_add: "_models.LanguageExtensionsList", + **kwargs: Any + ) -> LROPoller[None]: """Add a list of language extensions that can run within KQL queries. :param workspace_name: The name of the workspace. @@ -1197,15 +1690,18 @@ def begin_add_language_extensions( :type language_extensions_to_add: ~azure.mgmt.synapse.models.LanguageExtensionsList :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1218,25 +1714,18 @@ def begin_add_language_extensions( kusto_pool_name=kusto_pool_name, resource_group_name=resource_group_name, language_extensions_to_add=language_extensions_to_add, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1248,71 +1737,61 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_add_language_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/addLanguageExtensions'} # type: ignore def _remove_language_extensions_initial( self, - workspace_name, # type: str - kusto_pool_name, # type: str - resource_group_name, # type: str - language_extensions_to_remove, # type: "_models.LanguageExtensionsList" - **kwargs # type: Any - ): - # type: (...) -> None + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + language_extensions_to_remove: "_models.LanguageExtensionsList", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._remove_language_extensions_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(language_extensions_to_remove, 'LanguageExtensionsList') + + request = build_remove_language_extensions_request_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._remove_language_extensions_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(language_extensions_to_remove, 'LanguageExtensionsList') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _remove_language_extensions_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/removeLanguageExtensions'} # type: ignore + + @distributed_trace def begin_remove_language_extensions( self, - workspace_name, # type: str - kusto_pool_name, # type: str - resource_group_name, # type: str - language_extensions_to_remove, # type: "_models.LanguageExtensionsList" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + language_extensions_to_remove: "_models.LanguageExtensionsList", + **kwargs: Any + ) -> LROPoller[None]: """Remove a list of language extensions that can run within KQL queries. :param workspace_name: The name of the workspace. @@ -1325,15 +1804,18 @@ def begin_remove_language_extensions( :type language_extensions_to_remove: ~azure.mgmt.synapse.models.LanguageExtensionsList :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1346,25 +1828,18 @@ def begin_remove_language_extensions( kusto_pool_name=kusto_pool_name, resource_group_name=resource_group_name, language_extensions_to_remove=language_extensions_to_remove, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1376,16 +1851,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_remove_language_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/removeLanguageExtensions'} # type: ignore + @distributed_trace def list_follower_databases( self, - workspace_name, # type: str - kusto_pool_name, # type: str - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.FollowerDatabaseListResult"] + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.FollowerDatabaseListResult"]: """Returns a list of databases that are owned by this Kusto Pool and were followed by another Kusto Pool. @@ -1396,7 +1872,8 @@ def list_follower_databases( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FollowerDatabaseListResult or the result of cls(response) + :return: An iterator like instance of either FollowerDatabaseListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.FollowerDatabaseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -1405,37 +1882,35 @@ def list_follower_databases( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_follower_databases.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_follower_databases_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_follower_databases.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_follower_databases_request( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('FollowerDatabaseListResult', pipeline_response) + deserialized = self._deserialize("FollowerDatabaseListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1448,12 +1923,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1461,67 +1937,56 @@ def get_next(next_link=None): def _detach_follower_databases_initial( self, - workspace_name, # type: str - kusto_pool_name, # type: str - resource_group_name, # type: str - follower_database_to_remove, # type: "_models.FollowerDatabaseDefinition" - **kwargs # type: Any - ): - # type: (...) -> None + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + follower_database_to_remove: "_models.FollowerDatabaseDefinition", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._detach_follower_databases_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(follower_database_to_remove, 'FollowerDatabaseDefinition') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_detach_follower_databases_request_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + content_type=content_type, + json=_json, + template_url=self._detach_follower_databases_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(follower_database_to_remove, 'FollowerDatabaseDefinition') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _detach_follower_databases_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/detachFollowerDatabases'} # type: ignore + + @distributed_trace def begin_detach_follower_databases( self, - workspace_name, # type: str - kusto_pool_name, # type: str - resource_group_name, # type: str - follower_database_to_remove, # type: "_models.FollowerDatabaseDefinition" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + follower_database_to_remove: "_models.FollowerDatabaseDefinition", + **kwargs: Any + ) -> LROPoller[None]: """Detaches all followers of a database owned by this Kusto Pool. :param workspace_name: The name of the workspace. @@ -1534,15 +1999,18 @@ def begin_detach_follower_databases( :type follower_database_to_remove: ~azure.mgmt.synapse.models.FollowerDatabaseDefinition :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1555,25 +2023,18 @@ def begin_detach_follower_databases( kusto_pool_name=kusto_pool_name, resource_group_name=resource_group_name, follower_database_to_remove=follower_database_to_remove, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1585,4 +2046,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_detach_follower_databases.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/detachFollowerDatabases'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_libraries_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_libraries_operations.py index c33f189675ff4..ecf7b02eb88ac 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_libraries_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_libraries_operations.py @@ -5,23 +5,60 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_workspace_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/libraries') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class LibrariesOperations(object): """LibrariesOperations operations. @@ -45,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_workspace( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.LibraryListResponse"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.LibraryListResponse"]: """List the libraries in a workspace. List libraries in a workspace. @@ -70,36 +107,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('LibraryListResponse', pipeline_response) + deserialized = self._deserialize("LibraryListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,12 +146,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_library_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_library_operations.py index 70178507b5efd..19e5bfaf2b12a 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_library_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_library_operations.py @@ -5,22 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + library_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/libraries/{libraryName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "libraryName": _SERIALIZER.url("library_name", library_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class LibraryOperations(object): """LibraryOperations operations. @@ -44,14 +83,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - library_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.LibraryResource" + resource_group_name: str, + library_name: str, + workspace_name: str, + **kwargs: Any + ) -> "_models.LibraryResource": """Get library by name. Get library by name in a workspace. @@ -72,34 +111,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'libraryName': self._serialize.url("library_name", library_name, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + library_name=library_name, + workspace_name=workspace_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('LibraryResource', pipeline_response) @@ -108,4 +137,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/libraries/{libraryName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_operations.py index 78eb3981a8990..a815203afc08b 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_operations.py @@ -5,22 +5,158 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_check_name_availability_request( + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Synapse/operations') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + headers=header_parameters, + **kwargs + ) + + +def build_get_location_header_result_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/operationResults/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_azure_async_header_result_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/operationStatuses/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -44,12 +180,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - request, # type: "_models.CheckNameAvailabilityRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResponse" + request: "_models.CheckNameAvailabilityRequest", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResponse": """Check name availability. Check whether a workspace name is available. @@ -66,36 +202,26 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(request, 'CheckNameAvailabilityRequest') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(request, 'CheckNameAvailabilityRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CheckNameAvailabilityResponse', pipeline_response) @@ -104,13 +230,15 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/checkNameAvailability'} # type: ignore + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> List["_models.AvailableRpOperation"] + **kwargs: Any + ) -> List["_models.AvailableRpOperation"]: """All operations. Get all available operations. @@ -125,25 +253,20 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('[AvailableRpOperation]', pipeline_response) @@ -152,16 +275,18 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/providers/Microsoft.Synapse/operations'} # type: ignore + + @distributed_trace def get_location_header_result( self, - resource_group_name, # type: str - workspace_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + operation_id: str, + **kwargs: Any + ) -> None: """Get operation result. Get the result of an operation. @@ -182,34 +307,24 @@ def get_location_header_result( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_location_header_result.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_location_header_result_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + operation_id=operation_id, + template_url=self.get_location_header_result.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -217,14 +332,15 @@ def get_location_header_result( get_location_header_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/operationResults/{operationId}'} # type: ignore + + @distributed_trace def get_azure_async_header_result( self, - resource_group_name, # type: str - workspace_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationResource"] + resource_group_name: str, + workspace_name: str, + operation_id: str, + **kwargs: Any + ) -> Optional["_models.OperationResource"]: """Get operation status. Get the status of an operation. @@ -245,34 +361,24 @@ def get_azure_async_header_result( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_azure_async_header_result.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_azure_async_header_result_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + operation_id=operation_id, + template_url=self.get_azure_async_header_result.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -283,4 +389,6 @@ def get_azure_async_header_result( return cls(pipeline_response, deserialized, {}) return deserialized + get_azure_async_header_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/operationStatuses/{operationId}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_endpoint_connections_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_endpoint_connections_operations.py index 315ad9b3a7a37..e5583d41fd3bb 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_endpoint_connections_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_endpoint_connections_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -47,14 +205,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Gets a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -73,34 +231,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -109,56 +257,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - private_endpoint_connection_name, # type: str - request, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + request: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(request, 'PrivateEndpointConnection') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(request, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -170,17 +308,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - workspace_name, # type: str - private_endpoint_connection_name, # type: str - request, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + request: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> LROPoller["_models.PrivateEndpointConnection"]: """Approve or reject a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -193,15 +333,19 @@ def begin_create( :type request: ~azure.mgmt.synapse.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +358,21 @@ def begin_create( workspace_name=workspace_name, private_endpoint_connection_name=private_endpoint_connection_name, request=request, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,50 +384,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.OperationResource"] + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Optional["_models.OperationResource"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.OperationResource"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 202: @@ -300,16 +426,18 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - workspace_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OperationResource"] + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller["_models.OperationResource"]: """Delete a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -320,15 +448,18 @@ def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OperationResource or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.OperationResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -343,25 +474,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OperationResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -373,15 +496,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionList"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionList"]: """Lists private endpoint connection in workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -389,7 +513,8 @@ def list( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionList or the result of cls(response) + :return: An iterator like instance of either PrivateEndpointConnectionList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.PrivateEndpointConnectionList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -398,36 +523,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionList', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -440,12 +562,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_endpoint_connections_private_link_hub_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_endpoint_connections_private_link_hub_operations.py index c158ed6fe5c6c..e79943e8298b0 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_endpoint_connections_private_link_hub_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_endpoint_connections_private_link_hub_operations.py @@ -5,23 +5,97 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + private_link_hub_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateLinkHubName": _SERIALIZER.url("private_link_hub_name", private_link_hub_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + private_link_hub_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateLinkHubName": _SERIALIZER.url("private_link_hub_name", private_link_hub_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateEndpointConnectionsPrivateLinkHubOperations(object): """PrivateEndpointConnectionsPrivateLinkHubOperations operations. @@ -45,13 +119,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - private_link_hub_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse"] + resource_group_name: str, + private_link_hub_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse"]: """Get all PrivateEndpointConnections in the PrivateLinkHub. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -59,8 +133,11 @@ def list( :param private_link_hub_name: Name of the privateLinkHub. :type private_link_hub_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse] + :return: An iterator like instance of either + PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse"] @@ -68,36 +145,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateLinkHubName': self._serialize.url("private_link_hub_name", private_link_hub_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_link_hub_name=private_link_hub_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_link_hub_name=private_link_hub_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,25 +184,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}/privateEndpointConnections'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - private_link_hub_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnectionForPrivateLinkHub" + resource_group_name: str, + private_link_hub_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnectionForPrivateLinkHub": """Get all PrivateEndpointConnection in the PrivateLinkHub by name. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -147,34 +222,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateLinkHubName': self._serialize.url("private_link_hub_name", private_link_hub_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_link_hub_name=private_link_hub_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateEndpointConnectionForPrivateLinkHub', pipeline_response) @@ -183,4 +248,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_link_hub_private_link_resources_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_link_hub_private_link_resources_operations.py index 4679f7549829e..4c4cf8b827c32 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_link_hub_private_link_resources_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_link_hub_private_link_resources_operations.py @@ -5,23 +5,97 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + private_link_hub_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateLinkHubName": _SERIALIZER.url("private_link_hub_name", private_link_hub_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + private_link_hub_name: str, + private_link_resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}/privateLinkResources/{privateLinkResourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateLinkHubName": _SERIALIZER.url("private_link_hub_name", private_link_hub_name, 'str'), + "privateLinkResourceName": _SERIALIZER.url("private_link_resource_name", private_link_resource_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateLinkHubPrivateLinkResourcesOperations(object): """PrivateLinkHubPrivateLinkResourcesOperations operations. @@ -45,13 +119,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - private_link_hub_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateLinkResourceListResult"] + resource_group_name: str, + private_link_hub_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateLinkResourceListResult"]: """Private Link Resources. Get all private link resources for a private link hub. @@ -61,7 +135,8 @@ def list( :param private_link_hub_name: The name of the private link hub. :type private_link_hub_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -70,36 +145,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateLinkHubName': self._serialize.url("private_link_hub_name", private_link_hub_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_link_hub_name=private_link_hub_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_link_hub_name=private_link_hub_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,25 +184,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}/privateLinkResources'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - private_link_hub_name, # type: str - private_link_resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResource" + resource_group_name: str, + private_link_hub_name: str, + private_link_resource_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResource": """Get Private Link Hub Private Link Resource. Get private link resource in private link hub. @@ -151,34 +224,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateLinkHubName': self._serialize.url("private_link_hub_name", private_link_hub_name, 'str'), - 'privateLinkResourceName': self._serialize.url("private_link_resource_name", private_link_resource_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_link_hub_name=private_link_hub_name, + private_link_resource_name=private_link_resource_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResource', pipeline_response) @@ -187,4 +250,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}/privateLinkResources/{privateLinkResourceName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_link_hubs_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_link_hubs_operations.py index ae7b897b15ee0..6b7ed6cbd94da 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_link_hubs_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_link_hubs_operations.py @@ -5,25 +5,250 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + private_link_hub_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateLinkHubName": _SERIALIZER.url("private_link_hub_name", private_link_hub_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + private_link_hub_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateLinkHubName": _SERIALIZER.url("private_link_hub_name", private_link_hub_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + private_link_hub_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateLinkHubName": _SERIALIZER.url("private_link_hub_name", private_link_hub_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + private_link_hub_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "privateLinkHubName": _SERIALIZER.url("private_link_hub_name", private_link_hub_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/privateLinkHubs') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateLinkHubsOperations(object): """PrivateLinkHubsOperations operations. @@ -47,18 +272,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateLinkHubInfoListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateLinkHubInfoListResult"]: """Returns a list of privateLinkHubs in a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkHubInfoListResult or the result of cls(response) + :return: An iterator like instance of either PrivateLinkHubInfoListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.PrivateLinkHubInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -67,35 +293,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkHubInfoListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkHubInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,24 +330,25 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - private_link_hub_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkHub" + resource_group_name: str, + private_link_hub_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkHub": """Gets a privateLinkHub. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -142,33 +365,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateLinkHubName': self._serialize.url("private_link_hub_name", private_link_hub_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_link_hub_name=private_link_hub_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkHub', pipeline_response) @@ -177,16 +390,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - private_link_hub_name, # type: str - private_link_hub_patch_info, # type: "_models.PrivateLinkHubPatchInfo" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkHub" + resource_group_name: str, + private_link_hub_name: str, + private_link_hub_patch_info: "_models.PrivateLinkHubPatchInfo", + **kwargs: Any + ) -> "_models.PrivateLinkHub": """Updates a privateLinkHub. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -205,38 +420,28 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateLinkHubName': self._serialize.url("private_link_hub_name", private_link_hub_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(private_link_hub_patch_info, 'PrivateLinkHubPatchInfo') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_link_hub_name=private_link_hub_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_link_hub_patch_info, 'PrivateLinkHubPatchInfo') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -249,16 +454,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - private_link_hub_name, # type: str - private_link_hub_info, # type: "_models.PrivateLinkHub" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkHub" + resource_group_name: str, + private_link_hub_name: str, + private_link_hub_info: "_models.PrivateLinkHub", + **kwargs: Any + ) -> "_models.PrivateLinkHub": """Creates or updates a privateLinkHub. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -277,38 +484,28 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateLinkHubName': self._serialize.url("private_link_hub_name", private_link_hub_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(private_link_hub_info, 'PrivateLinkHub') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_link_hub_name=private_link_hub_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(private_link_hub_info, 'PrivateLinkHub') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -321,61 +518,52 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - private_link_hub_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + private_link_hub_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateLinkHubName': self._serialize.url("private_link_hub_name", private_link_hub_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + private_link_hub_name=private_link_hub_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - private_link_hub_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + private_link_hub_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a privateLinkHub. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -384,15 +572,17 @@ def begin_delete( :type private_link_hub_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -406,21 +596,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'privateLinkHubName': self._serialize.url("private_link_hub_name", private_link_hub_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -432,17 +615,19 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateLinkHubInfoListResult"] + **kwargs: Any + ) -> Iterable["_models.PrivateLinkHubInfoListResult"]: """Returns a list of privateLinkHubs in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkHubInfoListResult or the result of cls(response) + :return: An iterator like instance of either PrivateLinkHubInfoListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.PrivateLinkHubInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -451,34 +636,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkHubInfoListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkHubInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -491,12 +671,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_link_resources_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_link_resources_operations.py index 0701195276748..bab28569793a4 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_link_resources_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_link_resources_operations.py @@ -5,23 +5,97 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + private_link_resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateLinkResources/{privateLinkResourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "privateLinkResourceName": _SERIALIZER.url("private_link_resource_name", private_link_resource_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -45,13 +119,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateLinkResourceListResult"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateLinkResourceListResult"]: """Private Link Resources. Get all private link resources for a workspaces. @@ -61,7 +135,8 @@ def list( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -70,36 +145,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,25 +184,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateLinkResources'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - private_link_resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResource" + resource_group_name: str, + workspace_name: str, + private_link_resource_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResource": """Get Private Link Resource. Get private link resource in workspace. @@ -151,34 +224,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'privateLinkResourceName': self._serialize.url("private_link_resource_name", private_link_resource_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + private_link_resource_name=private_link_resource_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('PrivateLinkResource', pipeline_response) @@ -187,4 +250,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateLinkResources/{privateLinkResourceName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_restorable_dropped_sql_pools_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_restorable_dropped_sql_pools_operations.py index a064dc5521252..155b96b643b58 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_restorable_dropped_sql_pools_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_restorable_dropped_sql_pools_operations.py @@ -5,23 +5,97 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + restorable_dropped_sql_pool_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/restorableDroppedSqlPools/{restorableDroppedSqlPoolId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "restorableDroppedSqlPoolId": _SERIALIZER.url("restorable_dropped_sql_pool_id", restorable_dropped_sql_pool_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_workspace_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/restorableDroppedSqlPools') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RestorableDroppedSqlPoolsOperations(object): """RestorableDroppedSqlPoolsOperations operations. @@ -45,14 +119,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - restorable_dropped_sql_pool_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RestorableDroppedSqlPool" + resource_group_name: str, + workspace_name: str, + restorable_dropped_sql_pool_id: str, + **kwargs: Any + ) -> "_models.RestorableDroppedSqlPool": """Gets a deleted sql pool that can be restored. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -72,34 +146,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'restorableDroppedSqlPoolId': self._serialize.url("restorable_dropped_sql_pool_id", restorable_dropped_sql_pool_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + restorable_dropped_sql_pool_id=restorable_dropped_sql_pool_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('RestorableDroppedSqlPool', pipeline_response) @@ -108,15 +172,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/restorableDroppedSqlPools/{restorableDroppedSqlPoolId}'} # type: ignore + + @distributed_trace def list_by_workspace( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RestorableDroppedSqlPoolListResult"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.RestorableDroppedSqlPoolListResult"]: """Gets a list of deleted Sql pools that can be restored. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -124,8 +190,10 @@ def list_by_workspace( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RestorableDroppedSqlPoolListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.RestorableDroppedSqlPoolListResult] + :return: An iterator like instance of either RestorableDroppedSqlPoolListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.RestorableDroppedSqlPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableDroppedSqlPoolListResult"] @@ -133,36 +201,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RestorableDroppedSqlPoolListResult', pipeline_response) + deserialized = self._deserialize("RestorableDroppedSqlPoolListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -175,12 +240,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_spark_configuration_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_spark_configuration_operations.py index d639f62e3649d..e3824530db0e5 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_spark_configuration_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_spark_configuration_operations.py @@ -5,22 +5,61 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + spark_configuration_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sparkconfigurations/{sparkConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "sparkConfigurationName": _SERIALIZER.url("spark_configuration_name", spark_configuration_name, 'str'), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SparkConfigurationOperations(object): """SparkConfigurationOperations operations. @@ -44,14 +83,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - spark_configuration_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SparkConfigurationResource" + resource_group_name: str, + spark_configuration_name: str, + workspace_name: str, + **kwargs: Any + ) -> "_models.SparkConfigurationResource": """Get SparkConfiguration by name. Get SparkConfiguration by name in a workspace. @@ -72,34 +111,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'sparkConfigurationName': self._serialize.url("spark_configuration_name", spark_configuration_name, 'str'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + spark_configuration_name=spark_configuration_name, + workspace_name=workspace_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SparkConfigurationResource', pipeline_response) @@ -108,4 +137,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sparkconfigurations/{sparkConfigurationName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_spark_configurations_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_spark_configurations_operations.py index aed9c8a01f474..53b77c422281a 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_spark_configurations_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_spark_configurations_operations.py @@ -5,23 +5,60 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_workspace_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sparkconfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SparkConfigurationsOperations(object): """SparkConfigurationsOperations operations. @@ -45,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_workspace( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SparkConfigurationListResponse"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.SparkConfigurationListResponse"]: """List the sparkConfigurations in a workspace. List sparkConfigurations in a workspace. @@ -61,7 +98,8 @@ def list_by_workspace( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SparkConfigurationListResponse or the result of cls(response) + :return: An iterator like instance of either SparkConfigurationListResponse or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.SparkConfigurationListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -70,36 +108,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SparkConfigurationListResponse', pipeline_response) + deserialized = self._deserialize("SparkConfigurationListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,12 +147,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_blob_auditing_policies_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_blob_auditing_policies_operations.py index b71a2419e637e..d982121d16858 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_blob_auditing_policies_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_blob_auditing_policies_operations.py @@ -5,23 +5,150 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + blob_auditing_policy_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/auditingSettings/{blobAuditingPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "blobAuditingPolicyName": _SERIALIZER.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + blob_auditing_policy_name = "default" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/auditingSettings/{blobAuditingPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "blobAuditingPolicyName": _SERIALIZER.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_sql_pool_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/auditingSettings') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SqlPoolBlobAuditingPoliciesOperations(object): """SqlPoolBlobAuditingPoliciesOperations operations. @@ -45,14 +172,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SqlPoolBlobAuditingPolicy" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> "_models.SqlPoolBlobAuditingPolicy": """Get a SQL pool's blob auditing policy. Get a SQL pool's blob auditing policy. @@ -73,30 +200,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - blob_auditing_policy_name = "default" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -110,17 +225,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/auditingSettings/{blobAuditingPolicyName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - parameters, # type: "_models.SqlPoolBlobAuditingPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.SqlPoolBlobAuditingPolicy" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + parameters: "_models.SqlPoolBlobAuditingPolicy", + **kwargs: Any + ) -> "_models.SqlPoolBlobAuditingPolicy": """Creates or updates a SQL pool's blob auditing policy. Creates or updates a SQL pool's blob auditing policy. @@ -143,35 +260,23 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - blob_auditing_policy_name = "default" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'SqlPoolBlobAuditingPolicy') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SqlPoolBlobAuditingPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,16 +294,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/auditingSettings/{blobAuditingPolicyName}'} # type: ignore + + @distributed_trace def list_by_sql_pool( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SqlPoolBlobAuditingPolicyListResult"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> Iterable["_models.SqlPoolBlobAuditingPolicyListResult"]: """Lists auditing settings of a Sql pool. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -208,8 +315,10 @@ def list_by_sql_pool( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlPoolBlobAuditingPolicyListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.SqlPoolBlobAuditingPolicyListResult] + :return: An iterator like instance of either SqlPoolBlobAuditingPolicyListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.SqlPoolBlobAuditingPolicyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolBlobAuditingPolicyListResult"] @@ -217,37 +326,35 @@ def list_by_sql_pool( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_sql_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_sql_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list_by_sql_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_sql_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SqlPoolBlobAuditingPolicyListResult', pipeline_response) + deserialized = self._deserialize("SqlPoolBlobAuditingPolicyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -265,6 +372,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_columns_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_columns_operations.py index 88c7faa10a900..c943935c7d91d 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_columns_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_columns_operations.py @@ -5,22 +5,67 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + table_name: str, + column_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "schemaName": _SERIALIZER.url("schema_name", schema_name, 'str'), + "tableName": _SERIALIZER.url("table_name", table_name, 'str'), + "columnName": _SERIALIZER.url("column_name", column_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SqlPoolColumnsOperations(object): """SqlPoolColumnsOperations operations. @@ -44,17 +89,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - schema_name, # type: str - table_name, # type: str - column_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SqlPoolColumn" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + table_name: str, + column_name: str, + **kwargs: Any + ) -> "_models.SqlPoolColumn": """Get Sql pool column. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -79,31 +124,21 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), - 'tableName': self._serialize.url("table_name", table_name, 'str'), - 'columnName': self._serialize.url("column_name", column_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + table_name=table_name, + column_name=column_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -117,4 +152,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_connection_policies_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_connection_policies_operations.py index 3d968c43fc5c7..7ff8dca4d1bdb 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_connection_policies_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_connection_policies_operations.py @@ -5,22 +5,63 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + connection_policy_name: Union[str, "_models.ConnectionPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/connectionPolicies/{connectionPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "connectionPolicyName": _SERIALIZER.url("connection_policy_name", connection_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SqlPoolConnectionPoliciesOperations(object): """SqlPoolConnectionPoliciesOperations operations. @@ -44,15 +85,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - connection_policy_name, # type: Union[str, "_models.ConnectionPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.SqlPoolConnectionPolicy" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + connection_policy_name: Union[str, "_models.ConnectionPolicyName"], + **kwargs: Any + ) -> "_models.SqlPoolConnectionPolicy": """Get a Sql pool's connection policy, which is used with table auditing. Get a Sql pool's connection policy, which is used with table auditing. @@ -75,35 +116,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'connectionPolicyName': self._serialize.url("connection_policy_name", connection_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + connection_policy_name=connection_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SqlPoolConnectionPolicy', pipeline_response) @@ -112,4 +143,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/connectionPolicies/{connectionPolicyName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_data_warehouse_user_activities_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_data_warehouse_user_activities_operations.py index f9a7abab6abc8..350a9146cd89c 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_data_warehouse_user_activities_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_data_warehouse_user_activities_operations.py @@ -5,22 +5,63 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + data_warehouse_user_activity_name: Union[str, "_models.DataWarehouseUserActivityName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataWarehouseUserActivities/{dataWarehouseUserActivityName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "dataWarehouseUserActivityName": _SERIALIZER.url("data_warehouse_user_activity_name", data_warehouse_user_activity_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SqlPoolDataWarehouseUserActivitiesOperations(object): """SqlPoolDataWarehouseUserActivitiesOperations operations. @@ -44,15 +85,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - data_warehouse_user_activity_name, # type: Union[str, "_models.DataWarehouseUserActivityName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.DataWarehouseUserActivities" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + data_warehouse_user_activity_name: Union[str, "_models.DataWarehouseUserActivityName"], + **kwargs: Any + ) -> "_models.DataWarehouseUserActivities": """Get SQL pool user activities. Gets the user activities of a SQL pool which includes running and suspended queries. @@ -64,7 +105,8 @@ def get( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param data_warehouse_user_activity_name: The activity name of the Sql pool. - :type data_warehouse_user_activity_name: str or ~azure.mgmt.synapse.models.DataWarehouseUserActivityName + :type data_warehouse_user_activity_name: str or + ~azure.mgmt.synapse.models.DataWarehouseUserActivityName :keyword callable cls: A custom type or function that will be passed the direct response :return: DataWarehouseUserActivities, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.DataWarehouseUserActivities @@ -75,29 +117,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'dataWarehouseUserActivityName': self._serialize.url("data_warehouse_user_activity_name", data_warehouse_user_activity_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + data_warehouse_user_activity_name=data_warehouse_user_activity_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -111,4 +143,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataWarehouseUserActivities/{dataWarehouseUserActivityName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_geo_backup_policies_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_geo_backup_policies_operations.py index 5be575f0c2f93..69b1061b43f0c 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_geo_backup_policies_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_geo_backup_policies_operations.py @@ -5,23 +5,150 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/geoBackupPolicies') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + geo_backup_policy_name: Union[str, "_models.GeoBackupPolicyName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/geoBackupPolicies/{geoBackupPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "geoBackupPolicyName": _SERIALIZER.url("geo_backup_policy_name", geo_backup_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + geo_backup_policy_name: Union[str, "_models.GeoBackupPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/geoBackupPolicies/{geoBackupPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "geoBackupPolicyName": _SERIALIZER.url("geo_backup_policy_name", geo_backup_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SqlPoolGeoBackupPoliciesOperations(object): """SqlPoolGeoBackupPoliciesOperations operations. @@ -45,14 +172,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.GeoBackupPolicyListResult"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> Iterable["_models.GeoBackupPolicyListResult"]: """List SQL pool geo backup policies. Get list of SQL pool geo backup policies. @@ -64,7 +191,8 @@ def list( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either GeoBackupPolicyListResult or the result of cls(response) + :return: An iterator like instance of either GeoBackupPolicyListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.GeoBackupPolicyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -73,37 +201,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('GeoBackupPolicyListResult', pipeline_response) + deserialized = self._deserialize("GeoBackupPolicyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,27 +242,28 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/geoBackupPolicies'} # type: ignore + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - geo_backup_policy_name, # type: Union[str, "_models.GeoBackupPolicyName"] - parameters, # type: "_models.GeoBackupPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.GeoBackupPolicy" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + geo_backup_policy_name: Union[str, "_models.GeoBackupPolicyName"], + parameters: "_models.GeoBackupPolicy", + **kwargs: Any + ) -> "_models.GeoBackupPolicy": """Updates a SQL Pool geo backup policy. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -159,40 +286,30 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'geoBackupPolicyName': self._serialize.url("geo_backup_policy_name", geo_backup_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'GeoBackupPolicy') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + geo_backup_policy_name=geo_backup_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'GeoBackupPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -205,17 +322,19 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/geoBackupPolicies/{geoBackupPolicyName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - geo_backup_policy_name, # type: Union[str, "_models.GeoBackupPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.GeoBackupPolicy" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + geo_backup_policy_name: Union[str, "_models.GeoBackupPolicyName"], + **kwargs: Any + ) -> "_models.GeoBackupPolicy": """Get a SQL pool geo backup policy. Get the specified SQL pool geo backup policy. @@ -238,35 +357,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'geoBackupPolicyName': self._serialize.url("geo_backup_policy_name", geo_backup_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + geo_backup_policy_name=geo_backup_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('GeoBackupPolicy', pipeline_response) @@ -275,4 +384,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/geoBackupPolicies/{geoBackupPolicyName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_maintenance_window_options_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_maintenance_window_options_operations.py index 916f42527b140..2dcf71f09179b 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_maintenance_window_options_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_maintenance_window_options_operations.py @@ -5,22 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + *, + maintenance_window_options_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/maintenanceWindowOptions/current') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters['maintenanceWindowOptionsName'] = _SERIALIZER.query("maintenance_window_options_name", maintenance_window_options_name, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SqlPoolMaintenanceWindowOptionsOperations(object): """SqlPoolMaintenanceWindowOptionsOperations operations. @@ -44,15 +86,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - maintenance_window_options_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.MaintenanceWindowOptions" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + maintenance_window_options_name: str, + **kwargs: Any + ) -> "_models.MaintenanceWindowOptions": """SQL pool's available maintenance windows. Get list of SQL pool's available maintenance windows. @@ -75,29 +117,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['maintenanceWindowOptionsName'] = self._serialize.query("maintenance_window_options_name", maintenance_window_options_name, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + maintenance_window_options_name=maintenance_window_options_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -111,4 +143,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/maintenanceWindowOptions/current'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_maintenance_windows_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_maintenance_windows_operations.py index d5d085250fac1..1498edb7e9c44 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_maintenance_windows_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_maintenance_windows_operations.py @@ -5,22 +5,111 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + *, + maintenance_window_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/maintenancewindows/current') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters['maintenanceWindowName'] = _SERIALIZER.query("maintenance_window_name", maintenance_window_name, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + *, + maintenance_window_name: str, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/maintenancewindows/current') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + query_parameters['maintenanceWindowName'] = _SERIALIZER.query("maintenance_window_name", maintenance_window_name, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class SqlPoolMaintenanceWindowsOperations(object): """SqlPoolMaintenanceWindowsOperations operations. @@ -44,15 +133,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - maintenance_window_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.MaintenanceWindows" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + maintenance_window_name: str, + **kwargs: Any + ) -> "_models.MaintenanceWindows": """Get a SQL pool's Maintenance Windows. Get a SQL pool's Maintenance Windows. @@ -75,35 +164,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['maintenanceWindowName'] = self._serialize.query("maintenance_window_name", maintenance_window_name, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + maintenance_window_name=maintenance_window_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MaintenanceWindows', pipeline_response) @@ -112,18 +191,20 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/maintenancewindows/current'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - maintenance_window_name, # type: str - parameters, # type: "_models.MaintenanceWindows" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + maintenance_window_name: str, + parameters: "_models.MaintenanceWindows", + **kwargs: Any + ) -> None: """Creates or updates a Sql pool's maintenance windows settings. Creates or updates a Sql pool's maintenance windows settings. @@ -149,32 +230,24 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - query_parameters['maintenanceWindowName'] = self._serialize.query("maintenance_window_name", maintenance_window_name, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'MaintenanceWindows') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + content_type=content_type, + maintenance_window_name=maintenance_window_name, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'MaintenanceWindows') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -186,3 +259,4 @@ def create_or_update( return cls(pipeline_response, None, {}) create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/maintenancewindows/current'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_metadata_sync_configs_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_metadata_sync_configs_operations.py index 1c3864a220294..600efaa3ad5c6 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_metadata_sync_configs_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_metadata_sync_configs_operations.py @@ -5,22 +5,108 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/metadataSync/config') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/metadataSync/config') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class SqlPoolMetadataSyncConfigsOperations(object): """SqlPoolMetadataSyncConfigsOperations operations. @@ -44,14 +130,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.MetadataSyncConfig"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> Optional["_models.MetadataSyncConfig"]: """Get SQL pool metadata sync config. Get the metadata sync configuration for a SQL pool. @@ -72,34 +158,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -110,17 +186,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/metadataSync/config'} # type: ignore + + @distributed_trace def create( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - metadata_sync_configuration, # type: "_models.MetadataSyncConfig" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.MetadataSyncConfig"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + metadata_sync_configuration: "_models.MetadataSyncConfig", + **kwargs: Any + ) -> Optional["_models.MetadataSyncConfig"]: """Set SQL pool metadata sync config. Set the metadata sync configuration for a SQL pool. @@ -143,39 +221,29 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(metadata_sync_configuration, 'MetadataSyncConfig') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(metadata_sync_configuration, 'MetadataSyncConfig') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -186,4 +254,6 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/metadataSync/config'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_operation_results_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_operation_results_operations.py index 419281a168182..6e7e034b8cf1c 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_operation_results_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_operation_results_operations.py @@ -5,22 +5,63 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_location_header_result_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/operationResults/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SqlPoolOperationResultsOperations(object): """SqlPoolOperationResultsOperations operations. @@ -44,15 +85,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get_location_header_result( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Any + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + operation_id: str, + **kwargs: Any + ) -> Any: """Get SQL pool operation status. Get the status of a SQL pool operation. @@ -75,35 +116,25 @@ def get_location_header_result( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_location_header_result.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_location_header_result_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + operation_id=operation_id, + template_url=self.get_location_header_result.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -116,4 +147,6 @@ def get_location_header_result( return cls(pipeline_response, deserialized, {}) return deserialized + get_location_header_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/operationResults/{operationId}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_operations_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_operations_operations.py index 56513dc96a675..8d89467cadfe7 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_operations_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_operations_operations.py @@ -5,23 +5,62 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/operations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SqlPoolOperationsOperations(object): """SqlPoolOperationsOperations operations. @@ -45,14 +84,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SqlPoolBlobAuditingPolicySqlPoolOperationListResult"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> Iterable["_models.SqlPoolBlobAuditingPolicySqlPoolOperationListResult"]: """Gets a list of operations performed on the SQL pool. Gets a list of operations performed on the SQL pool. @@ -64,8 +103,10 @@ def list( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlPoolBlobAuditingPolicySqlPoolOperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.SqlPoolBlobAuditingPolicySqlPoolOperationListResult] + :return: An iterator like instance of either + SqlPoolBlobAuditingPolicySqlPoolOperationListResult or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.SqlPoolBlobAuditingPolicySqlPoolOperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolBlobAuditingPolicySqlPoolOperationListResult"] @@ -73,37 +114,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SqlPoolBlobAuditingPolicySqlPoolOperationListResult', pipeline_response) + deserialized = self._deserialize("SqlPoolBlobAuditingPolicySqlPoolOperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -121,6 +160,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_recommended_sensitivity_labels_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_recommended_sensitivity_labels_operations.py index 3d09a0387ff6d..faa0714783b11 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_recommended_sensitivity_labels_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_recommended_sensitivity_labels_operations.py @@ -5,22 +5,69 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/recommendedSensitivityLabels') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class SqlPoolRecommendedSensitivityLabelsOperations(object): """SqlPoolRecommendedSensitivityLabelsOperations operations. @@ -44,15 +91,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def update( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - parameters, # type: "_models.RecommendedSensitivityLabelUpdateList" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + parameters: "_models.RecommendedSensitivityLabelUpdateList", + **kwargs: Any + ) -> None: """Update recommended sensitivity labels states of a given SQL Pool using an operations batch. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -73,31 +120,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'RecommendedSensitivityLabelUpdateList') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'RecommendedSensitivityLabelUpdateList') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,3 +148,4 @@ def update( return cls(pipeline_response, None, {}) update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/recommendedSensitivityLabels'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_replication_links_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_replication_links_operations.py index 792ed477d5a47..d35703749e2bb 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_replication_links_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_replication_links_operations.py @@ -5,23 +5,101 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/replicationLinks') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_by_name_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + link_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/replicationLinks/{linkId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "linkId": _SERIALIZER.url("link_id", link_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SqlPoolReplicationLinksOperations(object): """SqlPoolReplicationLinksOperations operations. @@ -45,14 +123,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ReplicationLinkListResult"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> Iterable["_models.ReplicationLinkListResult"]: """Get SQL pool replication links. Lists a Sql pool's replication links. @@ -64,7 +142,8 @@ def list( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationLinkListResult or the result of cls(response) + :return: An iterator like instance of either ReplicationLinkListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.ReplicationLinkListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -73,37 +152,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ReplicationLinkListResult', pipeline_response) + deserialized = self._deserialize("ReplicationLinkListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,26 +193,27 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/replicationLinks'} # type: ignore + @distributed_trace def get_by_name( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - link_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ReplicationLink" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + link_id: str, + **kwargs: Any + ) -> "_models.ReplicationLink": """Get SQL pool replication link by name. Get SQL pool replication link by name. @@ -158,35 +236,25 @@ def get_by_name( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_by_name.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'linkId': self._serialize.url("link_id", link_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_by_name_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + link_id=link_id, + template_url=self.get_by_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ReplicationLink', pipeline_response) @@ -195,4 +263,6 @@ def get_by_name( return cls(pipeline_response, deserialized, {}) return deserialized + get_by_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/replicationLinks/{linkId}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_restore_points_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_restore_points_operations.py index aed1e22d0e794..9d2a59936d55d 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_restore_points_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_restore_points_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + restore_point_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints/{restorePointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + restore_point_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints/{restorePointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "restorePointName": _SERIALIZER.url("restore_point_name", restore_point_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) class SqlPoolRestorePointsOperations(object): """SqlPoolRestorePointsOperations operations. @@ -47,14 +205,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RestorePointListResult"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> Iterable["_models.RestorePointListResult"]: """Get SQL pool backup. Get SQL pool backup information. @@ -66,7 +224,8 @@ def list( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RestorePointListResult or the result of cls(response) + :return: An iterator like instance of either RestorePointListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.RestorePointListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -75,37 +234,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RestorePointListResult', pipeline_response) + deserialized = self._deserialize("RestorePointListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,12 +275,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -131,45 +289,34 @@ def get_next(next_link=None): def _create_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - parameters, # type: "_models.CreateSqlPoolRestorePointDefinition" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.RestorePoint"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + parameters: "_models.CreateSqlPoolRestorePointDefinition", + **kwargs: Any + ) -> Optional["_models.RestorePoint"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.RestorePoint"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'CreateSqlPoolRestorePointDefinition') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'CreateSqlPoolRestorePointDefinition') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -188,17 +335,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - parameters, # type: "_models.CreateSqlPoolRestorePointDefinition" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.RestorePoint"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + parameters: "_models.CreateSqlPoolRestorePointDefinition", + **kwargs: Any + ) -> LROPoller["_models.RestorePoint"]: """Creates a restore point for a data warehouse. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -211,15 +360,19 @@ def begin_create( :type parameters: ~azure.mgmt.synapse.models.CreateSqlPoolRestorePointDefinition :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either RestorePoint or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either RestorePoint or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.RestorePoint] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -232,28 +385,21 @@ def begin_create( workspace_name=workspace_name, sql_pool_name=sql_pool_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('RestorePoint', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -265,17 +411,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - restore_point_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RestorePoint" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + restore_point_name: str, + **kwargs: Any + ) -> "_models.RestorePoint": """Gets a restore point. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -296,29 +443,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + restore_point_name=restore_point_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -332,17 +469,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints/{restorePointName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - restore_point_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + restore_point_name: str, + **kwargs: Any + ) -> None: """Deletes a restore point. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -363,27 +502,19 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'restorePointName': self._serialize.url("restore_point_name", restore_point_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + restore_point_name=restore_point_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -395,3 +526,4 @@ def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints/{restorePointName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_schemas_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_schemas_operations.py index a9c06a6576bca..64e91068aad51 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_schemas_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_schemas_operations.py @@ -5,23 +5,105 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "schemaName": _SERIALIZER.url("schema_name", schema_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SqlPoolSchemasOperations(object): """SqlPoolSchemasOperations operations. @@ -45,15 +127,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SqlPoolSchemaListResult"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.SqlPoolSchemaListResult"]: """Gets schemas of a given SQL pool. Gets schemas of a given SQL pool. @@ -67,7 +149,8 @@ def list( :param filter: An OData filter expression that filters elements in the collection. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlPoolSchemaListResult or the result of cls(response) + :return: An iterator like instance of either SqlPoolSchemaListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.SqlPoolSchemaListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -76,39 +159,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + filter=filter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SqlPoolSchemaListResult', pipeline_response) + deserialized = self._deserialize("SqlPoolSchemaListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -126,20 +207,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - schema_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SqlPoolSchema" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + **kwargs: Any + ) -> "_models.SqlPoolSchema": """Get Sql Pool schema. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -160,29 +242,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -196,4 +268,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_security_alert_policies_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_security_alert_policies_operations.py index bff79f290ab6e..536ce0b32b0ef 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_security_alert_policies_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_security_alert_policies_operations.py @@ -5,23 +5,150 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies/{securityAlertPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "securityAlertPolicyName": _SERIALIZER.url("security_alert_policy_name", security_alert_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies/{securityAlertPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "securityAlertPolicyName": _SERIALIZER.url("security_alert_policy_name", security_alert_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class SqlPoolSecurityAlertPoliciesOperations(object): """SqlPoolSecurityAlertPoliciesOperations operations. @@ -45,14 +172,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListSqlPoolSecurityAlertPolicies"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> Iterable["_models.ListSqlPoolSecurityAlertPolicies"]: """List Sql pool's security alert policies. Get a list of Sql pool's security alert policies. @@ -64,8 +191,10 @@ def list( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ListSqlPoolSecurityAlertPolicies or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.ListSqlPoolSecurityAlertPolicies] + :return: An iterator like instance of either ListSqlPoolSecurityAlertPolicies or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.ListSqlPoolSecurityAlertPolicies] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListSqlPoolSecurityAlertPolicies"] @@ -73,37 +202,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ListSqlPoolSecurityAlertPolicies', pipeline_response) + deserialized = self._deserialize("ListSqlPoolSecurityAlertPolicies", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -121,20 +248,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - security_alert_policy_name, # type: Union[str, "_models.SecurityAlertPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.SqlPoolSecurityAlertPolicy" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyName"], + **kwargs: Any + ) -> "_models.SqlPoolSecurityAlertPolicy": """Get a Sql pool's security alert policy. Get a Sql pool's security alert policy. @@ -157,29 +285,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'securityAlertPolicyName': self._serialize.url("security_alert_policy_name", security_alert_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + security_alert_policy_name=security_alert_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -193,18 +311,20 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies/{securityAlertPolicyName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - security_alert_policy_name, # type: Union[str, "_models.SecurityAlertPolicyName"] - parameters, # type: "_models.SqlPoolSecurityAlertPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.SqlPoolSecurityAlertPolicy" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyName"], + parameters: "_models.SqlPoolSecurityAlertPolicy", + **kwargs: Any + ) -> "_models.SqlPoolSecurityAlertPolicy": """Create or update a Sql pool's security alert policy. Create or update a Sql pool's security alert policy. @@ -229,34 +349,24 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'securityAlertPolicyName': self._serialize.url("security_alert_policy_name", security_alert_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'SqlPoolSecurityAlertPolicy') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + security_alert_policy_name=security_alert_policy_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SqlPoolSecurityAlertPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -274,4 +384,6 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies/{securityAlertPolicyName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_sensitivity_labels_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_sensitivity_labels_operations.py index a578e9dd39658..25b7607c8d1fd 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_sensitivity_labels_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_sensitivity_labels_operations.py @@ -5,23 +5,374 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_current_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/currentSensitivityLabels') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/currentSensitivityLabels') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_recommended_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + *, + include_disabled_recommendations: Optional[bool] = None, + skip_token: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/recommendedSensitivityLabels') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if include_disabled_recommendations is not None: + query_parameters['includeDisabledRecommendations'] = _SERIALIZER.query("include_disabled_recommendations", include_disabled_recommendations, 'bool') + if skip_token is not None: + query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + table_name: str, + column_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + sensitivity_label_source = "current" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "schemaName": _SERIALIZER.url("schema_name", schema_name, 'str'), + "tableName": _SERIALIZER.url("table_name", table_name, 'str'), + "columnName": _SERIALIZER.url("column_name", column_name, 'str'), + "sensitivityLabelSource": _SERIALIZER.url("sensitivity_label_source", sensitivity_label_source, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + table_name: str, + column_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + sensitivity_label_source = "current" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "schemaName": _SERIALIZER.url("schema_name", schema_name, 'str'), + "tableName": _SERIALIZER.url("table_name", table_name, 'str'), + "columnName": _SERIALIZER.url("column_name", column_name, 'str'), + "sensitivityLabelSource": _SERIALIZER.url("sensitivity_label_source", sensitivity_label_source, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + table_name: str, + column_name: str, + sensitivity_label_source: Union[str, "_models.SensitivityLabelSource"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "schemaName": _SERIALIZER.url("schema_name", schema_name, 'str'), + "tableName": _SERIALIZER.url("table_name", table_name, 'str'), + "columnName": _SERIALIZER.url("column_name", column_name, 'str'), + "sensitivityLabelSource": _SERIALIZER.url("sensitivity_label_source", sensitivity_label_source, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_enable_recommendation_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + table_name: str, + column_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + sensitivity_label_source = "recommended" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "schemaName": _SERIALIZER.url("schema_name", schema_name, 'str'), + "tableName": _SERIALIZER.url("table_name", table_name, 'str'), + "columnName": _SERIALIZER.url("column_name", column_name, 'str'), + "sensitivityLabelSource": _SERIALIZER.url("sensitivity_label_source", sensitivity_label_source, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_disable_recommendation_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + table_name: str, + column_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + sensitivity_label_source = "recommended" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "schemaName": _SERIALIZER.url("schema_name", schema_name, 'str'), + "tableName": _SERIALIZER.url("table_name", table_name, 'str'), + "columnName": _SERIALIZER.url("column_name", column_name, 'str'), + "sensitivityLabelSource": _SERIALIZER.url("sensitivity_label_source", sensitivity_label_source, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class SqlPoolSensitivityLabelsOperations(object): """SqlPoolSensitivityLabelsOperations operations. @@ -45,15 +396,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_current( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SensitivityLabelListResult"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.SensitivityLabelListResult"]: """Gets SQL pool sensitivity labels. Gets SQL pool sensitivity labels. @@ -67,7 +418,8 @@ def list_current( :param filter: An OData filter expression that filters elements in the collection. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SensitivityLabelListResult or the result of cls(response) + :return: An iterator like instance of either SensitivityLabelListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.SensitivityLabelListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -76,39 +428,37 @@ def list_current( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_current.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_current_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + filter=filter, + template_url=self.list_current.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_current_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SensitivityLabelListResult', pipeline_response) + deserialized = self._deserialize("SensitivityLabelListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -121,26 +471,27 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_current.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/currentSensitivityLabels'} # type: ignore + @distributed_trace def update( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - parameters, # type: "_models.SensitivityLabelUpdateList" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + parameters: "_models.SensitivityLabelUpdateList", + **kwargs: Any + ) -> None: """Update sensitivity labels of a given SQL Pool using an operations batch. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -161,31 +512,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(parameters, 'SensitivityLabelUpdateList') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SensitivityLabelUpdateList') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -198,17 +541,18 @@ def update( update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/currentSensitivityLabels'} # type: ignore + + @distributed_trace def list_recommended( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - include_disabled_recommendations=None, # type: Optional[bool] - skip_token=None, # type: Optional[str] - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SensitivityLabelListResult"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + include_disabled_recommendations: Optional[bool] = None, + skip_token: Optional[str] = None, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.SensitivityLabelListResult"]: """Gets sensitivity labels of a given SQL pool. Gets sensitivity labels of a given SQL pool. @@ -228,7 +572,8 @@ def list_recommended( :param filter: An OData filter expression that filters elements in the collection. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SensitivityLabelListResult or the result of cls(response) + :return: An iterator like instance of either SensitivityLabelListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.SensitivityLabelListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -237,43 +582,41 @@ def list_recommended( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_recommended.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if include_disabled_recommendations is not None: - query_parameters['includeDisabledRecommendations'] = self._serialize.query("include_disabled_recommendations", include_disabled_recommendations, 'bool') - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_recommended_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + include_disabled_recommendations=include_disabled_recommendations, + skip_token=skip_token, + filter=filter, + template_url=self.list_recommended.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_recommended_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + include_disabled_recommendations=include_disabled_recommendations, + skip_token=skip_token, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SensitivityLabelListResult', pipeline_response) + deserialized = self._deserialize("SensitivityLabelListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -291,23 +634,24 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_recommended.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/recommendedSensitivityLabels'} # type: ignore + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - schema_name, # type: str - table_name, # type: str - column_name, # type: str - parameters, # type: "_models.SensitivityLabel" - **kwargs # type: Any - ): - # type: (...) -> "_models.SensitivityLabel" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + table_name: str, + column_name: str, + parameters: "_models.SensitivityLabel", + **kwargs: Any + ) -> "_models.SensitivityLabel": """Creates or updates the sensitivity label of a given column in a Sql pool. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -334,38 +678,26 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - sensitivity_label_source = "current" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), - 'tableName': self._serialize.url("table_name", table_name, 'str'), - 'columnName': self._serialize.url("column_name", column_name, 'str'), - 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SensitivityLabel') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + table_name=table_name, + column_name=column_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SensitivityLabel') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -383,19 +715,21 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - schema_name, # type: str - table_name, # type: str - column_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + table_name: str, + column_name: str, + **kwargs: Any + ) -> None: """Deletes the sensitivity label of a given column in a Sql pool. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -420,31 +754,21 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - sensitivity_label_source = "current" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), - 'tableName': self._serialize.url("table_name", table_name, 'str'), - 'columnName': self._serialize.url("column_name", column_name, 'str'), - 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + table_name=table_name, + column_name=column_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -457,18 +781,19 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - schema_name, # type: str - table_name, # type: str - column_name, # type: str - sensitivity_label_source, # type: Union[str, "_models.SensitivityLabelSource"] - **kwargs # type: Any - ): - # type: (...) -> "_models.SensitivityLabel" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + table_name: str, + column_name: str, + sensitivity_label_source: Union[str, "_models.SensitivityLabelSource"], + **kwargs: Any + ) -> "_models.SensitivityLabel": """Gets the sensitivity label of a given column. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -495,32 +820,22 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), - 'tableName': self._serialize.url("table_name", table_name, 'str'), - 'columnName': self._serialize.url("column_name", column_name, 'str'), - 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + table_name=table_name, + column_name=column_name, + sensitivity_label_source=sensitivity_label_source, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -534,19 +849,21 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}'} # type: ignore + + @distributed_trace def enable_recommendation( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - schema_name, # type: str - table_name, # type: str - column_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + table_name: str, + column_name: str, + **kwargs: Any + ) -> None: """Enables sensitivity recommendations on a given column (recommendations are enabled by default on all columns). @@ -572,31 +889,21 @@ def enable_recommendation( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - sensitivity_label_source = "recommended" - - # Construct URL - url = self.enable_recommendation.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), - 'tableName': self._serialize.url("table_name", table_name, 'str'), - 'columnName': self._serialize.url("column_name", column_name, 'str'), - 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_enable_recommendation_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + table_name=table_name, + column_name=column_name, + template_url=self.enable_recommendation.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -609,17 +916,18 @@ def enable_recommendation( enable_recommendation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable'} # type: ignore + + @distributed_trace def disable_recommendation( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - schema_name, # type: str - table_name, # type: str - column_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + table_name: str, + column_name: str, + **kwargs: Any + ) -> None: """Disables sensitivity recommendations on a given column. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -644,31 +952,21 @@ def disable_recommendation( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - sensitivity_label_source = "recommended" - - # Construct URL - url = self.disable_recommendation.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), - 'tableName': self._serialize.url("table_name", table_name, 'str'), - 'columnName': self._serialize.url("column_name", column_name, 'str'), - 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_disable_recommendation_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + table_name=table_name, + column_name=column_name, + template_url=self.disable_recommendation.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -680,3 +978,4 @@ def disable_recommendation( return cls(pipeline_response, None, {}) disable_recommendation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_table_columns_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_table_columns_operations.py index 1c5a59d4eab64..bfa7e7019dc59 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_table_columns_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_table_columns_operations.py @@ -5,23 +5,70 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_table_name_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + table_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "schemaName": _SERIALIZER.url("schema_name", schema_name, 'str'), + "tableName": _SERIALIZER.url("table_name", table_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SqlPoolTableColumnsOperations(object): """SqlPoolTableColumnsOperations operations. @@ -45,17 +92,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_table_name( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - schema_name, # type: str - table_name, # type: str - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SqlPoolColumnListResult"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + table_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.SqlPoolColumnListResult"]: """Gets columns in a given table in a SQL pool. Gets columns in a given table in a SQL pool. @@ -73,7 +120,8 @@ def list_by_table_name( :param filter: An OData filter expression that filters elements in the collection. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlPoolColumnListResult or the result of cls(response) + :return: An iterator like instance of either SqlPoolColumnListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.SqlPoolColumnListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -82,41 +130,41 @@ def list_by_table_name( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_table_name.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), - 'tableName': self._serialize.url("table_name", table_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_table_name_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + table_name=table_name, + filter=filter, + template_url=self.list_by_table_name.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_table_name_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + table_name=table_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SqlPoolColumnListResult', pipeline_response) + deserialized = self._deserialize("SqlPoolColumnListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -134,6 +182,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_tables_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_tables_operations.py index 92f928ddd9e43..f5818cd068231 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_tables_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_tables_operations.py @@ -5,23 +5,109 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_list_by_schema_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "schemaName": _SERIALIZER.url("schema_name", schema_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + table_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "schemaName": _SERIALIZER.url("schema_name", schema_name, 'str'), + "tableName": _SERIALIZER.url("table_name", table_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SqlPoolTablesOperations(object): """SqlPoolTablesOperations operations. @@ -45,16 +131,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_schema( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - schema_name, # type: str - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SqlPoolTableListResult"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.SqlPoolTableListResult"]: """Gets tables of a given schema in a SQL pool. Gets tables of a given schema in a SQL pool. @@ -70,7 +156,8 @@ def list_by_schema( :param filter: An OData filter expression that filters elements in the collection. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlPoolTableListResult or the result of cls(response) + :return: An iterator like instance of either SqlPoolTableListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.SqlPoolTableListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -79,40 +166,39 @@ def list_by_schema( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_schema.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_schema_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + filter=filter, + template_url=self.list_by_schema.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_schema_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SqlPoolTableListResult', pipeline_response) + deserialized = self._deserialize("SqlPoolTableListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -130,21 +216,22 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_schema.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - schema_name, # type: str - table_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SqlPoolTable" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + table_name: str, + **kwargs: Any + ) -> "_models.SqlPoolTable": """Get Sql pool table. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -167,30 +254,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), - 'tableName': self._serialize.url("table_name", table_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + schema_name=schema_name, + table_name=table_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -204,4 +281,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_transparent_data_encryptions_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_transparent_data_encryptions_operations.py index f62cc694fb095..a863332ad4e07 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_transparent_data_encryptions_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_transparent_data_encryptions_operations.py @@ -5,23 +5,150 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + transparent_data_encryption_name: Union[str, "_models.TransparentDataEncryptionName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption/{transparentDataEncryptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "transparentDataEncryptionName": _SERIALIZER.url("transparent_data_encryption_name", transparent_data_encryption_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + transparent_data_encryption_name: Union[str, "_models.TransparentDataEncryptionName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption/{transparentDataEncryptionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "transparentDataEncryptionName": _SERIALIZER.url("transparent_data_encryption_name", transparent_data_encryption_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SqlPoolTransparentDataEncryptionsOperations(object): """SqlPoolTransparentDataEncryptionsOperations operations. @@ -45,15 +172,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - transparent_data_encryption_name, # type: Union[str, "_models.TransparentDataEncryptionName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.TransparentDataEncryption" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + transparent_data_encryption_name: Union[str, "_models.TransparentDataEncryptionName"], + **kwargs: Any + ) -> "_models.TransparentDataEncryption": """Get a SQL pool's transparent data encryption configuration. Get a SQL pool's transparent data encryption configuration. @@ -66,7 +193,8 @@ def get( :type sql_pool_name: str :param transparent_data_encryption_name: The name of the transparent data encryption configuration. - :type transparent_data_encryption_name: str or ~azure.mgmt.synapse.models.TransparentDataEncryptionName + :type transparent_data_encryption_name: str or + ~azure.mgmt.synapse.models.TransparentDataEncryptionName :keyword callable cls: A custom type or function that will be passed the direct response :return: TransparentDataEncryption, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.TransparentDataEncryption @@ -77,35 +205,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'transparentDataEncryptionName': self._serialize.url("transparent_data_encryption_name", transparent_data_encryption_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + transparent_data_encryption_name=transparent_data_encryption_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TransparentDataEncryption', pipeline_response) @@ -114,18 +232,20 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption/{transparentDataEncryptionName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - transparent_data_encryption_name, # type: Union[str, "_models.TransparentDataEncryptionName"] - parameters, # type: "_models.TransparentDataEncryption" - **kwargs # type: Any - ): - # type: (...) -> "_models.TransparentDataEncryption" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + transparent_data_encryption_name: Union[str, "_models.TransparentDataEncryptionName"], + parameters: "_models.TransparentDataEncryption", + **kwargs: Any + ) -> "_models.TransparentDataEncryption": """Creates or updates a Sql pool's transparent data encryption configuration. Creates or updates a Sql pool's transparent data encryption configuration. @@ -138,7 +258,8 @@ def create_or_update( :type sql_pool_name: str :param transparent_data_encryption_name: The name of the transparent data encryption configuration. - :type transparent_data_encryption_name: str or ~azure.mgmt.synapse.models.TransparentDataEncryptionName + :type transparent_data_encryption_name: str or + ~azure.mgmt.synapse.models.TransparentDataEncryptionName :param parameters: The required parameters for creating or updating transparent data encryption. :type parameters: ~azure.mgmt.synapse.models.TransparentDataEncryption @@ -152,40 +273,30 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'transparentDataEncryptionName': self._serialize.url("transparent_data_encryption_name", transparent_data_encryption_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'TransparentDataEncryption') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + transparent_data_encryption_name=transparent_data_encryption_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'TransparentDataEncryption') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -198,16 +309,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption/{transparentDataEncryptionName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TransparentDataEncryptionListResult"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> Iterable["_models.TransparentDataEncryptionListResult"]: """SQL pool's transparent data encryption configurations. Get list of SQL pool's transparent data encryption configurations. @@ -219,8 +332,10 @@ def list( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TransparentDataEncryptionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.TransparentDataEncryptionListResult] + :return: An iterator like instance of either TransparentDataEncryptionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.TransparentDataEncryptionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TransparentDataEncryptionListResult"] @@ -228,37 +343,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TransparentDataEncryptionListResult', pipeline_response) + deserialized = self._deserialize("TransparentDataEncryptionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -276,6 +389,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_usages_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_usages_operations.py index 698747315541b..331d2365ea93f 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_usages_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_usages_operations.py @@ -5,23 +5,62 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/usages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SqlPoolUsagesOperations(object): """SqlPoolUsagesOperations operations. @@ -45,14 +84,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SqlPoolUsageListResult"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> Iterable["_models.SqlPoolUsageListResult"]: """Gets SQL pool usages. Gets SQL pool usages. @@ -64,7 +103,8 @@ def list( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlPoolUsageListResult or the result of cls(response) + :return: An iterator like instance of either SqlPoolUsageListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.SqlPoolUsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -73,37 +113,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SqlPoolUsageListResult', pipeline_response) + deserialized = self._deserialize("SqlPoolUsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,12 +154,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_vulnerability_assessment_rule_baselines_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_vulnerability_assessment_rule_baselines_operations.py index c3c71fa513ea2..11b21462a362f 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_vulnerability_assessment_rule_baselines_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_vulnerability_assessment_rule_baselines_operations.py @@ -5,22 +5,157 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + rule_id: str, + baseline_name: Union[str, "_models.VulnerabilityAssessmentPolicyBaselineName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "vulnerabilityAssessmentName": _SERIALIZER.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), + "ruleId": _SERIALIZER.url("rule_id", rule_id, 'str'), + "baselineName": _SERIALIZER.url("baseline_name", baseline_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + rule_id: str, + baseline_name: Union[str, "_models.VulnerabilityAssessmentPolicyBaselineName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "vulnerabilityAssessmentName": _SERIALIZER.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), + "ruleId": _SERIALIZER.url("rule_id", rule_id, 'str'), + "baselineName": _SERIALIZER.url("baseline_name", baseline_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + rule_id: str, + baseline_name: Union[str, "_models.VulnerabilityAssessmentPolicyBaselineName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "vulnerabilityAssessmentName": _SERIALIZER.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), + "ruleId": _SERIALIZER.url("rule_id", rule_id, 'str'), + "baselineName": _SERIALIZER.url("baseline_name", baseline_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SqlPoolVulnerabilityAssessmentRuleBaselinesOperations(object): """SqlPoolVulnerabilityAssessmentRuleBaselinesOperations operations. @@ -44,18 +179,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - vulnerability_assessment_name, # type: Union[str, "_models.VulnerabilityAssessmentName"] - rule_id, # type: str - baseline_name, # type: Union[str, "_models.VulnerabilityAssessmentPolicyBaselineName"] - parameters, # type: "_models.SqlPoolVulnerabilityAssessmentRuleBaseline" - **kwargs # type: Any - ): - # type: (...) -> "_models.SqlPoolVulnerabilityAssessmentRuleBaseline" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + rule_id: str, + baseline_name: Union[str, "_models.VulnerabilityAssessmentPolicyBaselineName"], + parameters: "_models.SqlPoolVulnerabilityAssessmentRuleBaseline", + **kwargs: Any + ) -> "_models.SqlPoolVulnerabilityAssessmentRuleBaseline": """Creates or updates a Sql pool's vulnerability assessment rule baseline. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -65,12 +200,14 @@ def create_or_update( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :param rule_id: The vulnerability assessment rule ID. :type rule_id: str :param baseline_name: The name of the vulnerability assessment rule baseline (default implies a baseline on a Sql pool level rule and master for workspace level rule). - :type baseline_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentPolicyBaselineName + :type baseline_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentPolicyBaselineName :param parameters: The requested rule baseline resource. :type parameters: ~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessmentRuleBaseline :keyword callable cls: A custom type or function that will be passed the direct response @@ -83,36 +220,26 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), - 'baselineName': self._serialize.url("baseline_name", baseline_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'SqlPoolVulnerabilityAssessmentRuleBaseline') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + vulnerability_assessment_name=vulnerability_assessment_name, + rule_id=rule_id, + baseline_name=baseline_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SqlPoolVulnerabilityAssessmentRuleBaseline') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -126,19 +253,21 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - vulnerability_assessment_name, # type: Union[str, "_models.VulnerabilityAssessmentName"] - rule_id, # type: str - baseline_name, # type: Union[str, "_models.VulnerabilityAssessmentPolicyBaselineName"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + rule_id: str, + baseline_name: Union[str, "_models.VulnerabilityAssessmentPolicyBaselineName"], + **kwargs: Any + ) -> None: """Removes the database's vulnerability assessment rule baseline. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -148,12 +277,14 @@ def delete( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :param rule_id: The vulnerability assessment rule ID. :type rule_id: str :param baseline_name: The name of the vulnerability assessment rule baseline (default implies a baseline on a Sql pool level rule and master for workspace level rule). - :type baseline_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentPolicyBaselineName + :type baseline_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentPolicyBaselineName :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -164,29 +295,21 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), - 'baselineName': self._serialize.url("baseline_name", baseline_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + vulnerability_assessment_name=vulnerability_assessment_name, + rule_id=rule_id, + baseline_name=baseline_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -199,17 +322,18 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - vulnerability_assessment_name, # type: Union[str, "_models.VulnerabilityAssessmentName"] - rule_id, # type: str - baseline_name, # type: Union[str, "_models.VulnerabilityAssessmentPolicyBaselineName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.SqlPoolVulnerabilityAssessmentRuleBaseline" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + rule_id: str, + baseline_name: Union[str, "_models.VulnerabilityAssessmentPolicyBaselineName"], + **kwargs: Any + ) -> "_models.SqlPoolVulnerabilityAssessmentRuleBaseline": """Gets a SqlPool's vulnerability assessment rule baseline. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -219,12 +343,14 @@ def get( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :param rule_id: The vulnerability assessment rule ID. :type rule_id: str :param baseline_name: The name of the vulnerability assessment rule baseline (default implies a baseline on a Sql pool level rule and master for server level rule). - :type baseline_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentPolicyBaselineName + :type baseline_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentPolicyBaselineName :keyword callable cls: A custom type or function that will be passed the direct response :return: SqlPoolVulnerabilityAssessmentRuleBaseline, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessmentRuleBaseline @@ -235,31 +361,21 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - 'ruleId': self._serialize.url("rule_id", rule_id, 'str'), - 'baselineName': self._serialize.url("baseline_name", baseline_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + vulnerability_assessment_name=vulnerability_assessment_name, + rule_id=rule_id, + baseline_name=baseline_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -273,4 +389,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_vulnerability_assessment_scans_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_vulnerability_assessment_scans_operations.py index 0b5f37c5ecb99..67dd4951b20f0 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_vulnerability_assessment_scans_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_vulnerability_assessment_scans_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "vulnerabilityAssessmentName": _SERIALIZER.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_initiate_scan_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + scan_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "vulnerabilityAssessmentName": _SERIALIZER.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), + "scanId": _SERIALIZER.url("scan_id", scan_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_export_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + scan_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "vulnerabilityAssessmentName": _SERIALIZER.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), + "scanId": _SERIALIZER.url("scan_id", scan_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + scan_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "vulnerabilityAssessmentName": _SERIALIZER.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), + "scanId": _SERIALIZER.url("scan_id", scan_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SqlPoolVulnerabilityAssessmentScansOperations(object): """SqlPoolVulnerabilityAssessmentScansOperations operations. @@ -47,15 +205,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - vulnerability_assessment_name, # type: Union[str, "_models.VulnerabilityAssessmentName"] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VulnerabilityAssessmentScanRecordListResult"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + **kwargs: Any + ) -> Iterable["_models.VulnerabilityAssessmentScanRecordListResult"]: """Lists the vulnerability assessment scans of a SQL pool. Lists the vulnerability assessment scans of a SQL pool. @@ -67,10 +225,13 @@ def list( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either VulnerabilityAssessmentScanRecordListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.VulnerabilityAssessmentScanRecordListResult] + :return: An iterator like instance of either VulnerabilityAssessmentScanRecordListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.VulnerabilityAssessmentScanRecordListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VulnerabilityAssessmentScanRecordListResult"] @@ -78,38 +239,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + vulnerability_assessment_name=vulnerability_assessment_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + vulnerability_assessment_name=vulnerability_assessment_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VulnerabilityAssessmentScanRecordListResult', pipeline_response) + deserialized = self._deserialize("VulnerabilityAssessmentScanRecordListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -127,6 +287,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -134,41 +295,32 @@ def get_next(next_link=None): def _initiate_scan_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - vulnerability_assessment_name, # type: Union[str, "_models.VulnerabilityAssessmentName"] - scan_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + scan_id: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._initiate_scan_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - 'scanId': self._serialize.url("scan_id", scan_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_initiate_scan_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + vulnerability_assessment_name=vulnerability_assessment_name, + scan_id=scan_id, + template_url=self._initiate_scan_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,16 +333,17 @@ def _initiate_scan_initial( _initiate_scan_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan'} # type: ignore + + @distributed_trace def begin_initiate_scan( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - vulnerability_assessment_name, # type: Union[str, "_models.VulnerabilityAssessmentName"] - scan_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + scan_id: str, + **kwargs: Any + ) -> LROPoller[None]: """Executes a Vulnerability Assessment database scan. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -200,20 +353,23 @@ def begin_initiate_scan( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :param scan_id: The vulnerability assessment scan Id of the scan to retrieve. :type scan_id: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -230,24 +386,14 @@ def begin_initiate_scan( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - 'scanId': self._serialize.url("scan_id", scan_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -259,18 +405,19 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_initiate_scan.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan'} # type: ignore + @distributed_trace def export( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - vulnerability_assessment_name, # type: Union[str, "_models.VulnerabilityAssessmentName"] - scan_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SqlPoolVulnerabilityAssessmentScansExport" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + scan_id: str, + **kwargs: Any + ) -> "_models.SqlPoolVulnerabilityAssessmentScansExport": """Convert an existing scan result to a human readable format. If already exists nothing happens. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -280,7 +427,8 @@ def export( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :param scan_id: The vulnerability assessment scan Id of the scan to retrieve. :type scan_id: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -293,30 +441,20 @@ def export( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.export.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - 'scanId': self._serialize.url("scan_id", scan_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_export_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + vulnerability_assessment_name=vulnerability_assessment_name, + scan_id=scan_id, + template_url=self.export.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -334,18 +472,20 @@ def export( return cls(pipeline_response, deserialized, {}) return deserialized + export.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/export'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - vulnerability_assessment_name, # type: Union[str, "_models.VulnerabilityAssessmentName"] - scan_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VulnerabilityAssessmentScanRecord" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + scan_id: str, + **kwargs: Any + ) -> "_models.VulnerabilityAssessmentScanRecord": """Gets a vulnerability assessment scan record of a Sql pool. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -355,7 +495,8 @@ def get( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :param scan_id: The vulnerability assessment scan Id of the scan to retrieve. :type scan_id: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -368,30 +509,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - 'scanId': self._serialize.url("scan_id", scan_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + vulnerability_assessment_name=vulnerability_assessment_name, + scan_id=scan_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -405,4 +536,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_vulnerability_assessments_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_vulnerability_assessments_operations.py index 09ada4bf2fdec..e39ed9c3fabe5 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_vulnerability_assessments_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_vulnerability_assessments_operations.py @@ -5,23 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "vulnerabilityAssessmentName": _SERIALIZER.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "vulnerabilityAssessmentName": _SERIALIZER.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "vulnerabilityAssessmentName": _SERIALIZER.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) class SqlPoolVulnerabilityAssessmentsOperations(object): """SqlPoolVulnerabilityAssessmentsOperations operations. @@ -45,14 +205,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SqlPoolVulnerabilityAssessmentListResult"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> Iterable["_models.SqlPoolVulnerabilityAssessmentListResult"]: """Lists the vulnerability assessment policies associated with a SQL pool. Lists the vulnerability assessment policies associated with a SQL pool. @@ -64,8 +224,10 @@ def list( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlPoolVulnerabilityAssessmentListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessmentListResult] + :return: An iterator like instance of either SqlPoolVulnerabilityAssessmentListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolVulnerabilityAssessmentListResult"] @@ -73,37 +235,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SqlPoolVulnerabilityAssessmentListResult', pipeline_response) + deserialized = self._deserialize("SqlPoolVulnerabilityAssessmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -121,20 +281,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - vulnerability_assessment_name, # type: Union[str, "_models.VulnerabilityAssessmentName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.SqlPoolVulnerabilityAssessment" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + **kwargs: Any + ) -> "_models.SqlPoolVulnerabilityAssessment": """Gets the Sql pool's vulnerability assessment. Gets the Sql pool's vulnerability assessment. @@ -146,7 +307,8 @@ def get( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :keyword callable cls: A custom type or function that will be passed the direct response :return: SqlPoolVulnerabilityAssessment, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessment @@ -157,29 +319,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + vulnerability_assessment_name=vulnerability_assessment_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -193,18 +345,20 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - vulnerability_assessment_name, # type: Union[str, "_models.VulnerabilityAssessmentName"] - parameters, # type: "_models.SqlPoolVulnerabilityAssessment" - **kwargs # type: Any - ): - # type: (...) -> "_models.SqlPoolVulnerabilityAssessment" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + parameters: "_models.SqlPoolVulnerabilityAssessment", + **kwargs: Any + ) -> "_models.SqlPoolVulnerabilityAssessment": """Creates or updates the Sql pool vulnerability assessment. Creates or updates the Sql pool vulnerability assessment. @@ -216,7 +370,8 @@ def create_or_update( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :param parameters: The requested resource. :type parameters: ~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessment :keyword callable cls: A custom type or function that will be passed the direct response @@ -229,34 +384,24 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'SqlPoolVulnerabilityAssessment') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + vulnerability_assessment_name=vulnerability_assessment_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SqlPoolVulnerabilityAssessment') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -274,17 +419,19 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - vulnerability_assessment_name, # type: Union[str, "_models.VulnerabilityAssessmentName"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + **kwargs: Any + ) -> None: """Removes the database's vulnerability assessment. Removes the database's vulnerability assessment. @@ -296,7 +443,8 @@ def delete( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -307,27 +455,19 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + vulnerability_assessment_name=vulnerability_assessment_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -339,3 +479,4 @@ def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_workload_classifier_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_workload_classifier_operations.py index ee91378f91e19..d76d5abfadc35 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_workload_classifier_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_workload_classifier_operations.py @@ -5,25 +5,193 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + workload_classifier_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "workloadGroupName": _SERIALIZER.url("workload_group_name", workload_group_name, 'str'), + "workloadClassifierName": _SERIALIZER.url("workload_classifier_name", workload_classifier_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + workload_classifier_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "workloadGroupName": _SERIALIZER.url("workload_group_name", workload_group_name, 'str'), + "workloadClassifierName": _SERIALIZER.url("workload_classifier_name", workload_classifier_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + workload_classifier_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "workloadGroupName": _SERIALIZER.url("workload_group_name", workload_group_name, 'str'), + "workloadClassifierName": _SERIALIZER.url("workload_classifier_name", workload_classifier_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "workloadGroupName": _SERIALIZER.url("workload_group_name", workload_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SqlPoolWorkloadClassifierOperations(object): """SqlPoolWorkloadClassifierOperations operations. @@ -47,16 +215,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - workload_group_name, # type: str - workload_classifier_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.WorkloadClassifier" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + workload_classifier_name: str, + **kwargs: Any + ) -> "_models.WorkloadClassifier": """Get workload classifier. Get a workload classifier of Sql pool's workload group. @@ -81,30 +249,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'workloadGroupName': self._serialize.url("workload_group_name", workload_group_name, 'str'), - 'workloadClassifierName': self._serialize.url("workload_classifier_name", workload_classifier_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + workload_group_name=workload_group_name, + workload_classifier_name=workload_classifier_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -118,53 +276,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - workload_group_name, # type: str - workload_classifier_name, # type: str - parameters, # type: "_models.WorkloadClassifier" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.WorkloadClassifier"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + workload_classifier_name: str, + parameters: "_models.WorkloadClassifier", + **kwargs: Any + ) -> Optional["_models.WorkloadClassifier"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WorkloadClassifier"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'workloadGroupName': self._serialize.url("workload_group_name", workload_group_name, 'str'), - 'workloadClassifierName': self._serialize.url("workload_classifier_name", workload_classifier_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'WorkloadClassifier') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + workload_group_name=workload_group_name, + workload_classifier_name=workload_classifier_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'WorkloadClassifier') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,19 +332,21 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - workload_group_name, # type: str - workload_classifier_name, # type: str - parameters, # type: "_models.WorkloadClassifier" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.WorkloadClassifier"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + workload_classifier_name: str, + parameters: "_models.WorkloadClassifier", + **kwargs: Any + ) -> LROPoller["_models.WorkloadClassifier"]: """Create Or Update workload classifier. Create Or Update workload classifier for a Sql pool's workload group. @@ -214,15 +365,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.synapse.models.WorkloadClassifier :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either WorkloadClassifier or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadClassifier or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.WorkloadClassifier] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadClassifier"] lro_delay = kwargs.pop( 'polling_interval', @@ -237,30 +392,21 @@ def begin_create_or_update( workload_group_name=workload_group_name, workload_classifier_name=workload_classifier_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('WorkloadClassifier', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'workloadGroupName': self._serialize.url("workload_group_name", workload_group_name, 'str'), - 'workloadClassifierName': self._serialize.url("workload_classifier_name", workload_classifier_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -272,45 +418,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - workload_group_name, # type: str - workload_classifier_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + workload_classifier_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'workloadGroupName': self._serialize.url("workload_group_name", workload_group_name, 'str'), - 'workloadClassifierName': self._serialize.url("workload_classifier_name", workload_classifier_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + workload_group_name=workload_group_name, + workload_classifier_name=workload_classifier_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -323,16 +461,17 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - workload_group_name, # type: str - workload_classifier_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + workload_classifier_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Remove workload classifier. Remove workload classifier of a Sql pool's workload group. @@ -349,15 +488,17 @@ def begin_delete( :type workload_classifier_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -374,24 +515,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'workloadGroupName': self._serialize.url("workload_group_name", workload_group_name, 'str'), - 'workloadClassifierName': self._serialize.url("workload_classifier_name", workload_classifier_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -403,17 +534,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - workload_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WorkloadClassifierListResult"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + **kwargs: Any + ) -> Iterable["_models.WorkloadClassifierListResult"]: """Sql pool's workload classifier. Get list of Sql pool's workload classifier for workload groups. @@ -427,7 +559,8 @@ def list( :param workload_group_name: The name of the workload group. :type workload_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadClassifierListResult or the result of cls(response) + :return: An iterator like instance of either WorkloadClassifierListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.WorkloadClassifierListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -436,38 +569,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'workloadGroupName': self._serialize.url("workload_group_name", workload_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + workload_group_name=workload_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + workload_group_name=workload_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('WorkloadClassifierListResult', pipeline_response) + deserialized = self._deserialize("WorkloadClassifierListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -485,6 +617,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_workload_group_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_workload_group_operations.py index d20256b08b9d6..4b3e7f24f2226 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_workload_group_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_workload_group_operations.py @@ -5,25 +5,185 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "workloadGroupName": _SERIALIZER.url("workload_group_name", workload_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "workloadGroupName": _SERIALIZER.url("workload_group_name", workload_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + "workloadGroupName": _SERIALIZER.url("workload_group_name", workload_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SqlPoolWorkloadGroupOperations(object): """SqlPoolWorkloadGroupOperations operations. @@ -47,15 +207,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - workload_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.WorkloadGroup" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + **kwargs: Any + ) -> "_models.WorkloadGroup": """Sql pool's workload group. Get a Sql pool's workload group. @@ -78,29 +238,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'workloadGroupName': self._serialize.url("workload_group_name", workload_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + workload_group_name=workload_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -114,51 +264,42 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - workload_group_name, # type: str - parameters, # type: "_models.WorkloadGroup" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.WorkloadGroup"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + parameters: "_models.WorkloadGroup", + **kwargs: Any + ) -> Optional["_models.WorkloadGroup"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.WorkloadGroup"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'workloadGroupName': self._serialize.url("workload_group_name", workload_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'WorkloadGroup') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + workload_group_name=workload_group_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'WorkloadGroup') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,18 +318,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - workload_group_name, # type: str - parameters, # type: "_models.WorkloadGroup" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.WorkloadGroup"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + parameters: "_models.WorkloadGroup", + **kwargs: Any + ) -> LROPoller["_models.WorkloadGroup"]: """Create Or Update workload group. Create Or Update a Sql pool's workload group. @@ -205,15 +348,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.synapse.models.WorkloadGroup :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either WorkloadGroup or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either WorkloadGroup or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.WorkloadGroup] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadGroup"] lro_delay = kwargs.pop( 'polling_interval', @@ -227,29 +374,21 @@ def begin_create_or_update( sql_pool_name=sql_pool_name, workload_group_name=workload_group_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('WorkloadGroup', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'workloadGroupName': self._serialize.url("workload_group_name", workload_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -261,43 +400,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - workload_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'workloadGroupName': self._serialize.url("workload_group_name", workload_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + workload_group_name=workload_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -310,15 +441,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - workload_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Remove workload group. Remove Sql pool's workload group. @@ -333,15 +465,17 @@ def begin_delete( :type workload_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -357,23 +491,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'workloadGroupName': self._serialize.url("workload_group_name", workload_group_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -385,16 +510,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WorkloadGroupListResult"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> Iterable["_models.WorkloadGroupListResult"]: """Sql pool's workload groups. Get list of Sql pool's workload groups. @@ -406,7 +532,8 @@ def list( :param sql_pool_name: SQL pool name. :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkloadGroupListResult or the result of cls(response) + :return: An iterator like instance of either WorkloadGroupListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.WorkloadGroupListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -415,37 +542,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('WorkloadGroupListResult', pipeline_response) + deserialized = self._deserialize("WorkloadGroupListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -463,6 +588,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pools_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pools_operations.py index e9d75fdfa588a..d51757e3a5239 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pools_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pools_operations.py @@ -5,25 +5,347 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_workspace_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_pause_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/pause') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_resume_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/resume') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_rename_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/move') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class SqlPoolsOperations(object): """SqlPoolsOperations operations. @@ -47,14 +369,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SqlPool" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> "_models.SqlPool": """Get SQL pool. Get SQL pool properties. @@ -75,34 +397,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SqlPool', pipeline_response) @@ -111,17 +423,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - sql_pool_info, # type: "_models.SqlPoolPatchInfo" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.SqlPool"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + sql_pool_info: "_models.SqlPoolPatchInfo", + **kwargs: Any + ) -> Optional["_models.SqlPool"]: """Update SQL pool. Apply a partial update to a SQL pool. @@ -144,39 +458,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(sql_pool_info, 'SqlPoolPatchInfo') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(sql_pool_info, 'SqlPoolPatchInfo') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -187,56 +491,46 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - sql_pool_info, # type: "_models.SqlPool" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.SqlPool"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + sql_pool_info: "_models.SqlPool", + **kwargs: Any + ) -> Optional["_models.SqlPool"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.SqlPool"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(sql_pool_info, 'SqlPool') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(sql_pool_info, 'SqlPool') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 404]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -246,17 +540,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - sql_pool_info, # type: "_models.SqlPool" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.SqlPool"] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + sql_pool_info: "_models.SqlPool", + **kwargs: Any + ) -> LROPoller["_models.SqlPool"]: """Create SQL pool. Create a SQL pool. @@ -271,15 +567,18 @@ def begin_create( :type sql_pool_info: ~azure.mgmt.synapse.models.SqlPool :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either SqlPool or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.SqlPool] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPool"] lro_delay = kwargs.pop( 'polling_interval', @@ -292,28 +591,21 @@ def begin_create( workspace_name=workspace_name, sql_pool_name=sql_pool_name, sql_pool_info=sql_pool_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('SqlPool', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -325,50 +617,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional[Any] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> Optional[Any]: cls = kwargs.pop('cls', None) # type: ClsType[Optional[Any]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -381,16 +662,18 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[Any] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> LROPoller[Any]: """Delete SQL pool. Delete a SQL pool. @@ -403,15 +686,17 @@ def begin_delete( :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either any or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[any] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[Any] lro_delay = kwargs.pop( 'polling_interval', @@ -426,25 +711,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('object', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -456,15 +733,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} # type: ignore + @distributed_trace def list_by_workspace( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SqlPoolInfoListResult"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.SqlPoolInfoListResult"]: """List SQL pools. List all SQL pools. @@ -474,7 +752,8 @@ def list_by_workspace( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SqlPoolInfoListResult or the result of cls(response) + :return: An iterator like instance of either SqlPoolInfoListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.SqlPoolInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -483,36 +762,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SqlPoolInfoListResult', pipeline_response) + deserialized = self._deserialize("SqlPoolInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -525,12 +801,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -538,46 +815,34 @@ def get_next(next_link=None): def _pause_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional[Any] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> Optional[Any]: cls = kwargs.pop('cls', None) # type: ClsType[Optional[Any]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._pause_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_pause_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self._pause_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -587,16 +852,18 @@ def _pause_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _pause_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/pause'} # type: ignore + + @distributed_trace def begin_pause( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[Any] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> LROPoller[Any]: """Pause SQL pool. Pause a SQL pool. @@ -609,15 +876,17 @@ def begin_pause( :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either any or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[any] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[Any] lro_delay = kwargs.pop( 'polling_interval', @@ -632,25 +901,17 @@ def begin_pause( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('object', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -662,50 +923,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_pause.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/pause'} # type: ignore def _resume_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional[Any] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> Optional[Any]: cls = kwargs.pop('cls', None) # type: ClsType[Optional[Any]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._resume_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_resume_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self._resume_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -715,16 +965,18 @@ def _resume_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _resume_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/resume'} # type: ignore + + @distributed_trace def begin_resume( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[Any] + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> LROPoller[Any]: """Resume SQL pool. Resume a SQL pool. @@ -737,15 +989,17 @@ def begin_resume( :type sql_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either any or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[any] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[Any] lro_delay = kwargs.pop( 'polling_interval', @@ -760,25 +1014,17 @@ def begin_resume( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('object', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -790,17 +1036,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_resume.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/resume'} # type: ignore + @distributed_trace def rename( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - parameters, # type: "_models.ResourceMoveDefinition" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + parameters: "_models.ResourceMoveDefinition", + **kwargs: Any + ) -> None: """Rename a SQL pool. Rename a SQL pool. @@ -823,31 +1070,23 @@ def rename( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.rename.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ResourceMoveDefinition') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + request = build_rename_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + content_type=content_type, + json=_json, + template_url=self.rename.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ResourceMoveDefinition') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -859,3 +1098,4 @@ def rename( return cls(pipeline_response, None, {}) rename.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/move'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_aad_admins_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_aad_admins_operations.py index 4c184dee27ad4..fd3427fb161c8 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_aad_admins_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_aad_admins_operations.py @@ -5,24 +5,141 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class WorkspaceAadAdminsOperations(object): """WorkspaceAadAdminsOperations operations. @@ -46,13 +163,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.WorkspaceAadAdminInfo" + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> "_models.WorkspaceAadAdminInfo": """Gets a workspace active directory admin. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -69,33 +186,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) @@ -104,54 +211,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - aad_admin_info, # type: "_models.WorkspaceAadAdminInfo" - **kwargs # type: Any - ): - # type: (...) -> "_models.WorkspaceAadAdminInfo" + resource_group_name: str, + workspace_name: str, + aad_admin_info: "_models.WorkspaceAadAdminInfo", + **kwargs: Any + ) -> "_models.WorkspaceAadAdminInfo": cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceAadAdminInfo"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(aad_admin_info, 'WorkspaceAadAdminInfo') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(aad_admin_info, 'WorkspaceAadAdminInfo') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) @@ -163,16 +260,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - aad_admin_info, # type: "_models.WorkspaceAadAdminInfo" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.WorkspaceAadAdminInfo"] + resource_group_name: str, + workspace_name: str, + aad_admin_info: "_models.WorkspaceAadAdminInfo", + **kwargs: Any + ) -> LROPoller["_models.WorkspaceAadAdminInfo"]: """Creates or updates a workspace active directory admin. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -183,15 +282,19 @@ def begin_create_or_update( :type aad_admin_info: ~azure.mgmt.synapse.models.WorkspaceAadAdminInfo :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either WorkspaceAadAdminInfo or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either WorkspaceAadAdminInfo or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.WorkspaceAadAdminInfo] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceAadAdminInfo"] lro_delay = kwargs.pop( 'polling_interval', @@ -203,27 +306,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, aad_admin_info=aad_admin_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -235,61 +332,51 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a workspace active directory admin. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -298,15 +385,17 @@ def begin_delete( :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -320,21 +409,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -346,4 +428,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_identity_sql_control_settings_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_identity_sql_control_settings_operations.py index 921dc9486f53c..27e791fb0c607 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_identity_sql_control_settings_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_identity_sql_control_settings_operations.py @@ -5,24 +5,106 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/managedIdentitySqlControlSettings/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/managedIdentitySqlControlSettings/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class WorkspaceManagedIdentitySqlControlSettingsOperations(object): """WorkspaceManagedIdentitySqlControlSettingsOperations operations. @@ -46,13 +128,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagedIdentitySqlControlSettingsModel" + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> "_models.ManagedIdentitySqlControlSettingsModel": """Get Managed Identity Sql Control Settings. Get Managed Identity Sql Control Settings. @@ -71,33 +153,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ManagedIdentitySqlControlSettingsModel', pipeline_response) @@ -106,54 +178,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/managedIdentitySqlControlSettings/default'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - managed_identity_sql_control_settings, # type: "_models.ManagedIdentitySqlControlSettingsModel" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ManagedIdentitySqlControlSettingsModel"] + resource_group_name: str, + workspace_name: str, + managed_identity_sql_control_settings: "_models.ManagedIdentitySqlControlSettingsModel", + **kwargs: Any + ) -> Optional["_models.ManagedIdentitySqlControlSettingsModel"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ManagedIdentitySqlControlSettingsModel"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(managed_identity_sql_control_settings, 'ManagedIdentitySqlControlSettingsModel') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(managed_identity_sql_control_settings, 'ManagedIdentitySqlControlSettingsModel') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -163,16 +225,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/managedIdentitySqlControlSettings/default'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - managed_identity_sql_control_settings, # type: "_models.ManagedIdentitySqlControlSettingsModel" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ManagedIdentitySqlControlSettingsModel"] + resource_group_name: str, + workspace_name: str, + managed_identity_sql_control_settings: "_models.ManagedIdentitySqlControlSettingsModel", + **kwargs: Any + ) -> LROPoller["_models.ManagedIdentitySqlControlSettingsModel"]: """Create or update Managed Identity Sql Control Settings. Create or update Managed Identity Sql Control Settings. @@ -182,18 +246,24 @@ def begin_create_or_update( :param workspace_name: The name of the workspace. :type workspace_name: str :param managed_identity_sql_control_settings: Managed Identity Sql Control Settings. - :type managed_identity_sql_control_settings: ~azure.mgmt.synapse.models.ManagedIdentitySqlControlSettingsModel + :type managed_identity_sql_control_settings: + ~azure.mgmt.synapse.models.ManagedIdentitySqlControlSettingsModel :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ManagedIdentitySqlControlSettingsModel or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.ManagedIdentitySqlControlSettingsModel] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedIdentitySqlControlSettingsModel or + the result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.ManagedIdentitySqlControlSettingsModel] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedIdentitySqlControlSettingsModel"] lro_delay = kwargs.pop( 'polling_interval', @@ -205,27 +275,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, managed_identity_sql_control_settings=managed_identity_sql_control_settings, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ManagedIdentitySqlControlSettingsModel', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -237,4 +301,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/managedIdentitySqlControlSettings/default'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_blob_auditing_policies_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_blob_auditing_policies_operations.py index 3843db5ba1305..f46798d2fa9a9 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_blob_auditing_policies_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_blob_auditing_policies_operations.py @@ -5,25 +5,146 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + blob_auditing_policy_name: Union[str, "_models.BlobAuditingPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/auditingSettings/{blobAuditingPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "blobAuditingPolicyName": _SERIALIZER.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + blob_auditing_policy_name: Union[str, "_models.BlobAuditingPolicyName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/auditingSettings/{blobAuditingPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "blobAuditingPolicyName": _SERIALIZER.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_workspace_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/auditingSettings') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class WorkspaceManagedSqlServerBlobAuditingPoliciesOperations(object): """WorkspaceManagedSqlServerBlobAuditingPoliciesOperations operations. @@ -47,14 +168,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - blob_auditing_policy_name, # type: Union[str, "_models.BlobAuditingPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ServerBlobAuditingPolicy" + resource_group_name: str, + workspace_name: str, + blob_auditing_policy_name: Union[str, "_models.BlobAuditingPolicyName"], + **kwargs: Any + ) -> "_models.ServerBlobAuditingPolicy": """Get server's blob auditing policy. Get a workspace managed sql server's blob auditing policy. @@ -75,28 +196,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + blob_auditing_policy_name=blob_auditing_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -110,49 +221,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/auditingSettings/{blobAuditingPolicyName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - blob_auditing_policy_name, # type: Union[str, "_models.BlobAuditingPolicyName"] - parameters, # type: "_models.ServerBlobAuditingPolicy" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ServerBlobAuditingPolicy"] + resource_group_name: str, + workspace_name: str, + blob_auditing_policy_name: Union[str, "_models.BlobAuditingPolicyName"], + parameters: "_models.ServerBlobAuditingPolicy", + **kwargs: Any + ) -> Optional["_models.ServerBlobAuditingPolicy"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ServerBlobAuditingPolicy"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServerBlobAuditingPolicy') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + blob_auditing_policy_name=blob_auditing_policy_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServerBlobAuditingPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -168,17 +270,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/auditingSettings/{blobAuditingPolicyName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - blob_auditing_policy_name, # type: Union[str, "_models.BlobAuditingPolicyName"] - parameters, # type: "_models.ServerBlobAuditingPolicy" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServerBlobAuditingPolicy"] + resource_group_name: str, + workspace_name: str, + blob_auditing_policy_name: Union[str, "_models.BlobAuditingPolicyName"], + parameters: "_models.ServerBlobAuditingPolicy", + **kwargs: Any + ) -> LROPoller["_models.ServerBlobAuditingPolicy"]: """Create or Update server's blob auditing policy. Create or Update a workspace managed sql server's blob auditing policy. @@ -193,15 +297,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.synapse.models.ServerBlobAuditingPolicy :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ServerBlobAuditingPolicy or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServerBlobAuditingPolicy or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.ServerBlobAuditingPolicy] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerBlobAuditingPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +322,21 @@ def begin_create_or_update( workspace_name=workspace_name, blob_auditing_policy_name=blob_auditing_policy_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServerBlobAuditingPolicy', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,15 +348,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/auditingSettings/{blobAuditingPolicyName}'} # type: ignore + @distributed_trace def list_by_workspace( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ServerBlobAuditingPolicyListResult"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.ServerBlobAuditingPolicyListResult"]: """List workspace server's blob auditing policies. List workspace managed sql server's blob auditing policies. @@ -265,8 +367,10 @@ def list_by_workspace( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServerBlobAuditingPolicyListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.ServerBlobAuditingPolicyListResult] + :return: An iterator like instance of either ServerBlobAuditingPolicyListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.ServerBlobAuditingPolicyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerBlobAuditingPolicyListResult"] @@ -274,36 +378,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServerBlobAuditingPolicyListResult', pipeline_response) + deserialized = self._deserialize("ServerBlobAuditingPolicyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -321,6 +422,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_encryption_protector_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_encryption_protector_operations.py index 0d23095af60c2..cf47a4f3a5bfe 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_encryption_protector_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_encryption_protector_operations.py @@ -5,25 +5,177 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + encryption_protector_name: Union[str, "_models.EncryptionProtectorName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/encryptionProtector/{encryptionProtectorName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "encryptionProtectorName": _SERIALIZER.url("encryption_protector_name", encryption_protector_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + encryption_protector_name: Union[str, "_models.EncryptionProtectorName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/encryptionProtector/{encryptionProtectorName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "encryptionProtectorName": _SERIALIZER.url("encryption_protector_name", encryption_protector_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/encryptionProtector') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_revalidate_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + encryption_protector_name: Union[str, "_models.EncryptionProtectorName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/encryptionProtector/{encryptionProtectorName}/revalidate') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "encryptionProtectorName": _SERIALIZER.url("encryption_protector_name", encryption_protector_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) class WorkspaceManagedSqlServerEncryptionProtectorOperations(object): """WorkspaceManagedSqlServerEncryptionProtectorOperations operations. @@ -47,14 +199,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - encryption_protector_name, # type: Union[str, "_models.EncryptionProtectorName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.EncryptionProtector" + resource_group_name: str, + workspace_name: str, + encryption_protector_name: Union[str, "_models.EncryptionProtectorName"], + **kwargs: Any + ) -> "_models.EncryptionProtector": """Get workspace server's encryption protector. Get workspace managed sql server's encryption protector. @@ -75,34 +227,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'encryptionProtectorName': self._serialize.url("encryption_protector_name", encryption_protector_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + encryption_protector_name=encryption_protector_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('EncryptionProtector', pipeline_response) @@ -111,56 +253,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/encryptionProtector/{encryptionProtectorName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - encryption_protector_name, # type: Union[str, "_models.EncryptionProtectorName"] - parameters, # type: "_models.EncryptionProtector" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.EncryptionProtector"] + resource_group_name: str, + workspace_name: str, + encryption_protector_name: Union[str, "_models.EncryptionProtectorName"], + parameters: "_models.EncryptionProtector", + **kwargs: Any + ) -> Optional["_models.EncryptionProtector"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.EncryptionProtector"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'encryptionProtectorName': self._serialize.url("encryption_protector_name", encryption_protector_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'EncryptionProtector') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + encryption_protector_name=encryption_protector_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'EncryptionProtector') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -170,17 +302,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/encryptionProtector/{encryptionProtectorName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - encryption_protector_name, # type: Union[str, "_models.EncryptionProtectorName"] - parameters, # type: "_models.EncryptionProtector" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.EncryptionProtector"] + resource_group_name: str, + workspace_name: str, + encryption_protector_name: Union[str, "_models.EncryptionProtectorName"], + parameters: "_models.EncryptionProtector", + **kwargs: Any + ) -> LROPoller["_models.EncryptionProtector"]: """Updates workspace server's encryption protector. Updates workspace managed sql server's encryption protector. @@ -195,15 +329,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.synapse.models.EncryptionProtector :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either EncryptionProtector or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either EncryptionProtector or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.EncryptionProtector] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.EncryptionProtector"] lro_delay = kwargs.pop( 'polling_interval', @@ -216,28 +354,21 @@ def begin_create_or_update( workspace_name=workspace_name, encryption_protector_name=encryption_protector_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('EncryptionProtector', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'encryptionProtectorName': self._serialize.url("encryption_protector_name", encryption_protector_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -249,15 +380,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/encryptionProtector/{encryptionProtectorName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.EncryptionProtectorListResult"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.EncryptionProtectorListResult"]: """Get list of encryption protectors for the server. Get list of encryption protectors for workspace managed sql server. @@ -267,7 +399,8 @@ def list( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either EncryptionProtectorListResult or the result of cls(response) + :return: An iterator like instance of either EncryptionProtectorListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.EncryptionProtectorListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -276,36 +409,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('EncryptionProtectorListResult', pipeline_response) + deserialized = self._deserialize("EncryptionProtectorListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -323,6 +453,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -330,37 +461,28 @@ def get_next(next_link=None): def _revalidate_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - encryption_protector_name, # type: Union[str, "_models.EncryptionProtectorName"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + encryption_protector_name: Union[str, "_models.EncryptionProtectorName"], + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._revalidate_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'encryptionProtectorName': self._serialize.url("encryption_protector_name", encryption_protector_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_revalidate_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + encryption_protector_name=encryption_protector_name, + template_url=self._revalidate_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -373,14 +495,15 @@ def _revalidate_initial( _revalidate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/encryptionProtector/{encryptionProtectorName}/revalidate'} # type: ignore + + @distributed_trace def begin_revalidate( self, - resource_group_name, # type: str - workspace_name, # type: str - encryption_protector_name, # type: Union[str, "_models.EncryptionProtectorName"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + workspace_name: str, + encryption_protector_name: Union[str, "_models.EncryptionProtectorName"], + **kwargs: Any + ) -> LROPoller[None]: """Revalidates server's existing encryption protector. Revalidates workspace managed sql server's existing encryption protector. @@ -393,15 +516,17 @@ def begin_revalidate( :type encryption_protector_name: str or ~azure.mgmt.synapse.models.EncryptionProtectorName :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -416,22 +541,14 @@ def begin_revalidate( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'encryptionProtectorName': self._serialize.url("encryption_protector_name", encryption_protector_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -443,4 +560,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revalidate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/encryptionProtector/{encryptionProtectorName}/revalidate'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_extended_blob_auditing_policies_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_extended_blob_auditing_policies_operations.py index 516ad87a451df..0aeaee8ad4439 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_extended_blob_auditing_policies_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_extended_blob_auditing_policies_operations.py @@ -5,25 +5,146 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + blob_auditing_policy_name: Union[str, "_models.BlobAuditingPolicyName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/extendedAuditingSettings/{blobAuditingPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "blobAuditingPolicyName": _SERIALIZER.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + blob_auditing_policy_name: Union[str, "_models.BlobAuditingPolicyName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/extendedAuditingSettings/{blobAuditingPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "blobAuditingPolicyName": _SERIALIZER.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_workspace_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/extendedAuditingSettings') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations(object): """WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations operations. @@ -47,14 +168,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - blob_auditing_policy_name, # type: Union[str, "_models.BlobAuditingPolicyName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ExtendedServerBlobAuditingPolicy" + resource_group_name: str, + workspace_name: str, + blob_auditing_policy_name: Union[str, "_models.BlobAuditingPolicyName"], + **kwargs: Any + ) -> "_models.ExtendedServerBlobAuditingPolicy": """Get server's extended blob auditing policy. Get a workspace SQL server's extended blob auditing policy. @@ -75,28 +196,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + blob_auditing_policy_name=blob_auditing_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -110,49 +221,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/extendedAuditingSettings/{blobAuditingPolicyName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - blob_auditing_policy_name, # type: Union[str, "_models.BlobAuditingPolicyName"] - parameters, # type: "_models.ExtendedServerBlobAuditingPolicy" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ExtendedServerBlobAuditingPolicy"] + resource_group_name: str, + workspace_name: str, + blob_auditing_policy_name: Union[str, "_models.BlobAuditingPolicyName"], + parameters: "_models.ExtendedServerBlobAuditingPolicy", + **kwargs: Any + ) -> Optional["_models.ExtendedServerBlobAuditingPolicy"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ExtendedServerBlobAuditingPolicy"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ExtendedServerBlobAuditingPolicy') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + blob_auditing_policy_name=blob_auditing_policy_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ExtendedServerBlobAuditingPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -168,17 +270,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/extendedAuditingSettings/{blobAuditingPolicyName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - blob_auditing_policy_name, # type: Union[str, "_models.BlobAuditingPolicyName"] - parameters, # type: "_models.ExtendedServerBlobAuditingPolicy" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ExtendedServerBlobAuditingPolicy"] + resource_group_name: str, + workspace_name: str, + blob_auditing_policy_name: Union[str, "_models.BlobAuditingPolicyName"], + parameters: "_models.ExtendedServerBlobAuditingPolicy", + **kwargs: Any + ) -> LROPoller["_models.ExtendedServerBlobAuditingPolicy"]: """Create or Update server's extended blob auditing policy. Create or Update a workspace managed sql server's extended blob auditing policy. @@ -193,15 +297,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.synapse.models.ExtendedServerBlobAuditingPolicy :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ExtendedServerBlobAuditingPolicy or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.ExtendedServerBlobAuditingPolicy] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ExtendedServerBlobAuditingPolicy or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.ExtendedServerBlobAuditingPolicy] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtendedServerBlobAuditingPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +323,21 @@ def begin_create_or_update( workspace_name=workspace_name, blob_auditing_policy_name=blob_auditing_policy_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ExtendedServerBlobAuditingPolicy', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("blob_auditing_policy_name", blob_auditing_policy_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,15 +349,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/extendedAuditingSettings/{blobAuditingPolicyName}'} # type: ignore + @distributed_trace def list_by_workspace( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtendedServerBlobAuditingPolicyListResult"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtendedServerBlobAuditingPolicyListResult"]: """List server's extended blob auditing policies. List workspace managed sql server's extended blob auditing policies. @@ -265,8 +368,10 @@ def list_by_workspace( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtendedServerBlobAuditingPolicyListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.ExtendedServerBlobAuditingPolicyListResult] + :return: An iterator like instance of either ExtendedServerBlobAuditingPolicyListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.ExtendedServerBlobAuditingPolicyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtendedServerBlobAuditingPolicyListResult"] @@ -274,36 +379,33 @@ def list_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExtendedServerBlobAuditingPolicyListResult', pipeline_response) + deserialized = self._deserialize("ExtendedServerBlobAuditingPolicyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -321,6 +423,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_recoverable_sql_pools_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_recoverable_sql_pools_operations.py index 9f4ff83069811..355ae4ec97874 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_recoverable_sql_pools_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_recoverable_sql_pools_operations.py @@ -5,23 +5,97 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/recoverableSqlPools') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/recoverableSqlPools/{sqlPoolName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "sqlPoolName": _SERIALIZER.url("sql_pool_name", sql_pool_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class WorkspaceManagedSqlServerRecoverableSqlPoolsOperations(object): """WorkspaceManagedSqlServerRecoverableSqlPoolsOperations operations. @@ -45,13 +119,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.RecoverableSqlPoolListResult"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.RecoverableSqlPoolListResult"]: """Get list of recoverable sql pools for the server. Get list of recoverable sql pools for workspace managed sql server. @@ -61,7 +135,8 @@ def list( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either RecoverableSqlPoolListResult or the result of cls(response) + :return: An iterator like instance of either RecoverableSqlPoolListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.RecoverableSqlPoolListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -70,36 +145,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('RecoverableSqlPoolListResult', pipeline_response) + deserialized = self._deserialize("RecoverableSqlPoolListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,19 +189,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/recoverableSqlPools'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - sql_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RecoverableSqlPool" + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs: Any + ) -> "_models.RecoverableSqlPool": """Get recoverable sql pools for the server. Get recoverable sql pools for workspace managed sql server. @@ -150,28 +223,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,4 +248,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/recoverableSqlPools/{sqlPoolName}'} # type: ignore + diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_security_alert_policy_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_security_alert_policy_operations.py index 67356b10cfcf1..1fc32047bfc77 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_security_alert_policy_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_security_alert_policy_operations.py @@ -5,25 +5,146 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyNameAutoGenerated"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/securityAlertPolicies/{securityAlertPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "securityAlertPolicyName": _SERIALIZER.url("security_alert_policy_name", security_alert_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyNameAutoGenerated"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/securityAlertPolicies/{securityAlertPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "securityAlertPolicyName": _SERIALIZER.url("security_alert_policy_name", security_alert_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/securityAlertPolicies') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class WorkspaceManagedSqlServerSecurityAlertPolicyOperations(object): """WorkspaceManagedSqlServerSecurityAlertPolicyOperations operations. @@ -47,14 +168,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - security_alert_policy_name, # type: Union[str, "_models.SecurityAlertPolicyNameAutoGenerated"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ServerSecurityAlertPolicy" + resource_group_name: str, + workspace_name: str, + security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyNameAutoGenerated"], + **kwargs: Any + ) -> "_models.ServerSecurityAlertPolicy": """Get server's security alert policy. Get a workspace managed sql server's security alert policy. @@ -64,7 +185,8 @@ def get( :param workspace_name: The name of the workspace. :type workspace_name: str :param security_alert_policy_name: The name of the security alert policy. - :type security_alert_policy_name: str or ~azure.mgmt.synapse.models.SecurityAlertPolicyNameAutoGenerated + :type security_alert_policy_name: str or + ~azure.mgmt.synapse.models.SecurityAlertPolicyNameAutoGenerated :keyword callable cls: A custom type or function that will be passed the direct response :return: ServerSecurityAlertPolicy, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.ServerSecurityAlertPolicy @@ -75,28 +197,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'securityAlertPolicyName': self._serialize.url("security_alert_policy_name", security_alert_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + security_alert_policy_name=security_alert_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -110,49 +222,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/securityAlertPolicies/{securityAlertPolicyName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - security_alert_policy_name, # type: Union[str, "_models.SecurityAlertPolicyNameAutoGenerated"] - parameters, # type: "_models.ServerSecurityAlertPolicy" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ServerSecurityAlertPolicy"] + resource_group_name: str, + workspace_name: str, + security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyNameAutoGenerated"], + parameters: "_models.ServerSecurityAlertPolicy", + **kwargs: Any + ) -> Optional["_models.ServerSecurityAlertPolicy"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ServerSecurityAlertPolicy"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'securityAlertPolicyName': self._serialize.url("security_alert_policy_name", security_alert_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServerSecurityAlertPolicy') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + security_alert_policy_name=security_alert_policy_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServerSecurityAlertPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -168,17 +271,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/securityAlertPolicies/{securityAlertPolicyName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - security_alert_policy_name, # type: Union[str, "_models.SecurityAlertPolicyNameAutoGenerated"] - parameters, # type: "_models.ServerSecurityAlertPolicy" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServerSecurityAlertPolicy"] + resource_group_name: str, + workspace_name: str, + security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyNameAutoGenerated"], + parameters: "_models.ServerSecurityAlertPolicy", + **kwargs: Any + ) -> LROPoller["_models.ServerSecurityAlertPolicy"]: """Create or Update server's threat detection policy. Create or Update a workspace managed sql server's threat detection policy. @@ -188,20 +293,25 @@ def begin_create_or_update( :param workspace_name: The name of the workspace. :type workspace_name: str :param security_alert_policy_name: The name of the security alert policy. - :type security_alert_policy_name: str or ~azure.mgmt.synapse.models.SecurityAlertPolicyNameAutoGenerated + :type security_alert_policy_name: str or + ~azure.mgmt.synapse.models.SecurityAlertPolicyNameAutoGenerated :param parameters: The workspace managed sql server security alert policy. :type parameters: ~azure.mgmt.synapse.models.ServerSecurityAlertPolicy :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ServerSecurityAlertPolicy or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServerSecurityAlertPolicy or the result + of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.ServerSecurityAlertPolicy] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerSecurityAlertPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -214,28 +324,21 @@ def begin_create_or_update( workspace_name=workspace_name, security_alert_policy_name=security_alert_policy_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServerSecurityAlertPolicy', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'securityAlertPolicyName': self._serialize.url("security_alert_policy_name", security_alert_policy_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -247,15 +350,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/securityAlertPolicies/{securityAlertPolicyName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ServerSecurityAlertPolicyListResult"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.ServerSecurityAlertPolicyListResult"]: """Get server's threat detection policies. Get workspace managed sql server's threat detection policies. @@ -265,8 +369,10 @@ def list( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServerSecurityAlertPolicyListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.ServerSecurityAlertPolicyListResult] + :return: An iterator like instance of either ServerSecurityAlertPolicyListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.ServerSecurityAlertPolicyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerSecurityAlertPolicyListResult"] @@ -274,36 +380,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServerSecurityAlertPolicyListResult', pipeline_response) + deserialized = self._deserialize("ServerSecurityAlertPolicyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -321,6 +424,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_usages_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_usages_operations.py index e1f2fb739142d..31380a1e5d784 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_usages_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_usages_operations.py @@ -5,23 +5,60 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlUsages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class WorkspaceManagedSqlServerUsagesOperations(object): """WorkspaceManagedSqlServerUsagesOperations operations. @@ -45,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ServerUsageListResult"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.ServerUsageListResult"]: """Get list of usages metric for the server. Get list of server usages metric for workspace managed sql server. @@ -61,7 +98,8 @@ def list( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServerUsageListResult or the result of cls(response) + :return: An iterator like instance of either ServerUsageListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.ServerUsageListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -70,36 +108,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServerUsageListResult', pipeline_response) + deserialized = self._deserialize("ServerUsageListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,6 +152,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_vulnerability_assessments_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_vulnerability_assessments_operations.py index 2e3859ce80c40..474b115c3667f 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_vulnerability_assessments_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_vulnerability_assessments_operations.py @@ -5,23 +5,175 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "vulnerabilityAssessmentName": _SERIALIZER.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "vulnerabilityAssessmentName": _SERIALIZER.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + "vulnerabilityAssessmentName": _SERIALIZER.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations(object): """WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations operations. @@ -45,14 +197,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - vulnerability_assessment_name, # type: Union[str, "_models.VulnerabilityAssessmentName"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ServerVulnerabilityAssessment" + resource_group_name: str, + workspace_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + **kwargs: Any + ) -> "_models.ServerVulnerabilityAssessment": """Get server's vulnerability assessment. Get workspace managed sql server's vulnerability assessment. @@ -62,7 +214,8 @@ def get( :param workspace_name: The name of the workspace. :type workspace_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :keyword callable cls: A custom type or function that will be passed the direct response :return: ServerVulnerabilityAssessment, or the result of cls(response) :rtype: ~azure.mgmt.synapse.models.ServerVulnerabilityAssessment @@ -73,28 +226,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + vulnerability_assessment_name=vulnerability_assessment_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -108,17 +251,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - vulnerability_assessment_name, # type: Union[str, "_models.VulnerabilityAssessmentName"] - parameters, # type: "_models.ServerVulnerabilityAssessment" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServerVulnerabilityAssessment" + resource_group_name: str, + workspace_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + parameters: "_models.ServerVulnerabilityAssessment", + **kwargs: Any + ) -> "_models.ServerVulnerabilityAssessment": """Create or Update server's vulnerability assessment. Create or Update workspace managed sql server's vulnerability assessment. @@ -128,7 +273,8 @@ def create_or_update( :param workspace_name: The name of the workspace. :type workspace_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :param parameters: Properties for vulnerability assessment. :type parameters: ~azure.mgmt.synapse.models.ServerVulnerabilityAssessment :keyword callable cls: A custom type or function that will be passed the direct response @@ -141,33 +287,23 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ServerVulnerabilityAssessment') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + vulnerability_assessment_name=vulnerability_assessment_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServerVulnerabilityAssessment') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -185,16 +321,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - workspace_name, # type: str - vulnerability_assessment_name, # type: Union[str, "_models.VulnerabilityAssessmentName"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + **kwargs: Any + ) -> None: """Remove server's vulnerability assessment. Remove workspace managed sql server's vulnerability assessment. @@ -204,7 +342,8 @@ def delete( :param workspace_name: The name of the workspace. :type workspace_name: str :param vulnerability_assessment_name: The name of the vulnerability assessment. - :type vulnerability_assessment_name: str or ~azure.mgmt.synapse.models.VulnerabilityAssessmentName + :type vulnerability_assessment_name: str or + ~azure.mgmt.synapse.models.VulnerabilityAssessmentName :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -215,26 +354,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("vulnerability_assessment_name", vulnerability_assessment_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + vulnerability_assessment_name=vulnerability_assessment_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,13 +378,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ServerVulnerabilityAssessmentListResult"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.ServerVulnerabilityAssessmentListResult"]: """Lists the vulnerability assessment policies associated with a server. Lists the vulnerability assessment policies associated with a workspace managed sql server. @@ -263,8 +395,10 @@ def list( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ServerVulnerabilityAssessmentListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.ServerVulnerabilityAssessmentListResult] + :return: An iterator like instance of either ServerVulnerabilityAssessmentListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.ServerVulnerabilityAssessmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerVulnerabilityAssessmentListResult"] @@ -272,36 +406,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ServerVulnerabilityAssessmentListResult', pipeline_response) + deserialized = self._deserialize("ServerVulnerabilityAssessmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -319,6 +450,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_sql_aad_admins_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_sql_aad_admins_operations.py index a07c92ee7c82b..8aef6743859b7 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_sql_aad_admins_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_sql_aad_admins_operations.py @@ -5,24 +5,141 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlAdministrators/activeDirectory') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlAdministrators/activeDirectory') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlAdministrators/activeDirectory') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class WorkspaceSqlAadAdminsOperations(object): """WorkspaceSqlAadAdminsOperations operations. @@ -46,13 +163,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.WorkspaceAadAdminInfo" + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> "_models.WorkspaceAadAdminInfo": """Gets a workspace SQL active directory admin. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -69,33 +186,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) @@ -104,54 +211,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlAdministrators/activeDirectory'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - aad_admin_info, # type: "_models.WorkspaceAadAdminInfo" - **kwargs # type: Any - ): - # type: (...) -> "_models.WorkspaceAadAdminInfo" + resource_group_name: str, + workspace_name: str, + aad_admin_info: "_models.WorkspaceAadAdminInfo", + **kwargs: Any + ) -> "_models.WorkspaceAadAdminInfo": cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceAadAdminInfo"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(aad_admin_info, 'WorkspaceAadAdminInfo') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(aad_admin_info, 'WorkspaceAadAdminInfo') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) @@ -163,16 +260,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlAdministrators/activeDirectory'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - aad_admin_info, # type: "_models.WorkspaceAadAdminInfo" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.WorkspaceAadAdminInfo"] + resource_group_name: str, + workspace_name: str, + aad_admin_info: "_models.WorkspaceAadAdminInfo", + **kwargs: Any + ) -> LROPoller["_models.WorkspaceAadAdminInfo"]: """Creates or updates a workspace SQL active directory admin. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -183,15 +282,19 @@ def begin_create_or_update( :type aad_admin_info: ~azure.mgmt.synapse.models.WorkspaceAadAdminInfo :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either WorkspaceAadAdminInfo or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either WorkspaceAadAdminInfo or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.WorkspaceAadAdminInfo] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceAadAdminInfo"] lro_delay = kwargs.pop( 'polling_interval', @@ -203,27 +306,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, aad_admin_info=aad_admin_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -235,61 +332,51 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlAdministrators/activeDirectory'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlAdministrators/activeDirectory'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a workspace SQL active directory admin. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -298,15 +385,17 @@ def begin_delete( :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -320,21 +409,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -346,4 +428,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlAdministrators/activeDirectory'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspaces_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspaces_operations.py index b0edb5555b6af..6c94c793fd798 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspaces_operations.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspaces_operations.py @@ -5,25 +5,250 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/workspaces') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class WorkspacesOperations(object): """WorkspacesOperations operations. @@ -47,18 +272,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WorkspaceInfoListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.WorkspaceInfoListResult"]: """Returns a list of workspaces in a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkspaceInfoListResult or the result of cls(response) + :return: An iterator like instance of either WorkspaceInfoListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.WorkspaceInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -67,35 +293,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('WorkspaceInfoListResult', pipeline_response) + deserialized = self._deserialize("WorkspaceInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,24 +330,25 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Workspace" + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> "_models.Workspace": """Gets a workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -142,33 +365,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Workspace', pipeline_response) @@ -177,54 +390,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore + def _update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - workspace_patch_info, # type: "_models.WorkspacePatchInfo" - **kwargs # type: Any - ): - # type: (...) -> "_models.Workspace" + resource_group_name: str, + workspace_name: str, + workspace_patch_info: "_models.WorkspacePatchInfo", + **kwargs: Any + ) -> "_models.Workspace": cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(workspace_patch_info, 'WorkspacePatchInfo') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workspace_patch_info, 'WorkspacePatchInfo') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Workspace', pipeline_response) @@ -236,16 +439,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - workspace_name, # type: str - workspace_patch_info, # type: "_models.WorkspacePatchInfo" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Workspace"] + resource_group_name: str, + workspace_name: str, + workspace_patch_info: "_models.WorkspacePatchInfo", + **kwargs: Any + ) -> LROPoller["_models.Workspace"]: """Updates a workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -256,15 +461,18 @@ def begin_update( :type workspace_patch_info: ~azure.mgmt.synapse.models.WorkspacePatchInfo :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Workspace or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.Workspace] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,27 +484,21 @@ def begin_update( resource_group_name=resource_group_name, workspace_name=workspace_name, workspace_patch_info=workspace_patch_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Workspace', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -308,54 +510,43 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore def _create_or_update_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - workspace_info, # type: "_models.Workspace" - **kwargs # type: Any - ): - # type: (...) -> "_models.Workspace" + resource_group_name: str, + workspace_name: str, + workspace_info: "_models.Workspace", + **kwargs: Any + ) -> "_models.Workspace": cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(workspace_info, 'Workspace') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workspace_info, 'Workspace') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Workspace', pipeline_response) @@ -367,16 +558,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - workspace_info, # type: "_models.Workspace" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Workspace"] + resource_group_name: str, + workspace_name: str, + workspace_info: "_models.Workspace", + **kwargs: Any + ) -> LROPoller["_models.Workspace"]: """Creates or updates a workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -387,15 +580,18 @@ def begin_create_or_update( :type workspace_info: ~azure.mgmt.synapse.models.Workspace :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Workspace or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.Workspace] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] lro_delay = kwargs.pop( 'polling_interval', @@ -407,27 +603,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, workspace_name=workspace_name, workspace_info=workspace_info, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Workspace', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -439,48 +629,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional[Any] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Optional[Any]: cls = kwargs.pop('cls', None) # type: ClsType[Optional[Any]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: @@ -493,15 +672,17 @@ def _delete_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[Any] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> LROPoller[Any]: """Deletes a workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -510,15 +691,17 @@ def begin_delete( :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either any or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[any] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[Any] lro_delay = kwargs.pop( 'polling_interval', @@ -532,24 +715,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('object', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -561,17 +737,19 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WorkspaceInfoListResult"] + **kwargs: Any + ) -> Iterable["_models.WorkspaceInfoListResult"]: """Returns a list of workspaces in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either WorkspaceInfoListResult or the result of cls(response) + :return: An iterator like instance of either WorkspaceInfoListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.WorkspaceInfoListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -580,34 +758,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('WorkspaceInfoListResult', pipeline_response) + deserialized = self._deserialize("WorkspaceInfoListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -620,12 +793,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data )