diff --git a/sdk/synapse/azure-mgmt-synapse/CHANGELOG.md b/sdk/synapse/azure-mgmt-synapse/CHANGELOG.md index 8fadca586e89..127bdb684e81 100644 --- a/sdk/synapse/azure-mgmt-synapse/CHANGELOG.md +++ b/sdk/synapse/azure-mgmt-synapse/CHANGELOG.md @@ -1,5 +1,110 @@ # Release History +## 1.0.0b1 (2020-12-10) + +This is beta preview version. + +This version uses a next-generation code generator that introduces important breaking changes, but also important new features (like unified authentication and async programming). + +**General breaking changes** + +- Credential system has been completly revamped: + + - `azure.common.credentials` or `msrestazure.azure_active_directory` instances are no longer supported, use the `azure-identity` classes instead: https://pypi.org/project/azure-identity/ + - `credentials` parameter has been renamed `credential` + +- The `config` attribute no longer exists on a client, configuration should be passed as kwarg. Example: `MyClient(credential, subscription_id, enable_logging=True)`. For a complete set of + supported options, see the [parameters accept in init documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) +- You can't import a `version` module anymore, use `__version__` instead +- Operations that used to return a `msrest.polling.LROPoller` now returns a `azure.core.polling.LROPoller` and are prefixed with `begin_`. +- Exceptions tree have been simplified and most exceptions are now `azure.core.exceptions.HttpResponseError` (`CloudError` has been removed). +- Most of the operation kwarg have changed. Some of the most noticeable: + + - `raw` has been removed. Equivalent feature can be found using `cls`, a callback that will give access to internal HTTP response for advanced user + - For a complete set of + supported options, see the [parameters accept in Request documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) + +**General new features** + +- Type annotations support using `typing`. SDKs are mypy ready. +- This client has now stable and official support for async. Check the `aio` namespace of your package to find the async client. +- This client now support natively tracing library like OpenCensus or OpenTelemetry. See this [tracing quickstart](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/core/azure-core-tracing-opentelemetry) for an overview. + +## 0.5.0 (2020-11-23) + +**Features** + + - Model SelfHostedIntegrationRuntimeStatus has a new parameter node_communication_channel_encryption_mode + - Model MetadataSyncConfig has a new parameter sync_interval_in_minutes + - Model BigDataPoolResourceInfo has a new parameter spark_config_properties + - Model BigDataPoolResourceInfo has a new parameter session_level_packages_enabled + - Model BigDataPoolResourceInfo has a new parameter have_library_requirements_changed + - Model Workspace has a new parameter workspace_uid + - Model Workspace has a new parameter managed_virtual_network_settings + - Model Workspace has a new parameter purview_configuration + - Model Workspace has a new parameter workspace_repository_configuration + - Model Workspace has a new parameter encryption + - Model PrivateLinkHub has a new parameter private_endpoint_connections + - Model WorkspacePatchInfo has a new parameter managed_virtual_network_settings + - Model WorkspacePatchInfo has a new parameter purview_configuration + - Model WorkspacePatchInfo has a new parameter workspace_repository_configuration + - Added operation SqlPoolSecurityAlertPoliciesOperations.list + - Added operation SqlPoolTransparentDataEncryptionsOperations.list + - Added operation IntegrationRuntimesOperations.disable_interactive_query + - Added operation IntegrationRuntimesOperations.enable_interactive_query + - Added operation SqlPoolRestorePointsOperations.get + - Added operation SqlPoolRestorePointsOperations.delete + - Added operation SqlPoolReplicationLinksOperations.get_by_name + - Added operation SqlPoolTablesOperations.get + - Added operation SqlPoolBlobAuditingPoliciesOperations.list_by_sql_pool + - Added operation SqlPoolVulnerabilityAssessmentScansOperations.get + - Added operation IntegrationRuntimeObjectMetadataOperations.list + - Added operation SqlPoolVulnerabilityAssessmentRuleBaselinesOperations.get + - Added operation SqlPoolSchemasOperations.get + - Added operation SqlPoolSensitivityLabelsOperations.get + - Added operation SqlPoolGeoBackupPoliciesOperations.list + - Added operation IntegrationRuntimeMonitoringDataOperations.list + - Added operation group DataMaskingRulesOperations + - Added operation group WorkspaceManagedSqlServerUsagesOperations + - Added operation group WorkspaceManagedSqlServerBlobAuditingPoliciesOperations + - Added operation group ExtendedSqlPoolBlobAuditingPoliciesOperations + - Added operation group SqlPoolWorkloadGroupOperations + - Added operation group DataMaskingPoliciesOperations + - Added operation group KeysOperations + - Added operation group WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations + - Added operation group SqlPoolWorkloadClassifierOperations + - Added operation group WorkspaceManagedSqlServerRecoverableSqlpoolsOperations + - Added operation group WorkspaceSqlAadAdminsOperations + - Added operation group RestorableDroppedSqlPoolsOperations + - Added operation group WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations + - Added operation group PrivateEndpointConnectionsPrivateLinkHubOperations + - Added operation group SqlPoolColumnsOperations + - Added operation group WorkspaceManagedSqlServerSecurityAlertPolicyOperations + +**Breaking changes** + + - Operation PrivateEndpointConnectionsOperations.create has a new signature + - Operation PrivateEndpointConnectionsOperations.create has a new signature + - Operation SqlPoolMetadataSyncConfigsOperations.create has a new signature + - Operation PrivateLinkHubsOperations.create_or_update has a new signature + - Removed operation SqlPoolsOperations.rename + - Removed operation IntegrationRuntimeObjectMetadataOperations.get + - Removed operation IntegrationRuntimeMonitoringDataOperations.get + +## 0.4.0 (2020-09-25) + +**Features** + + - Model BigDataPoolResourceInfo has a new parameter is_compute_isolation_enabled + - Model Workspace has a new parameter extra_properties + - Model Sku has a new parameter capacity + +## 0.3.0 (2020-06-17) + +**Features** + + - Added operation group PrivateLinkHubsOperations + ## 0.2.0 (2020-04-09) **Features** diff --git a/sdk/synapse/azure-mgmt-synapse/README.md b/sdk/synapse/azure-mgmt-synapse/README.md index b842c7ac1bce..9f0eb35d861a 100644 --- a/sdk/synapse/azure-mgmt-synapse/README.md +++ b/sdk/synapse/azure-mgmt-synapse/README.md @@ -7,8 +7,14 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( # Usage -For code examples, see [Synapse Management](https://docs.microsoft.com/python/api/overview/azure/) -on docs.microsoft.com. + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [Synapse Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) # Provide Feedback 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 86eda8f9b160..0c0d8cc91c76 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/__init__.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/__init__.py @@ -1,19 +1,19 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._configuration import SynapseManagementClientConfiguration from ._synapse_management_client import SynapseManagementClient -__all__ = ['SynapseManagementClient', 'SynapseManagementClientConfiguration'] - -from .version import VERSION +from ._version import VERSION __version__ = VERSION +__all__ = ['SynapseManagementClient'] +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass 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 69bb87202f2b..609905385d10 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_configuration.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_configuration.py @@ -1,48 +1,71 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrestazure import AzureConfiguration -from .version import VERSION +from typing import TYPE_CHECKING +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class SynapseManagementClientConfiguration(Configuration): + """Configuration for SynapseManagementClient. -class SynapseManagementClientConfiguration(AzureConfiguration): - """Configuration for SynapseManagementClient Note that all parameters used to create this instance are saved as instance attributes. - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` + :param 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 """ def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - if not base_url: - base_url = 'https://management.azure.com' - - super(SynapseManagementClientConfiguration, self).__init__(base_url) - - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True + super(SynapseManagementClientConfiguration, self).__init__(**kwargs) - self.add_user_agent('azure-mgmt-synapse/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials + self.credential = credential self.subscription_id = subscription_id + self.api_version = "2019-06-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-synapse/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/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 45dfb7d8c6e7..c71046ac84c8 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 @@ -1,16 +1,21 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import SDKClient -from msrest import Serializer, Deserializer +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential from ._configuration import SynapseManagementClientConfiguration from .operations import BigDataPoolsOperations @@ -25,7 +30,7 @@ from .operations import SqlPoolReplicationLinksOperations from .operations import SqlPoolTransparentDataEncryptionsOperations from .operations import SqlPoolBlobAuditingPoliciesOperations -from .operations import SqlPoolOperations +from .operations import SqlPoolOperationsOperations from .operations import SqlPoolUsagesOperations from .operations import SqlPoolSensitivityLabelsOperations from .operations import SqlPoolSchemasOperations @@ -36,9 +41,17 @@ 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 WorkspacesOperations from .operations import WorkspaceAadAdminsOperations +from .operations import WorkspaceSqlAadAdminsOperations from .operations import WorkspaceManagedIdentitySqlControlSettingsOperations +from .operations import RestorableDroppedSqlPoolsOperations from .operations import IntegrationRuntimesOperations from .operations import IntegrationRuntimeNodeIpAddressOperations from .operations import IntegrationRuntimeObjectMetadataOperations @@ -50,180 +63,273 @@ from .operations import IntegrationRuntimeStatusOperations from .operations import PrivateLinkResourcesOperations from .operations import PrivateEndpointConnectionsOperations +from .operations import PrivateLinkHubsOperations +from .operations import PrivateEndpointConnectionsPrivateLinkHubOperations +from .operations import WorkspaceManagedSqlServerBlobAuditingPoliciesOperations +from .operations import WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations +from .operations import WorkspaceManagedSqlServerSecurityAlertPolicyOperations +from .operations import WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations +from .operations import WorkspaceManagedSqlServerUsagesOperations +from .operations import WorkspaceManagedSqlServerRecoverableSqlpoolsOperations +from .operations import KeysOperations from . import models -class SynapseManagementClient(SDKClient): - """Azure Synapse Analytics Management Client +class SynapseManagementClient(object): + """Azure Synapse Analytics Management Client. - :ivar config: Configuration for client. - :vartype config: SynapseManagementClientConfiguration - - :ivar big_data_pools: BigDataPools operations + :ivar big_data_pools: BigDataPoolsOperations operations :vartype big_data_pools: azure.mgmt.synapse.operations.BigDataPoolsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.synapse.operations.Operations - :ivar ip_firewall_rules: IpFirewallRules operations + :ivar ip_firewall_rules: IpFirewallRulesOperations operations :vartype ip_firewall_rules: azure.mgmt.synapse.operations.IpFirewallRulesOperations - :ivar sql_pools: SqlPools operations + :ivar sql_pools: SqlPoolsOperations operations :vartype sql_pools: azure.mgmt.synapse.operations.SqlPoolsOperations - :ivar sql_pool_metadata_sync_configs: SqlPoolMetadataSyncConfigs operations + :ivar sql_pool_metadata_sync_configs: SqlPoolMetadataSyncConfigsOperations operations :vartype sql_pool_metadata_sync_configs: azure.mgmt.synapse.operations.SqlPoolMetadataSyncConfigsOperations - :ivar sql_pool_operation_results: SqlPoolOperationResults operations + :ivar sql_pool_operation_results: SqlPoolOperationResultsOperations operations :vartype sql_pool_operation_results: azure.mgmt.synapse.operations.SqlPoolOperationResultsOperations - :ivar sql_pool_geo_backup_policies: SqlPoolGeoBackupPolicies operations + :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: SqlPoolDataWarehouseUserActivities operations + :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: SqlPoolRestorePoints operations + :ivar sql_pool_restore_points: SqlPoolRestorePointsOperations operations :vartype sql_pool_restore_points: azure.mgmt.synapse.operations.SqlPoolRestorePointsOperations - :ivar sql_pool_replication_links: SqlPoolReplicationLinks operations + :ivar sql_pool_replication_links: SqlPoolReplicationLinksOperations operations :vartype sql_pool_replication_links: azure.mgmt.synapse.operations.SqlPoolReplicationLinksOperations - :ivar sql_pool_transparent_data_encryptions: SqlPoolTransparentDataEncryptions operations + :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: SqlPoolBlobAuditingPolicies operations + :ivar sql_pool_blob_auditing_policies: SqlPoolBlobAuditingPoliciesOperations operations :vartype sql_pool_blob_auditing_policies: azure.mgmt.synapse.operations.SqlPoolBlobAuditingPoliciesOperations - :ivar sql_pool_operations: SqlPoolOperations operations - :vartype sql_pool_operations: azure.mgmt.synapse.operations.SqlPoolOperations - :ivar sql_pool_usages: SqlPoolUsages operations + :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: SqlPoolSensitivityLabels operations + :ivar sql_pool_sensitivity_labels: SqlPoolSensitivityLabelsOperations operations :vartype sql_pool_sensitivity_labels: azure.mgmt.synapse.operations.SqlPoolSensitivityLabelsOperations - :ivar sql_pool_schemas: SqlPoolSchemas operations + :ivar sql_pool_schemas: SqlPoolSchemasOperations operations :vartype sql_pool_schemas: azure.mgmt.synapse.operations.SqlPoolSchemasOperations - :ivar sql_pool_tables: SqlPoolTables operations + :ivar sql_pool_tables: SqlPoolTablesOperations operations :vartype sql_pool_tables: azure.mgmt.synapse.operations.SqlPoolTablesOperations - :ivar sql_pool_table_columns: SqlPoolTableColumns operations + :ivar sql_pool_table_columns: SqlPoolTableColumnsOperations operations :vartype sql_pool_table_columns: azure.mgmt.synapse.operations.SqlPoolTableColumnsOperations - :ivar sql_pool_connection_policies: SqlPoolConnectionPolicies operations + :ivar sql_pool_connection_policies: SqlPoolConnectionPoliciesOperations operations :vartype sql_pool_connection_policies: azure.mgmt.synapse.operations.SqlPoolConnectionPoliciesOperations - :ivar sql_pool_vulnerability_assessments: SqlPoolVulnerabilityAssessments operations + :ivar sql_pool_vulnerability_assessments: SqlPoolVulnerabilityAssessmentsOperations operations :vartype sql_pool_vulnerability_assessments: azure.mgmt.synapse.operations.SqlPoolVulnerabilityAssessmentsOperations - :ivar sql_pool_vulnerability_assessment_scans: SqlPoolVulnerabilityAssessmentScans operations + :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: SqlPoolSecurityAlertPolicies operations + :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: SqlPoolVulnerabilityAssessmentRuleBaselines operations + :ivar sql_pool_vulnerability_assessment_rule_baselines: SqlPoolVulnerabilityAssessmentRuleBaselinesOperations operations :vartype sql_pool_vulnerability_assessment_rule_baselines: azure.mgmt.synapse.operations.SqlPoolVulnerabilityAssessmentRuleBaselinesOperations - :ivar workspaces: Workspaces operations + :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 + :vartype data_masking_rules: azure.mgmt.synapse.operations.DataMaskingRulesOperations + :ivar sql_pool_columns: SqlPoolColumnsOperations operations + :vartype sql_pool_columns: azure.mgmt.synapse.operations.SqlPoolColumnsOperations + :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 workspaces: WorkspacesOperations operations :vartype workspaces: azure.mgmt.synapse.operations.WorkspacesOperations - :ivar workspace_aad_admins: WorkspaceAadAdmins operations + :ivar workspace_aad_admins: WorkspaceAadAdminsOperations operations :vartype workspace_aad_admins: azure.mgmt.synapse.operations.WorkspaceAadAdminsOperations - :ivar workspace_managed_identity_sql_control_settings: WorkspaceManagedIdentitySqlControlSettings operations + :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 - :ivar integration_runtimes: IntegrationRuntimes operations + :ivar restorable_dropped_sql_pools: RestorableDroppedSqlPoolsOperations operations + :vartype restorable_dropped_sql_pools: azure.mgmt.synapse.operations.RestorableDroppedSqlPoolsOperations + :ivar integration_runtimes: IntegrationRuntimesOperations operations :vartype integration_runtimes: azure.mgmt.synapse.operations.IntegrationRuntimesOperations - :ivar integration_runtime_node_ip_address: IntegrationRuntimeNodeIpAddress operations + :ivar integration_runtime_node_ip_address: IntegrationRuntimeNodeIpAddressOperations operations :vartype integration_runtime_node_ip_address: azure.mgmt.synapse.operations.IntegrationRuntimeNodeIpAddressOperations - :ivar integration_runtime_object_metadata: IntegrationRuntimeObjectMetadata operations + :ivar integration_runtime_object_metadata: IntegrationRuntimeObjectMetadataOperations operations :vartype integration_runtime_object_metadata: azure.mgmt.synapse.operations.IntegrationRuntimeObjectMetadataOperations - :ivar integration_runtime_nodes: IntegrationRuntimeNodes operations + :ivar integration_runtime_nodes: IntegrationRuntimeNodesOperations operations :vartype integration_runtime_nodes: azure.mgmt.synapse.operations.IntegrationRuntimeNodesOperations - :ivar integration_runtime_credentials: IntegrationRuntimeCredentials operations + :ivar integration_runtime_credentials: IntegrationRuntimeCredentialsOperations operations :vartype integration_runtime_credentials: azure.mgmt.synapse.operations.IntegrationRuntimeCredentialsOperations - :ivar integration_runtime_connection_infos: IntegrationRuntimeConnectionInfos operations + :ivar integration_runtime_connection_infos: IntegrationRuntimeConnectionInfosOperations operations :vartype integration_runtime_connection_infos: azure.mgmt.synapse.operations.IntegrationRuntimeConnectionInfosOperations - :ivar integration_runtime_auth_keys: IntegrationRuntimeAuthKeys operations + :ivar integration_runtime_auth_keys: IntegrationRuntimeAuthKeysOperations operations :vartype integration_runtime_auth_keys: azure.mgmt.synapse.operations.IntegrationRuntimeAuthKeysOperations - :ivar integration_runtime_monitoring_data: IntegrationRuntimeMonitoringData operations + :ivar integration_runtime_monitoring_data: IntegrationRuntimeMonitoringDataOperations operations :vartype integration_runtime_monitoring_data: azure.mgmt.synapse.operations.IntegrationRuntimeMonitoringDataOperations - :ivar integration_runtime_status: IntegrationRuntimeStatus operations + :ivar integration_runtime_status: IntegrationRuntimeStatusOperations operations :vartype integration_runtime_status: azure.mgmt.synapse.operations.IntegrationRuntimeStatusOperations - :ivar private_link_resources: PrivateLinkResources operations + :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.synapse.operations.PrivateLinkResourcesOperations - :ivar private_endpoint_connections: PrivateEndpointConnections operations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.synapse.operations.PrivateEndpointConnectionsOperations - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` + :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 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_usages: WorkspaceManagedSqlServerUsagesOperations operations + :vartype workspace_managed_sql_server_usages: azure.mgmt.synapse.operations.WorkspaceManagedSqlServerUsagesOperations + :ivar workspace_managed_sql_server_recoverable_sqlpools: WorkspaceManagedSqlServerRecoverableSqlpoolsOperations operations + :vartype workspace_managed_sql_server_recoverable_sqlpools: azure.mgmt.synapse.operations.WorkspaceManagedSqlServerRecoverableSqlpoolsOperations + :ivar keys: KeysOperations operations + :vartype keys: azure.mgmt.synapse.operations.KeysOperations + :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. """ def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = SynapseManagementClientConfiguration(credentials, subscription_id, base_url) - super(SynapseManagementClient, self).__init__(self.config.credentials, self.config) + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = SynapseManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2019-06-01-preview' self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.big_data_pools = BigDataPoolsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.operations = Operations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.ip_firewall_rules = IpFirewallRulesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.sql_pools = SqlPoolsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.sql_pool_metadata_sync_configs = SqlPoolMetadataSyncConfigsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.sql_pool_operation_results = SqlPoolOperationResultsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.sql_pool_geo_backup_policies = SqlPoolGeoBackupPoliciesOperations( - self._client, self.config, self._serialize, self._deserialize) + 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._client, self._config, self._serialize, self._deserialize) self.sql_pool_restore_points = SqlPoolRestorePointsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.sql_pool_replication_links = SqlPoolReplicationLinksOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.sql_pool_transparent_data_encryptions = SqlPoolTransparentDataEncryptionsOperations( - self._client, self.config, self._serialize, self._deserialize) + 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 = SqlPoolOperations( - self._client, self.config, self._serialize, self._deserialize) + 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._client, self._config, self._serialize, self._deserialize) self.sql_pool_sensitivity_labels = SqlPoolSensitivityLabelsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.sql_pool_schemas = SqlPoolSchemasOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.sql_pool_tables = SqlPoolTablesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.sql_pool_table_columns = SqlPoolTableColumnsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.sql_pool_connection_policies = SqlPoolConnectionPoliciesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.sql_pool_vulnerability_assessments = SqlPoolVulnerabilityAssessmentsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.sql_pool_vulnerability_assessment_scans = SqlPoolVulnerabilityAssessmentScansOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.sql_pool_security_alert_policies = SqlPoolSecurityAlertPoliciesOperations( - self._client, self.config, self._serialize, self._deserialize) + 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._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.workspaces = WorkspacesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.workspace_aad_admins = WorkspaceAadAdminsOperations( - self._client, self.config, self._serialize, self._deserialize) + 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._client, self._config, self._serialize, self._deserialize) + self.restorable_dropped_sql_pools = RestorableDroppedSqlPoolsOperations( + self._client, self._config, self._serialize, self._deserialize) self.integration_runtimes = IntegrationRuntimesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.integration_runtime_node_ip_address = IntegrationRuntimeNodeIpAddressOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.integration_runtime_object_metadata = IntegrationRuntimeObjectMetadataOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.integration_runtime_nodes = IntegrationRuntimeNodesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.integration_runtime_credentials = IntegrationRuntimeCredentialsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.integration_runtime_connection_infos = IntegrationRuntimeConnectionInfosOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.integration_runtime_auth_keys = IntegrationRuntimeAuthKeysOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.integration_runtime_monitoring_data = IntegrationRuntimeMonitoringDataOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.integration_runtime_status = IntegrationRuntimeStatusOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self.config, self._serialize, self._deserialize) + 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.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_usages = WorkspaceManagedSqlServerUsagesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.workspace_managed_sql_server_recoverable_sqlpools = WorkspaceManagedSqlServerRecoverableSqlpoolsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.keys = KeysOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> SynapseManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/version.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_version.py similarity index 84% rename from sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/version.py rename to sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_version.py index 9bd1dfac7ecb..515f51c112dd 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/version.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_version.py @@ -1,13 +1,10 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "0.2.0" +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 new file mode 100644 index 000000000000..85258db367af --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/__init__.py @@ -0,0 +1,10 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._synapse_management_client import SynapseManagementClient +__all__ = ['SynapseManagementClient'] 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 new file mode 100644 index 000000000000..fd764edaa9c5 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class SynapseManagementClientConfiguration(Configuration): + """Configuration for SynapseManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(SynapseManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2019-06-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-synapse/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/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 new file mode 100644 index 000000000000..2071a40e7f44 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/_synapse_management_client.py @@ -0,0 +1,329 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import SynapseManagementClientConfiguration +from .operations import BigDataPoolsOperations +from .operations import Operations +from .operations import IpFirewallRulesOperations +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 SqlPoolTransparentDataEncryptionsOperations +from .operations import SqlPoolBlobAuditingPoliciesOperations +from .operations import SqlPoolOperationsOperations +from .operations import SqlPoolUsagesOperations +from .operations import SqlPoolSensitivityLabelsOperations +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 WorkspacesOperations +from .operations import WorkspaceAadAdminsOperations +from .operations import WorkspaceSqlAadAdminsOperations +from .operations import WorkspaceManagedIdentitySqlControlSettingsOperations +from .operations import RestorableDroppedSqlPoolsOperations +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 PrivateLinkResourcesOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import PrivateLinkHubsOperations +from .operations import PrivateEndpointConnectionsPrivateLinkHubOperations +from .operations import WorkspaceManagedSqlServerBlobAuditingPoliciesOperations +from .operations import WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations +from .operations import WorkspaceManagedSqlServerSecurityAlertPolicyOperations +from .operations import WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations +from .operations import WorkspaceManagedSqlServerUsagesOperations +from .operations import WorkspaceManagedSqlServerRecoverableSqlpoolsOperations +from .operations import KeysOperations +from .. import models + + +class SynapseManagementClient(object): + """Azure Synapse Analytics Management Client. + + :ivar big_data_pools: BigDataPoolsOperations operations + :vartype big_data_pools: azure.mgmt.synapse.aio.operations.BigDataPoolsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.synapse.aio.operations.Operations + :ivar ip_firewall_rules: IpFirewallRulesOperations operations + :vartype ip_firewall_rules: azure.mgmt.synapse.aio.operations.IpFirewallRulesOperations + :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 + :ivar sql_pool_operation_results: SqlPoolOperationResultsOperations operations + :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 + :ivar sql_pool_restore_points: SqlPoolRestorePointsOperations operations + :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 + :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 + :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_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 + :ivar sql_pool_connection_policies: SqlPoolConnectionPoliciesOperations operations + :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 + :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 + :ivar data_masking_policies: DataMaskingPoliciesOperations operations + :vartype data_masking_policies: azure.mgmt.synapse.aio.operations.DataMaskingPoliciesOperations + :ivar data_masking_rules: DataMaskingRulesOperations operations + :vartype data_masking_rules: azure.mgmt.synapse.aio.operations.DataMaskingRulesOperations + :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 + :ivar sql_pool_workload_classifier: SqlPoolWorkloadClassifierOperations operations + :vartype sql_pool_workload_classifier: azure.mgmt.synapse.aio.operations.SqlPoolWorkloadClassifierOperations + :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 + :ivar restorable_dropped_sql_pools: RestorableDroppedSqlPoolsOperations operations + :vartype restorable_dropped_sql_pools: azure.mgmt.synapse.aio.operations.RestorableDroppedSqlPoolsOperations + :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 + :ivar integration_runtime_nodes: IntegrationRuntimeNodesOperations operations + :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 + :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 + :ivar integration_runtime_status: IntegrationRuntimeStatusOperations operations + :vartype integration_runtime_status: azure.mgmt.synapse.aio.operations.IntegrationRuntimeStatusOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.synapse.aio.operations.PrivateLinkResourcesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.synapse.aio.operations.PrivateEndpointConnectionsOperations + :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 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_usages: WorkspaceManagedSqlServerUsagesOperations operations + :vartype workspace_managed_sql_server_usages: azure.mgmt.synapse.aio.operations.WorkspaceManagedSqlServerUsagesOperations + :ivar workspace_managed_sql_server_recoverable_sqlpools: WorkspaceManagedSqlServerRecoverableSqlpoolsOperations operations + :vartype workspace_managed_sql_server_recoverable_sqlpools: azure.mgmt.synapse.aio.operations.WorkspaceManagedSqlServerRecoverableSqlpoolsOperations + :ivar keys: KeysOperations operations + :vartype keys: azure.mgmt.synapse.aio.operations.KeysOperations + :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. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = SynapseManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.big_data_pools = BigDataPoolsOperations( + 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.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_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_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.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.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.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + 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.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_usages = WorkspaceManagedSqlServerUsagesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.workspace_managed_sql_server_recoverable_sqlpools = WorkspaceManagedSqlServerRecoverableSqlpoolsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.keys = KeysOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "SynapseManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/__init__.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/__init__.py new file mode 100644 index 000000000000..8f8384a9e253 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/__init__.py @@ -0,0 +1,119 @@ +# coding=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 ._big_data_pools_operations import BigDataPoolsOperations +from ._operations import Operations +from ._ip_firewall_rules_operations import IpFirewallRulesOperations +from ._sql_pools_operations import SqlPoolsOperations +from ._sql_pool_metadata_sync_configs_operations import SqlPoolMetadataSyncConfigsOperations +from ._sql_pool_operation_results_operations import SqlPoolOperationResultsOperations +from ._sql_pool_geo_backup_policies_operations import SqlPoolGeoBackupPoliciesOperations +from ._sql_pool_data_warehouse_user_activities_operations import SqlPoolDataWarehouseUserActivitiesOperations +from ._sql_pool_restore_points_operations import SqlPoolRestorePointsOperations +from ._sql_pool_replication_links_operations import SqlPoolReplicationLinksOperations +from ._sql_pool_transparent_data_encryptions_operations import SqlPoolTransparentDataEncryptionsOperations +from ._sql_pool_blob_auditing_policies_operations import SqlPoolBlobAuditingPoliciesOperations +from ._sql_pool_operations_operations import SqlPoolOperationsOperations +from ._sql_pool_usages_operations import SqlPoolUsagesOperations +from ._sql_pool_sensitivity_labels_operations import SqlPoolSensitivityLabelsOperations +from ._sql_pool_schemas_operations import SqlPoolSchemasOperations +from ._sql_pool_tables_operations import SqlPoolTablesOperations +from ._sql_pool_table_columns_operations import SqlPoolTableColumnsOperations +from ._sql_pool_connection_policies_operations import SqlPoolConnectionPoliciesOperations +from ._sql_pool_vulnerability_assessments_operations import SqlPoolVulnerabilityAssessmentsOperations +from ._sql_pool_vulnerability_assessment_scans_operations import SqlPoolVulnerabilityAssessmentScansOperations +from ._sql_pool_security_alert_policies_operations import SqlPoolSecurityAlertPoliciesOperations +from ._sql_pool_vulnerability_assessment_rule_baselines_operations import SqlPoolVulnerabilityAssessmentRuleBaselinesOperations +from ._extended_sql_pool_blob_auditing_policies_operations import ExtendedSqlPoolBlobAuditingPoliciesOperations +from ._data_masking_policies_operations import DataMaskingPoliciesOperations +from ._data_masking_rules_operations import DataMaskingRulesOperations +from ._sql_pool_columns_operations import SqlPoolColumnsOperations +from ._sql_pool_workload_group_operations import SqlPoolWorkloadGroupOperations +from ._sql_pool_workload_classifier_operations import SqlPoolWorkloadClassifierOperations +from ._workspaces_operations import WorkspacesOperations +from ._workspace_aad_admins_operations import WorkspaceAadAdminsOperations +from ._workspace_sql_aad_admins_operations import WorkspaceSqlAadAdminsOperations +from ._workspace_managed_identity_sql_control_settings_operations import WorkspaceManagedIdentitySqlControlSettingsOperations +from ._restorable_dropped_sql_pools_operations import RestorableDroppedSqlPoolsOperations +from ._integration_runtimes_operations import IntegrationRuntimesOperations +from ._integration_runtime_node_ip_address_operations import IntegrationRuntimeNodeIpAddressOperations +from ._integration_runtime_object_metadata_operations import IntegrationRuntimeObjectMetadataOperations +from ._integration_runtime_nodes_operations import IntegrationRuntimeNodesOperations +from ._integration_runtime_credentials_operations import IntegrationRuntimeCredentialsOperations +from ._integration_runtime_connection_infos_operations import IntegrationRuntimeConnectionInfosOperations +from ._integration_runtime_auth_keys_operations import IntegrationRuntimeAuthKeysOperations +from ._integration_runtime_monitoring_data_operations import IntegrationRuntimeMonitoringDataOperations +from ._integration_runtime_status_operations import IntegrationRuntimeStatusOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_hubs_operations import PrivateLinkHubsOperations +from ._private_endpoint_connections_private_link_hub_operations import PrivateEndpointConnectionsPrivateLinkHubOperations +from ._workspace_managed_sql_server_blob_auditing_policies_operations import WorkspaceManagedSqlServerBlobAuditingPoliciesOperations +from ._workspace_managed_sql_server_extended_blob_auditing_policies_operations import WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations +from ._workspace_managed_sql_server_security_alert_policy_operations import WorkspaceManagedSqlServerSecurityAlertPolicyOperations +from ._workspace_managed_sql_server_vulnerability_assessments_operations import WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations +from ._workspace_managed_sql_server_usages_operations import WorkspaceManagedSqlServerUsagesOperations +from ._workspace_managed_sql_server_recoverable_sqlpools_operations import WorkspaceManagedSqlServerRecoverableSqlpoolsOperations +from ._keys_operations import KeysOperations + +__all__ = [ + 'BigDataPoolsOperations', + 'Operations', + 'IpFirewallRulesOperations', + 'SqlPoolsOperations', + 'SqlPoolMetadataSyncConfigsOperations', + 'SqlPoolOperationResultsOperations', + 'SqlPoolGeoBackupPoliciesOperations', + 'SqlPoolDataWarehouseUserActivitiesOperations', + 'SqlPoolRestorePointsOperations', + 'SqlPoolReplicationLinksOperations', + 'SqlPoolTransparentDataEncryptionsOperations', + 'SqlPoolBlobAuditingPoliciesOperations', + 'SqlPoolOperationsOperations', + 'SqlPoolUsagesOperations', + 'SqlPoolSensitivityLabelsOperations', + 'SqlPoolSchemasOperations', + 'SqlPoolTablesOperations', + 'SqlPoolTableColumnsOperations', + 'SqlPoolConnectionPoliciesOperations', + 'SqlPoolVulnerabilityAssessmentsOperations', + 'SqlPoolVulnerabilityAssessmentScansOperations', + 'SqlPoolSecurityAlertPoliciesOperations', + 'SqlPoolVulnerabilityAssessmentRuleBaselinesOperations', + 'ExtendedSqlPoolBlobAuditingPoliciesOperations', + 'DataMaskingPoliciesOperations', + 'DataMaskingRulesOperations', + 'SqlPoolColumnsOperations', + 'SqlPoolWorkloadGroupOperations', + 'SqlPoolWorkloadClassifierOperations', + 'WorkspacesOperations', + 'WorkspaceAadAdminsOperations', + 'WorkspaceSqlAadAdminsOperations', + 'WorkspaceManagedIdentitySqlControlSettingsOperations', + 'RestorableDroppedSqlPoolsOperations', + 'IntegrationRuntimesOperations', + 'IntegrationRuntimeNodeIpAddressOperations', + 'IntegrationRuntimeObjectMetadataOperations', + 'IntegrationRuntimeNodesOperations', + 'IntegrationRuntimeCredentialsOperations', + 'IntegrationRuntimeConnectionInfosOperations', + 'IntegrationRuntimeAuthKeysOperations', + 'IntegrationRuntimeMonitoringDataOperations', + 'IntegrationRuntimeStatusOperations', + 'PrivateLinkResourcesOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkHubsOperations', + 'PrivateEndpointConnectionsPrivateLinkHubOperations', + 'WorkspaceManagedSqlServerBlobAuditingPoliciesOperations', + 'WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations', + 'WorkspaceManagedSqlServerSecurityAlertPolicyOperations', + 'WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations', + 'WorkspaceManagedSqlServerUsagesOperations', + 'WorkspaceManagedSqlServerRecoverableSqlpoolsOperations', + 'KeysOperations', +] 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 new file mode 100644 index 000000000000..01f54c4020d3 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_big_data_pools_operations.py @@ -0,0 +1,533 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class BigDataPoolsOperations: + """BigDataPoolsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + big_data_pool_name: str, + **kwargs + ) -> "_models.BigDataPoolResourceInfo": + """Get Big Data pool. + + Get a Big Data pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param big_data_pool_name: Big Data pool name. + :type big_data_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BigDataPoolResourceInfo, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.BigDataPoolResourceInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BigDataPoolResourceInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + workspace_name: str, + big_data_pool_name: str, + big_data_pool_patch_info: "_models.BigDataPoolPatchInfo", + **kwargs + ) -> "_models.BigDataPoolResourceInfo": + """Update a Big Data pool. + + Patch a Big Data pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param big_data_pool_name: Big Data pool name. + :type big_data_pool_name: str + :param big_data_pool_patch_info: The updated Big Data pool properties. + :type big_data_pool_patch_info: ~azure.mgmt.synapse.models.BigDataPoolPatchInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BigDataPoolResourceInfo, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.BigDataPoolResourceInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['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_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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('BigDataPoolResourceInfo', pipeline_response) + + if cls: + 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, + workspace_name: str, + big_data_pool_name: str, + big_data_pool_info: "_models.BigDataPoolResourceInfo", + force: Optional[bool] = False, + **kwargs + ) -> "_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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('BigDataPoolResourceInfo', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('BigDataPoolResourceInfo', pipeline_response) + + if cls: + 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 + + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + big_data_pool_name: str, + big_data_pool_info: "_models.BigDataPoolResourceInfo", + force: Optional[bool] = False, + **kwargs + ) -> AsyncLROPoller["_models.BigDataPoolResourceInfo"]: + """Create a Big Data pool. + + Create a new Big Data pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param big_data_pool_name: Big Data pool name. + :type big_data_pool_name: str + :param big_data_pool_info: The Big Data pool to create. + :type big_data_pool_info: ~azure.mgmt.synapse.models.BigDataPoolResourceInfo + :param force: Whether to stop any running jobs in the Big Data pool. + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BigDataPoolResourceInfo or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.BigDataPoolResourceInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BigDataPoolResourceInfo"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + big_data_pool_name=big_data_pool_name, + big_data_pool_info=big_data_pool_info, + force=force, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + workspace_name: str, + big_data_pool_name: str, + **kwargs + ) -> Optional[object]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[object]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('object', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + big_data_pool_name: str, + **kwargs + ) -> AsyncLROPoller[object]: + """Delete a Big Data pool. + + Delete a Big Data pool from the workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param big_data_pool_name: Big Data pool name. + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either object or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[object] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[object] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + big_data_pool_name=big_data_pool_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} # type: ignore + + def list_by_workspace( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> AsyncIterable["_models.BigDataPoolResourceInfoListResult"]: + """List the Big Data pools in a workspace. + + List Big Data pools in a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.BigDataPoolResourceInfoListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('BigDataPoolResourceInfoListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools'} # type: ignore 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 new file mode 100644 index 000000000000..9c446446c465 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_data_masking_policies_operations.py @@ -0,0 +1,177 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DataMaskingPoliciesOperations: + """DataMaskingPoliciesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + parameters: "_models.DataMaskingPolicy", + **kwargs + ) -> "_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. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param parameters: Parameters for creating or updating a data masking policy. + :type parameters: ~azure.mgmt.synapse.models.DataMaskingPolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataMaskingPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.DataMaskingPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataMaskingPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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['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, '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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataMaskingPolicy', pipeline_response) + + if cls: + 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 + + async def get( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs + ) -> "_models.DataMaskingPolicy": + """Gets a Sql pool data masking policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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: DataMaskingPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.DataMaskingPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataMaskingPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataMaskingPolicy', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..546dbe4aaa0e --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_data_masking_rules_operations.py @@ -0,0 +1,202 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DataMaskingRulesOperations: + """DataMaskingRulesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + data_masking_rule_name: str, + parameters: "_models.DataMaskingRule", + **kwargs + ) -> "_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. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param data_masking_rule_name: The name of the data masking rule. + :type data_masking_rule_name: str + :param parameters: The required parameters for creating or updating a data masking rule. + :type parameters: ~azure.mgmt.synapse.models.DataMaskingRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataMaskingRule, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.DataMaskingRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataMaskingRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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['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, '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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataMaskingRule', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataMaskingRule', pipeline_response) + + if cls: + 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 + + def list_by_sql_pool( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs + ) -> AsyncIterable["_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. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataMaskingRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DataMaskingRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_sql_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules'} # type: ignore 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 new file mode 100644 index 000000000000..11c3bbade475 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_extended_sql_pool_blob_auditing_policies_operations.py @@ -0,0 +1,260 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ExtendedSqlPoolBlobAuditingPoliciesOperations: + """ExtendedSqlPoolBlobAuditingPoliciesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs + ) -> "_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. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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: ExtendedSqlPoolBlobAuditingPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.ExtendedSqlPoolBlobAuditingPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtendedSqlPoolBlobAuditingPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ExtendedSqlPoolBlobAuditingPolicy', pipeline_response) + + if cls: + 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 + + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + parameters: "_models.ExtendedSqlPoolBlobAuditingPolicy", + **kwargs + ) -> "_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. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param parameters: The extended Sql pool blob auditing policy. + :type parameters: ~azure.mgmt.synapse.models.ExtendedSqlPoolBlobAuditingPolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExtendedSqlPoolBlobAuditingPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.ExtendedSqlPoolBlobAuditingPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtendedSqlPoolBlobAuditingPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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['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, '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 + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ExtendedSqlPoolBlobAuditingPolicy', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ExtendedSqlPoolBlobAuditingPolicy', pipeline_response) + + if cls: + 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 + + def list_by_sql_pool( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs + ) -> AsyncIterable["_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. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtendedSqlPoolBlobAuditingPolicyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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_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, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ExtendedSqlPoolBlobAuditingPolicyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_sql_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/extendedAuditingSettings'} # type: ignore 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 new file mode 100644 index 000000000000..f29b1f823195 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_auth_keys_operations.py @@ -0,0 +1,180 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class IntegrationRuntimeAuthKeysOperations: + """IntegrationRuntimeAuthKeysOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def regenerate( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + regenerate_key_parameters: "_models.IntegrationRuntimeRegenerateKeyParameters", + **kwargs + ) -> "_models.IntegrationRuntimeAuthKeys": + """Regenerate integration runtime authentication key. + + Regenerate the authentication key for an integration runtime. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param integration_runtime_name: Integration runtime name. + :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 + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeAuthKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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') + + 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(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IntegrationRuntimeAuthKeys', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + regenerate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/regenerateAuthKey'} # type: ignore + + async def list( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs + ) -> "_models.IntegrationRuntimeAuthKeys": + """List integration runtime authentication keys. + + List authentication keys in an integration runtime. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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: IntegrationRuntimeAuthKeys, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeAuthKeys + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeAuthKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IntegrationRuntimeAuthKeys', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..cd6093686c62 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_connection_infos_operations.py @@ -0,0 +1,106 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class IntegrationRuntimeConnectionInfosOperations: + """IntegrationRuntimeConnectionInfosOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs + ) -> "_models.IntegrationRuntimeConnectionInfo": + """Get integration runtime connection info. + + Get connection info for an integration runtime. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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: IntegrationRuntimeConnectionInfo, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeConnectionInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeConnectionInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IntegrationRuntimeConnectionInfo', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..04b6a1104825 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_credentials_operations.py @@ -0,0 +1,106 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class IntegrationRuntimeCredentialsOperations: + """IntegrationRuntimeCredentialsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def sync( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs + ) -> None: + """Sync integration runtime credentials. + + Force the integration runtime to synchronize credentials across integration runtime nodes, and + this will override the credentials across all worker nodes with those available on the + dispatcher node. If you already have the latest credential backup file, you should manually + import it (preferred) on any self-hosted integration runtime node than using this API directly. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, 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 new file mode 100644 index 000000000000..e58940c2b8db --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_monitoring_data_operations.py @@ -0,0 +1,106 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class IntegrationRuntimeMonitoringDataOperations: + """IntegrationRuntimeMonitoringDataOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs + ) -> "_models.IntegrationRuntimeMonitoringData": + """Get integration runtime monitoring data. + + Get monitoring data for an integration runtime. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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: IntegrationRuntimeMonitoringData, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeMonitoringData + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeMonitoringData"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IntegrationRuntimeMonitoringData', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..115eead4047f --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_node_ip_address_operations.py @@ -0,0 +1,110 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class IntegrationRuntimeNodeIpAddressOperations: + """IntegrationRuntimeNodeIpAddressOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + node_name: str, + **kwargs + ) -> "_models.IntegrationRuntimeNodeIpAddress": + """Get integration runtime node IP address. + + Get the IP address of an integration runtime node. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param integration_runtime_name: Integration runtime name. + :type integration_runtime_name: str + :param node_name: Integration runtime node name. + :type node_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IntegrationRuntimeNodeIpAddress, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeNodeIpAddress + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeNodeIpAddress"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IntegrationRuntimeNodeIpAddress', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..359151837611 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_nodes_operations.py @@ -0,0 +1,254 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class IntegrationRuntimeNodesOperations: + """IntegrationRuntimeNodesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + node_name: str, + **kwargs + ) -> "_models.SelfHostedIntegrationRuntimeNode": + """Get integration runtime node. + + Get an integration runtime node. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param integration_runtime_name: Integration runtime name. + :type integration_runtime_name: str + :param node_name: Integration runtime node name. + :type node_name: str + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SelfHostedIntegrationRuntimeNode"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SelfHostedIntegrationRuntimeNode', pipeline_response) + + if cls: + 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 + + async def update( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + node_name: str, + update_integration_runtime_node_request: "_models.UpdateIntegrationRuntimeNodeRequest", + **kwargs + ) -> "_models.SelfHostedIntegrationRuntimeNode": + """Create integration runtime node. + + Create an integration runtime node. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param integration_runtime_name: Integration runtime name. + :type integration_runtime_name: str + :param node_name: Integration runtime node name. + :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 + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SelfHostedIntegrationRuntimeNode"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['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(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(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SelfHostedIntegrationRuntimeNode', pipeline_response) + + if cls: + 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 + + async def delete( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + node_name: str, + **kwargs + ) -> None: + """Delete integration runtime node. + + Delete an integration runtime node. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param integration_runtime_name: Integration runtime name. + :type integration_runtime_name: str + :param node_name: Integration runtime node name. + :type node_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, 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 new file mode 100644 index 000000000000..741dce5d8fc3 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_object_metadata_operations.py @@ -0,0 +1,245 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, 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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class IntegrationRuntimeObjectMetadataOperations: + """IntegrationRuntimeObjectMetadataOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + get_metadata_request: Optional["_models.GetSsisObjectMetadataRequest"] = None, + **kwargs + ) -> "_models.SsisObjectMetadataListResponse": + """Get integration runtime object metadata. + + Get object metadata from an integration runtime. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param integration_runtime_name: Integration runtime name. + :type integration_runtime_name: str + :param get_metadata_request: The parameters for getting a SSIS object metadata. + :type get_metadata_request: ~azure.mgmt.synapse.models.GetSsisObjectMetadataRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SsisObjectMetadataListResponse, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SsisObjectMetadataListResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SsisObjectMetadataListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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') + + body_content_kwargs = {} # type: Dict[str, Any] + if get_metadata_request is not None: + body_content = 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) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SsisObjectMetadataListResponse', pipeline_response) + + if cls: + 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, + workspace_name: str, + integration_runtime_name: str, + **kwargs + ) -> 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SsisObjectMetadataStatusResponse', pipeline_response) + + if cls: + 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 + + async def begin_refresh( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs + ) -> AsyncLROPoller["_models.SsisObjectMetadataStatusResponse"]: + """Refresh integration runtime object metadata. + + Refresh the object metadata in an integration runtime. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SsisObjectMetadataStatusResponse"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._refresh_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_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 new file mode 100644 index 000000000000..729e8b8de291 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtime_status_operations.py @@ -0,0 +1,106 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class IntegrationRuntimeStatusOperations: + """IntegrationRuntimeStatusOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs + ) -> "_models.IntegrationRuntimeStatusResponse": + """Get integration runtime status. + + Get the integration runtime status. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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: IntegrationRuntimeStatusResponse, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeStatusResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeStatusResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IntegrationRuntimeStatusResponse', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..e0705ecdc0c5 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_integration_runtimes_operations.py @@ -0,0 +1,1068 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class IntegrationRuntimesOperations: + """IntegrationRuntimesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def update( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + update_integration_runtime_request: "_models.UpdateIntegrationRuntimeRequest", + **kwargs + ) -> "_models.IntegrationRuntimeResource": + """Update integration runtime. + + Update an integration runtime. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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') + + 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(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IntegrationRuntimeResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + if_none_match: Optional[str] = None, + **kwargs + ) -> Optional["_models.IntegrationRuntimeResource"]: + """Get integration runtime. + + Get an integration runtime. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param integration_runtime_name: Integration runtime name. + :type integration_runtime_name: str + :param if_none_match: ETag of the integration runtime entity. Should only be specified for get. + If the ETag matches the existing entity tag, or if * was provided, then no content will be + returned. + :type if_none_match: str + :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 or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_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(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('IntegrationRuntimeResource', pipeline_response) + + if cls: + 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, + workspace_name: str, + integration_runtime_name: str, + integration_runtime: "_models.IntegrationRuntimeResource", + if_match: Optional[str] = None, + **kwargs + ) -> 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('IntegrationRuntimeResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + integration_runtime: "_models.IntegrationRuntimeResource", + if_match: Optional[str] = None, + **kwargs + ) -> AsyncLROPoller["_models.IntegrationRuntimeResource"]: + """Create integration runtime. + + Create an integration runtime. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param integration_runtime_name: Integration runtime name. + :type integration_runtime_name: str + :param integration_runtime: Integration runtime resource definition. + :type integration_runtime: ~azure.mgmt.synapse.models.IntegrationRuntimeResource + :param if_match: ETag of the integration runtime entity. Should only be specified for update, + for which it should match existing entity or can be * for unconditional 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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + integration_runtime=integration_runtime, + if_match=if_match, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs + ) -> 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Delete integration runtime. + + Delete an integration runtime. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} # type: ignore + + async def upgrade( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs + ) -> None: + """Upgrade integration runtime. + + Upgrade an integration runtime. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + upgrade.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/upgrade'} # type: ignore + + def list_by_workspace( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> AsyncIterable["_models.IntegrationRuntimeListResponse"]: + """List integration runtimes. + + List all integration runtimes. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IntegrationRuntimeListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes'} # type: ignore + + async def _start_initial( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs + ) -> 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('IntegrationRuntimeStatusResponse', pipeline_response) + + if cls: + 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 + + async def begin_start( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs + ) -> AsyncLROPoller["_models.IntegrationRuntimeStatusResponse"]: + """Start integration runtime. + + Start an integration runtime. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeStatusResponse"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/start'} # type: ignore + + async def _stop_initial( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs + ) -> 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, 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 + + async def begin_stop( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Stop integration runtime. + + Stop an integration runtime. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._stop_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/stop'} # type: ignore + + async def _enable_interactive_query_initial( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs + ) -> 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, 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 + + async def begin_enable_interactive_query( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Enable interactive query in integration runtime. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._enable_interactive_query_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_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( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs + ) -> 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, 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 + + async def begin_disable_interactive_query( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Disable interactive query in integration runtime. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._disable_interactive_query_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_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 new file mode 100644 index 000000000000..67994d0d5011 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_ip_firewall_rules_operations.py @@ -0,0 +1,569 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class IpFirewallRulesOperations: + """IpFirewallRulesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_workspace( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> AsyncIterable["_models.IpFirewallRuleInfoListResult"]: + """Returns a list of firewall rules. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IpFirewallRuleInfoListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('IpFirewallRuleInfoListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + rule_name: str, + ip_firewall_rule_info: "_models.IpFirewallRuleInfo", + **kwargs + ) -> "_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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['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(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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('IpFirewallRuleInfo', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('IpFirewallRuleInfo', pipeline_response) + + if cls: + 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 + + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + rule_name: str, + ip_firewall_rule_info: "_models.IpFirewallRuleInfo", + **kwargs + ) -> AsyncLROPoller["_models.IpFirewallRuleInfo"]: + """Creates or updates a firewall rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param rule_name: The IP firewall rule name. + :type rule_name: str + :param ip_firewall_rule_info: IP firewall rule properties. + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either IpFirewallRuleInfo or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.IpFirewallRuleInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IpFirewallRuleInfo"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + ip_firewall_rule_info=ip_firewall_rule_info, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + workspace_name: str, + rule_name: str, + **kwargs + ) -> Optional[object]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[object]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + rule_name: str, + **kwargs + ) -> AsyncLROPoller[object]: + """Deletes a firewall rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param rule_name: The IP firewall rule name. + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either object or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[object] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[object] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + workspace_name: str, + rule_name: str, + **kwargs + ) -> "_models.IpFirewallRuleInfo": + """Get a firewall rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param rule_name: The IP firewall rule name. + :type rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpFirewallRuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.IpFirewallRuleInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('IpFirewallRuleInfo', pipeline_response) + + if cls: + 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, + workspace_name: str, + request: "_models.ReplaceAllIpFirewallRulesRequest", + **kwargs + ) -> 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 = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, '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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ReplaceAllFirewallRulesOperationResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _replace_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/replaceAllIpFirewallRules'} # type: ignore + + async def begin_replace_all( + self, + resource_group_name: str, + workspace_name: str, + request: "_models.ReplaceAllIpFirewallRulesRequest", + **kwargs + ) -> AsyncLROPoller["_models.ReplaceAllFirewallRulesOperationResponse"]: + """Replaces firewall rules. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param request: Replace all IP firewall rules request. + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplaceAllFirewallRulesOperationResponse"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._replace_all_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_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 new file mode 100644 index 000000000000..1c45c15f9e69 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_keys_operations.py @@ -0,0 +1,316 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class KeysOperations: + """KeysOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_workspace( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> AsyncIterable["_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. + :type resource_group_name: str + :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 KeyInfoListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.KeyInfoListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyInfoListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('KeyInfoListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/keys'} # type: ignore + + async def get( + self, + resource_group_name: str, + workspace_name: str, + key_name: str, + **kwargs + ) -> "_models.Key": + """Gets a workspace key. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param key_name: The name of the workspace key. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/keys/{keyName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + key_name: str, + key_properties: "_models.Key", + **kwargs + ) -> "_models.Key": + """Creates or updates a workspace key. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param key_name: The name of the workspace key. + :type key_name: str + :param key_properties: Key put request properties. + :type key_properties: ~azure.mgmt.synapse.models.Key + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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['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(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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + 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 + + async def delete( + self, + resource_group_name: str, + workspace_name: str, + key_name: str, + **kwargs + ) -> Optional["_models.Key"]: + """Deletes a workspace key. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param key_name: The name of the workspace key. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.Key or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Key"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + 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/_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_operations.py new file mode 100644 index 000000000000..51e84348a6fa --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_operations.py @@ -0,0 +1,278 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def check_name_availability( + self, + request: "_models.CheckNameAvailabilityRequest", + **kwargs + ) -> "_models.CheckNameAvailabilityResponse": + """Check name availability. + + Check whether a workspace name is available. + + :param request: The check request. + :type request: ~azure.mgmt.synapse.models.CheckNameAvailabilityRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResponse, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.CheckNameAvailabilityResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, '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] + 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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/checkNameAvailability'} # type: ignore + + async def list( + self, + **kwargs + ) -> List["_models.AvailableRpOperation"]: + """All operations. + + Get all available operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of AvailableRpOperation, or the result of cls(response) + :rtype: list[~azure.mgmt.synapse.models.AvailableRpOperation] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.AvailableRpOperation"]] + error_map = { + 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] + + # 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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('[AvailableRpOperation]', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.Synapse/operations'} # type: ignore + + async def get_location_header_result( + self, + resource_group_name: str, + workspace_name: str, + operation_id: str, + **kwargs + ) -> None: + """Get operation result. + + Get the result of an operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param operation_id: Operation ID. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + get_location_header_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/operationResults/{operationId}'} # type: ignore + + async def get_azure_async_header_result( + self, + resource_group_name: str, + workspace_name: str, + operation_id: str, + **kwargs + ) -> Optional["_models.OperationResource"]: + """Get operation status. + + Get the status of an operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param operation_id: Operation ID. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationResource, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.OperationResource or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationResource', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..4f2b93c7dc23 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,442 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations: + """PrivateEndpointConnectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> "_models.PrivateEndpointConnection": + """Gets a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + 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, + workspace_name: str, + private_endpoint_connection_name: str, + request: "_models.PrivateEndpointConnection", + **kwargs + ) -> "_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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(request, '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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + request: "_models.PrivateEndpointConnection", + **kwargs + ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + """Approve or reject a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :param request: Request body of private endpoint connection to 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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + private_endpoint_connection_name=private_endpoint_connection_name, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 202: + deserialized = self._deserialize('OperationResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> AsyncLROPoller["_models.OperationResource"]: + """Delete a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def list( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> AsyncIterable["_models.PrivateEndpointConnectionList"]: + """Lists private endpoint connection in workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections'} # type: ignore 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 new file mode 100644 index 000000000000..82a3230e0300 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_endpoint_connections_private_link_hub_operations.py @@ -0,0 +1,117 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsPrivateLinkHubOperations: + """PrivateEndpointConnectionsPrivateLinkHubOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + private_link_hub_name: str, + **kwargs + ) -> AsyncIterable["_models.PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse"]: + """Get all PrivateEndpointConnections in the PrivateLinkHub. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}/privateEndpointConnections'} # 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 new file mode 100644 index 000000000000..263aaa2e598b --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_link_hubs_operations.py @@ -0,0 +1,492 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkHubsOperations: + """PrivateLinkHubsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_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) + :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"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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_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, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateLinkHubInfoListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs'} # type: ignore + + async def get( + self, + resource_group_name: str, + private_link_hub_name: str, + **kwargs + ) -> "_models.PrivateLinkHub": + """Gets a privateLinkHub. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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: PrivateLinkHub, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.PrivateLinkHub + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkHub"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkHub', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + private_link_hub_name: str, + private_link_hub_patch_info: "_models.PrivateLinkHubPatchInfo", + **kwargs + ) -> "_models.PrivateLinkHub": + """Updates a privateLinkHub. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_link_hub_name: Name of the privateLinkHub. + :type private_link_hub_name: str + :param private_link_hub_patch_info: PrivateLinkHub patch request properties. + :type private_link_hub_patch_info: ~azure.mgmt.synapse.models.PrivateLinkHubPatchInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkHub, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.PrivateLinkHub + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkHub"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['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(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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateLinkHub', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateLinkHub', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + private_link_hub_name: str, + private_link_hub_info: "_models.PrivateLinkHub", + **kwargs + ) -> "_models.PrivateLinkHub": + """Creates or updates a privateLinkHub. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_link_hub_name: Name of the privateLinkHub. + :type private_link_hub_name: str + :param private_link_hub_info: PrivateLinkHub create or update request properties. + :type private_link_hub_info: ~azure.mgmt.synapse.models.PrivateLinkHub + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkHub, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.PrivateLinkHub + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkHub"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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['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(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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateLinkHub', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateLinkHub', pipeline_response) + + if cls: + 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, + private_link_hub_name: str, + **kwargs + ) -> 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + private_link_hub_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a privateLinkHub. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + private_link_hub_name=private_link_hub_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}'} # type: ignore + + def list( + self, + **kwargs + ) -> AsyncIterable["_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) + :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"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateLinkHubInfoListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/privateLinkHubs'} # type: ignore 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 new file mode 100644 index 000000000000..08e083c63974 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,184 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations: + """PrivateLinkResourcesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> AsyncIterable["_models.PrivateLinkResourceListResult"]: + """Private Link Resources. + + Get all private link resources for a workspaces. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateLinkResources'} # type: ignore + + async def get( + self, + resource_group_name: str, + workspace_name: str, + private_link_resource_name: str, + **kwargs + ) -> "_models.PrivateLinkResource": + """Get Private Link Resource. + + Get private link resource in workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param private_link_resource_name: The name of the private link resource. + :type private_link_resource_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.PrivateLinkResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResource', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..96ebed6e2a33 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_restorable_dropped_sql_pools_operations.py @@ -0,0 +1,181 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RestorableDroppedSqlPoolsOperations: + """RestorableDroppedSqlPoolsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + restorable_dropped_sql_pool_id: str, + **kwargs + ) -> "_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. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param restorable_dropped_sql_pool_id: The id of the deleted Sql Pool in the form of + sqlPoolName,deletionTimeInFileTimeFormat. + :type restorable_dropped_sql_pool_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RestorableDroppedSqlPool, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.RestorableDroppedSqlPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableDroppedSqlPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RestorableDroppedSqlPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/restorableDroppedSqlPools/{restorableDroppedSqlPoolId}'} # type: ignore + + def list_by_workspace( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> AsyncIterable["_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. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableDroppedSqlPoolListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RestorableDroppedSqlPoolListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/restorableDroppedSqlPools'} # type: ignore 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 new file mode 100644 index 000000000000..9108426818f5 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_blob_auditing_policies_operations.py @@ -0,0 +1,264 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlPoolBlobAuditingPoliciesOperations: + """SqlPoolBlobAuditingPoliciesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs + ) -> "_models.SqlPoolBlobAuditingPolicy": + """Get a SQL pool's blob auditing policy. + + Get a SQL pool's blob auditing policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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: SqlPoolBlobAuditingPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SqlPoolBlobAuditingPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolBlobAuditingPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SqlPoolBlobAuditingPolicy', pipeline_response) + + if cls: + 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 + + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + parameters: "_models.SqlPoolBlobAuditingPolicy", + **kwargs + ) -> "_models.SqlPoolBlobAuditingPolicy": + """Creates or updates a SQL pool's blob auditing policy. + + Creates or updates a SQL pool's blob auditing policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param parameters: The database blob auditing policy. + :type parameters: ~azure.mgmt.synapse.models.SqlPoolBlobAuditingPolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlPoolBlobAuditingPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SqlPoolBlobAuditingPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolBlobAuditingPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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['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, '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 + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SqlPoolBlobAuditingPolicy', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SqlPoolBlobAuditingPolicy', pipeline_response) + + if cls: + 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 + + def list_by_sql_pool( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs + ) -> AsyncIterable["_models.SqlPoolBlobAuditingPolicyListResult"]: + """Lists auditing settings of a Sql pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolBlobAuditingPolicyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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_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, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SqlPoolBlobAuditingPolicyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_sql_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/auditingSettings'} # type: ignore 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 new file mode 100644 index 000000000000..89be3c35ee3c --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_columns_operations.py @@ -0,0 +1,115 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlPoolColumnsOperations: + """SqlPoolColumnsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + table_name: str, + column_name: str, + **kwargs + ) -> "_models.SqlPoolColumn": + """Get Sql pool column. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :param column_name: The name of the column. + :type column_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlPoolColumn, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SqlPoolColumn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolColumn"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SqlPoolColumn', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..b215dbb7af0f --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_connection_policies_operations.py @@ -0,0 +1,110 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlPoolConnectionPoliciesOperations: + """SqlPoolConnectionPoliciesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + connection_policy_name: Union[str, "_models.ConnectionPolicyName"], + **kwargs + ) -> "_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. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param connection_policy_name: The name of the connection policy. + :type connection_policy_name: str or ~azure.mgmt.synapse.models.ConnectionPolicyName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlPoolConnectionPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SqlPoolConnectionPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolConnectionPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SqlPoolConnectionPolicy', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..b489a1c92bb6 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_data_warehouse_user_activities_operations.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlPoolDataWarehouseUserActivitiesOperations: + """SqlPoolDataWarehouseUserActivitiesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + data_warehouse_user_activity_name: Union[str, "_models.DataWarehouseUserActivityName"], + **kwargs + ) -> "_models.DataWarehouseUserActivities": + """Get SQL pool user activities. + + Gets the user activities of a SQL pool which includes running and suspended queries. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataWarehouseUserActivities"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataWarehouseUserActivities', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..7ebd7fbbadd6 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_geo_backup_policies_operations.py @@ -0,0 +1,192 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlPoolGeoBackupPoliciesOperations: + """SqlPoolGeoBackupPoliciesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs + ) -> AsyncIterable["_models.GeoBackupPolicyListResult"]: + """List SQL pool geo backup policies. + + Get list of SQL pool geo backup policies. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GeoBackupPolicyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('GeoBackupPolicyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/geoBackupPolicies'} # type: ignore + + async def get( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + geo_backup_policy_name: Union[str, "_models.GeoBackupPolicyName"], + **kwargs + ) -> "_models.GeoBackupPolicy": + """Get a SQL pool geo backup policy. + + Get the specified SQL pool geo backup policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param geo_backup_policy_name: The name of the geo backup policy. + :type geo_backup_policy_name: str or ~azure.mgmt.synapse.models.GeoBackupPolicyName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GeoBackupPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.GeoBackupPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GeoBackupPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('GeoBackupPolicy', pipeline_response) + + if cls: + 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_metadata_sync_configs_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_metadata_sync_configs_operations.py new file mode 100644 index 000000000000..80832e0484dd --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_metadata_sync_configs_operations.py @@ -0,0 +1,183 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlPoolMetadataSyncConfigsOperations: + """SqlPoolMetadataSyncConfigsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs + ) -> Optional["_models.MetadataSyncConfig"]: + """Get SQL pool metadata sync config. + + Get the metadata sync configuration for a SQL pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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: MetadataSyncConfig, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.MetadataSyncConfig or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MetadataSyncConfig"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MetadataSyncConfig', pipeline_response) + + if cls: + 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 + + async def create( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + metadata_sync_configuration: "_models.MetadataSyncConfig", + **kwargs + ) -> Optional["_models.MetadataSyncConfig"]: + """Set SQL pool metadata sync config. + + Set the metadata sync configuration for a SQL pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param metadata_sync_configuration: Metadata sync configuration. + :type metadata_sync_configuration: ~azure.mgmt.synapse.models.MetadataSyncConfig + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MetadataSyncConfig, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.MetadataSyncConfig or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MetadataSyncConfig"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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['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(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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MetadataSyncConfig', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..467faca89d04 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_operation_results_operations.py @@ -0,0 +1,114 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlPoolOperationResultsOperations: + """SqlPoolOperationResultsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get_location_header_result( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + operation_id: str, + **kwargs + ) -> object: + """Get SQL pool operation status. + + Get the status of a SQL pool operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param operation_id: Operation ID. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: object, or the result of cls(response) + :rtype: object + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[object] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('object', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('object', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..f9db8f683f82 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_operations_operations.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlPoolOperationsOperations: + """SqlPoolOperationsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs + ) -> AsyncIterable["_models.SqlPoolBlobAuditingPolicySqlPoolOperationListResult"]: + """Gets a list of operations performed on the SQL pool. + + Gets a list of operations performed on the SQL pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolBlobAuditingPolicySqlPoolOperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SqlPoolBlobAuditingPolicySqlPoolOperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/operations'} # 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 new file mode 100644 index 000000000000..51822f011ed2 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_replication_links_operations.py @@ -0,0 +1,192 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlPoolReplicationLinksOperations: + """SqlPoolReplicationLinksOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs + ) -> AsyncIterable["_models.ReplicationLinkListResult"]: + """Get SQL pool replication links. + + Lists a Sql pool's replication links. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationLinkListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ReplicationLinkListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/replicationLinks'} # type: ignore + + async def get_by_name( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + link_id: str, + **kwargs + ) -> "_models.ReplicationLink": + """Get SQL pool replication link by name. + + Get SQL pool replication link by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param link_id: The ID of the replication link. + :type link_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ReplicationLink, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.ReplicationLink + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationLink"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ReplicationLink', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..d16a72557694 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_restore_points_operations.py @@ -0,0 +1,388 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlPoolRestorePointsOperations: + """SqlPoolRestorePointsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs + ) -> AsyncIterable["_models.RestorePointListResult"]: + """Get SQL pool backup. + + Get SQL pool backup information. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RestorePointListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints'} # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + parameters: "_models.CreateSqlPoolRestorePointDefinition", + **kwargs + ) -> 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['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, '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 + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('RestorePoint', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('RestorePoint', pipeline_response) + + if cls: + 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 + + async def begin_create( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + parameters: "_models.CreateSqlPoolRestorePointDefinition", + **kwargs + ) -> AsyncLROPoller["_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. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param parameters: The definition for creating the restore point of this Sql pool. + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either RestorePoint or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.RestorePoint] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints'} # type: ignore + + async def get( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + restore_point_name: str, + **kwargs + ) -> "_models.RestorePoint": + """Gets a restore point. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param restore_point_name: The name of the restore point. + :type restore_point_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RestorePoint, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.RestorePoint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RestorePoint', pipeline_response) + + if cls: + 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 + + async def delete( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + restore_point_name: str, + **kwargs + ) -> None: + """Deletes a restore point. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param restore_point_name: The name of the restore point. + :type restore_point_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + + # 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.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 new file mode 100644 index 000000000000..515a664e143c --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_schemas_operations.py @@ -0,0 +1,193 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlPoolSchemasOperations: + """SqlPoolSchemasOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.SqlPoolSchemaListResult"]: + """Gets schemas of a given SQL pool. + + Gets schemas of a given SQL pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolSchemaListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SqlPoolSchemaListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas'} # type: ignore + + async def get( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + **kwargs + ) -> "_models.Resource": + """Get Sql Pool schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Resource, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.Resource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Resource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Resource', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..09860f982286 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_security_alert_policies_operations.py @@ -0,0 +1,270 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlPoolSecurityAlertPoliciesOperations: + """SqlPoolSecurityAlertPoliciesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs + ) -> AsyncIterable["_models.ListSqlPoolSecurityAlertPolicies"]: + """List Sql pool's security alert policies. + + Get a list of Sql pool's security alert policies. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListSqlPoolSecurityAlertPolicies"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ListSqlPoolSecurityAlertPolicies', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies'} # type: ignore + + async def get( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyName"], + **kwargs + ) -> "_models.SqlPoolSecurityAlertPolicy": + """Get a Sql pool's security alert policy. + + Get a Sql pool's security alert policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_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.SecurityAlertPolicyName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlPoolSecurityAlertPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SqlPoolSecurityAlertPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolSecurityAlertPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SqlPoolSecurityAlertPolicy', pipeline_response) + + if cls: + 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 + + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyName"], + parameters: "_models.SqlPoolSecurityAlertPolicy", + **kwargs + ) -> "_models.SqlPoolSecurityAlertPolicy": + """Create or update a Sql pool's security alert policy. + + Create or update a Sql pool's security alert policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_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.SecurityAlertPolicyName + :param parameters: The Sql pool security alert policy. + :type parameters: ~azure.mgmt.synapse.models.SqlPoolSecurityAlertPolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlPoolSecurityAlertPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SqlPoolSecurityAlertPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolSecurityAlertPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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['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, '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 + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SqlPoolSecurityAlertPolicy', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SqlPoolSecurityAlertPolicy', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..da1d36906d2f --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_sensitivity_labels_operations.py @@ -0,0 +1,605 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlPoolSensitivityLabelsOperations: + """SqlPoolSensitivityLabelsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_current( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.SensitivityLabelListResult"]: + """Gets SQL pool sensitivity labels. + + Gets SQL pool sensitivity labels. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SensitivityLabelListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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_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, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SensitivityLabelListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_current.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/currentSensitivityLabels'} # type: ignore + + def list_recommended( + self, + 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 + ) -> AsyncIterable["_models.SensitivityLabelListResult"]: + """Gets sensitivity labels of a given SQL pool. + + Gets sensitivity labels of a given SQL pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param include_disabled_recommendations: Specifies whether to include disabled recommendations + or not. + :type include_disabled_recommendations: bool + :param skip_token: An OData query option to indicate how many elements to skip in the + collection. + :type skip_token: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SensitivityLabelListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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_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, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SensitivityLabelListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_recommended.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/recommendedSensitivityLabels'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + table_name: str, + column_name: str, + parameters: "_models.SensitivityLabel", + **kwargs + ) -> "_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. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :param column_name: The name of the column. + :type column_name: str + :param parameters: The column sensitivity label resource. + :type parameters: ~azure.mgmt.synapse.models.SensitivityLabel + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SensitivityLabel, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SensitivityLabel + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SensitivityLabel"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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') + + 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 + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SensitivityLabel', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SensitivityLabel', pipeline_response) + + if cls: + 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 + + async def delete( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + table_name: str, + column_name: str, + **kwargs + ) -> 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. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :param column_name: The name of the column. + :type column_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}'} # type: ignore + + async def get( + self, + 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 + ) -> "_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. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :param column_name: The name of the column. + :type column_name: str + :param sensitivity_label_source: The source of the sensitivity label. + :type sensitivity_label_source: str or ~azure.mgmt.synapse.models.SensitivityLabelSource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SensitivityLabel, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SensitivityLabel + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SensitivityLabel"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SensitivityLabel', pipeline_response) + + if cls: + 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 + + async def enable_recommendation( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + table_name: str, + column_name: str, + **kwargs + ) -> None: + """Enables sensitivity recommendations on a given column (recommendations are enabled by default + on all columns). + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :param column_name: The name of the column. + :type column_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + 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 + + async def disable_recommendation( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + table_name: str, + column_name: str, + **kwargs + ) -> None: + """Disables sensitivity recommendations on a given column. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :param column_name: The name of the column. + :type column_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + disable_recommendation.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 new file mode 100644 index 000000000000..225b8b908076 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_table_columns_operations.py @@ -0,0 +1,135 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlPoolTableColumnsOperations: + """SqlPoolTableColumnsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_table_name( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + table_name: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.SqlPoolColumnListResult"]: + """Gets columns in a given table in a SQL pool. + + Gets columns in a given table in a SQL pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolColumnListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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_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, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SqlPoolColumnListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_table_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns'} # type: ignore 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 new file mode 100644 index 000000000000..d13a7fb25884 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_tables_operations.py @@ -0,0 +1,201 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlPoolTablesOperations: + """SqlPoolTablesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_schema( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + filter: Optional[str] = None, + **kwargs + ) -> AsyncIterable["_models.SqlPoolTableListResult"]: + """Gets tables of a given schema in a SQL pool. + + Gets tables of a given schema in a SQL pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolTableListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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_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, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SqlPoolTableListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_schema.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables'} # type: ignore + + async def get( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + schema_name: str, + table_name: str, + **kwargs + ) -> "_models.Resource": + """Get Sql pool table. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Resource, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.Resource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Resource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Resource', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..f44f648b29a8 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_transparent_data_encryptions_operations.py @@ -0,0 +1,275 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlPoolTransparentDataEncryptionsOperations: + """SqlPoolTransparentDataEncryptionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + transparent_data_encryption_name: Union[str, "_models.TransparentDataEncryptionName"], + **kwargs + ) -> "_models.TransparentDataEncryption": + """Get a SQL pool's transparent data encryption configuration. + + Get a SQL pool's transparent data encryption configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :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 + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TransparentDataEncryption"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('TransparentDataEncryption', pipeline_response) + + if cls: + 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 + + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + transparent_data_encryption_name: Union[str, "_models.TransparentDataEncryptionName"], + parameters: "_models.TransparentDataEncryption", + **kwargs + ) -> "_models.TransparentDataEncryption": + """Creates or updates a Sql pool's transparent data encryption configuration. + + Creates or updates a Sql pool's transparent data encryption configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :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 + :param parameters: The required parameters for creating or updating transparent data + encryption. + :type parameters: ~azure.mgmt.synapse.models.TransparentDataEncryption + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TransparentDataEncryption"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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['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, '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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('TransparentDataEncryption', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('TransparentDataEncryption', pipeline_response) + + if cls: + 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 + + def list( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs + ) -> AsyncIterable["_models.TransparentDataEncryptionListResult"]: + """SQL pool's transparent data encryption configurations. + + Get list of SQL pool's transparent data encryption configurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TransparentDataEncryptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('TransparentDataEncryptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption'} # type: ignore 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 new file mode 100644 index 000000000000..04d81bad4cf6 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_usages_operations.py @@ -0,0 +1,123 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlPoolUsagesOperations: + """SqlPoolUsagesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs + ) -> AsyncIterable["_models.SqlPoolUsageListResult"]: + """Gets SQL pool usages. + + Gets SQL pool usages. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolUsageListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SqlPoolUsageListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/usages'} # type: ignore 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 new file mode 100644 index 000000000000..80fa66d438b0 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_vulnerability_assessment_rule_baselines_operations.py @@ -0,0 +1,269 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlPoolVulnerabilityAssessmentRuleBaselinesOperations: + """SqlPoolVulnerabilityAssessmentRuleBaselinesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def create_or_update( + self, + 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 + ) -> "_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. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :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 + :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 + :return: SqlPoolVulnerabilityAssessmentRuleBaseline, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessmentRuleBaseline + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolVulnerabilityAssessmentRuleBaseline"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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') + + 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 + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SqlPoolVulnerabilityAssessmentRuleBaseline', pipeline_response) + + if cls: + 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 + + async def delete( + self, + 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 + ) -> None: + """Removes the database's vulnerability assessment rule baseline. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = "2019-06-01-preview" + + # 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, pattern=r'^[-\w\._\(\)]+$'), + '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] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}'} # type: ignore + + async def get( + self, + 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 + ) -> "_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. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :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 + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolVulnerabilityAssessmentRuleBaseline"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['Accept'] = self._serialize.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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SqlPoolVulnerabilityAssessmentRuleBaseline', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..7a8f46c81826 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_vulnerability_assessment_scans_operations.py @@ -0,0 +1,399 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlPoolVulnerabilityAssessmentScansOperations: + """SqlPoolVulnerabilityAssessmentScansOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + **kwargs + ) -> AsyncIterable["_models.VulnerabilityAssessmentScanRecordListResult"]: + """Lists the vulnerability assessment scans of a SQL pool. + + Lists the vulnerability assessment scans of a SQL pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VulnerabilityAssessmentScanRecordListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VulnerabilityAssessmentScanRecordListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans'} # type: ignore + + async def _initiate_scan_initial( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + scan_id: str, + **kwargs + ) -> 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 = "2019-06-01-preview" + + # 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _initiate_scan_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan'} # type: ignore + + async def begin_initiate_scan( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + scan_id: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Executes a Vulnerability Assessment database scan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._initiate_scan_initial( + 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, + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_initiate_scan.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan'} # type: ignore + + async def export( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + scan_id: str, + **kwargs + ) -> "_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. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :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 + :return: SqlPoolVulnerabilityAssessmentScansExport, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessmentScansExport + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolVulnerabilityAssessmentScansExport"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.post(url, query_parameters, header_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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SqlPoolVulnerabilityAssessmentScansExport', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SqlPoolVulnerabilityAssessmentScansExport', pipeline_response) + + if cls: + 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 + + async def get( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + scan_id: str, + **kwargs + ) -> "_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. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :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 + :return: VulnerabilityAssessmentScanRecord, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.VulnerabilityAssessmentScanRecord + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VulnerabilityAssessmentScanRecord"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VulnerabilityAssessmentScanRecord', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..4ffe1d3feba1 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_vulnerability_assessments_operations.py @@ -0,0 +1,333 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlPoolVulnerabilityAssessmentsOperations: + """SqlPoolVulnerabilityAssessmentsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs + ) -> AsyncIterable["_models.SqlPoolVulnerabilityAssessmentListResult"]: + """Lists the vulnerability assessment policies associated with a SQL pool. + + Lists the vulnerability assessment policies associated with a SQL pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolVulnerabilityAssessmentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SqlPoolVulnerabilityAssessmentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments'} # type: ignore + + async def get( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + **kwargs + ) -> "_models.SqlPoolVulnerabilityAssessment": + """Gets the Sql pool's vulnerability assessment. + + Gets the Sql pool's vulnerability assessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolVulnerabilityAssessment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SqlPoolVulnerabilityAssessment', pipeline_response) + + if cls: + 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 + + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + parameters: "_models.SqlPoolVulnerabilityAssessment", + **kwargs + ) -> "_models.SqlPoolVulnerabilityAssessment": + """Creates or updates the Sql pool vulnerability assessment. + + Creates or updates the Sql pool vulnerability assessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :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 + :return: SqlPoolVulnerabilityAssessment, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolVulnerabilityAssessment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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['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, '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 + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SqlPoolVulnerabilityAssessment', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('SqlPoolVulnerabilityAssessment', pipeline_response) + + if cls: + 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 + + async def delete( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + **kwargs + ) -> None: + """Removes the database's vulnerability assessment. + + Removes the database's vulnerability assessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = "2019-06-01-preview" + + # 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 new file mode 100644 index 000000000000..b5ee8574ea43 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_workload_classifier_operations.py @@ -0,0 +1,481 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlPoolWorkloadClassifierOperations: + """SqlPoolWorkloadClassifierOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + workload_classifier_name: str, + **kwargs + ) -> "_models.WorkloadClassifier": + """Get workload classifier. + + Get a workload classifier of Sql pool's workload group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param workload_group_name: The name of the workload group. + :type workload_group_name: str + :param workload_classifier_name: The name of the workload classifier. + :type workload_classifier_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkloadClassifier, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.WorkloadClassifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadClassifier"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WorkloadClassifier', pipeline_response) + + if cls: + 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, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + workload_classifier_name: str, + parameters: "_models.WorkloadClassifier", + **kwargs + ) -> 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['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, '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 + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WorkloadClassifier', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('WorkloadClassifier', pipeline_response) + + if cls: + 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 + + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + workload_classifier_name: str, + parameters: "_models.WorkloadClassifier", + **kwargs + ) -> AsyncLROPoller["_models.WorkloadClassifier"]: + """Create Or Update workload classifier. + + Create Or Update workload classifier for a Sql pool's workload group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param workload_group_name: The name of the workload group. + :type workload_group_name: str + :param workload_classifier_name: The name of the workload classifier. + :type workload_classifier_name: str + :param parameters: The properties of the workload classifier. + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadClassifier or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.WorkloadClassifier] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadClassifier"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + workload_group_name=workload_group_name, + workload_classifier_name=workload_classifier_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + workload_classifier_name: str, + **kwargs + ) -> 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 = "2019-06-01-preview" + + # 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = 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) + 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}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + workload_classifier_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Remove workload classifier. + + Remove workload classifier of a Sql pool's workload group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param workload_group_name: The name of the workload group. + :type workload_group_name: str + :param workload_classifier_name: The name of the workload classifier. + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + workload_group_name=workload_group_name, + workload_classifier_name=workload_classifier_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}'} # type: ignore + + def list( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + **kwargs + ) -> AsyncIterable["_models.WorkloadClassifierListResult"]: + """Sql pool's workload classifier. + + Get list of Sql pool's workload classifier for workload groups. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadClassifierListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('WorkloadClassifierListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers'} # type: ignore 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 new file mode 100644 index 000000000000..bd74b18c30f2 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pool_workload_group_operations.py @@ -0,0 +1,459 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlPoolWorkloadGroupOperations: + """SqlPoolWorkloadGroupOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + **kwargs + ) -> "_models.WorkloadGroup": + """Sql pool's workload group. + + Get a Sql pool's workload group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :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: WorkloadGroup, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.WorkloadGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WorkloadGroup', pipeline_response) + + if cls: + 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, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + parameters: "_models.WorkloadGroup", + **kwargs + ) -> 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['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, '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 + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WorkloadGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('WorkloadGroup', pipeline_response) + + if cls: + 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 + + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + parameters: "_models.WorkloadGroup", + **kwargs + ) -> AsyncLROPoller["_models.WorkloadGroup"]: + """Create Or Update workload group. + + Create Or Update a Sql pool's workload group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param workload_group_name: The name of the workload group. + :type workload_group_name: str + :param parameters: The requested workload group state. + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkloadGroup or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.WorkloadGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadGroup"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + workload_group_name=workload_group_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + **kwargs + ) -> 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 = "2019-06-01-preview" + + # 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = 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) + 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}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + workload_group_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Remove workload group. + + Remove Sql pool's workload group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + workload_group_name=workload_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}'} # type: ignore + + def list( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs + ) -> AsyncIterable["_models.WorkloadGroupListResult"]: + """Sql pool's workload groups. + + Get list of Sql pool's workload groups. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('WorkloadGroupListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups'} # type: ignore 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 new file mode 100644 index 000000000000..ff20bf982061 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_sql_pools_operations.py @@ -0,0 +1,778 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SqlPoolsOperations: + """SqlPoolsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs + ) -> "_models.SqlPool": + """Get SQL pool. + + Get SQL pool properties. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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: SqlPool, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SqlPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SqlPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + sql_pool_info: "_models.SqlPoolPatchInfo", + **kwargs + ) -> Optional["_models.SqlPool"]: + """Update SQL pool. + + Apply a partial update to a SQL pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param sql_pool_info: The updated SQL pool properties. + :type sql_pool_info: ~azure.mgmt.synapse.models.SqlPoolPatchInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlPool, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SqlPool or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['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(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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SqlPool', pipeline_response) + + if cls: + 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, + workspace_name: str, + sql_pool_name: str, + sql_pool_info: "_models.SqlPool", + **kwargs + ) -> 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['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(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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SqlPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} # type: ignore + + async def begin_create( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + sql_pool_info: "_models.SqlPool", + **kwargs + ) -> AsyncLROPoller["_models.SqlPool"]: + """Create SQL pool. + + Create a SQL pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param sql_pool_info: The SQL pool to 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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SqlPool or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.SqlPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPool"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + sql_pool_info=sql_pool_info, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs + ) -> Optional[object]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[object]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('object', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs + ) -> AsyncLROPoller[object]: + """Delete SQL pool. + + Delete a SQL pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either object or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[object] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[object] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} # type: ignore + + def list_by_workspace( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> AsyncIterable["_models.SqlPoolInfoListResult"]: + """List SQL pools. + + List all SQL pools. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolInfoListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SqlPoolInfoListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools'} # type: ignore + + async def _pause_initial( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs + ) -> Optional[object]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[object]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('object', pipeline_response) + + if cls: + 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 + + async def begin_pause( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs + ) -> AsyncLROPoller[object]: + """Pause SQL pool. + + Pause a SQL pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either object or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[object] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[object] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._pause_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_pause.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/pause'} # type: ignore + + async def _resume_initial( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs + ) -> Optional[object]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[object]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('object', pipeline_response) + + if cls: + 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 + + async def begin_resume( + self, + resource_group_name: str, + workspace_name: str, + sql_pool_name: str, + **kwargs + ) -> AsyncLROPoller[object]: + """Resume SQL pool. + + Resume a SQL pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either object or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[object] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[object] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._resume_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_resume.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/resume'} # 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 new file mode 100644 index 000000000000..9ad96ac56f57 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_aad_admins_operations.py @@ -0,0 +1,340 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WorkspaceAadAdminsOperations: + """WorkspaceAadAdminsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> "_models.WorkspaceAadAdminInfo": + """Gets a workspace active directory admin. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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: WorkspaceAadAdminInfo, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.WorkspaceAadAdminInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) + + if cls: + 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, + workspace_name: str, + aad_admin_info: "_models.WorkspaceAadAdminInfo", + **kwargs + ) -> "_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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['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(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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) + + if cls: + 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 + + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + aad_admin_info: "_models.WorkspaceAadAdminInfo", + **kwargs + ) -> AsyncLROPoller["_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. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param aad_admin_info: Workspace active directory administrator properties. + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkspaceAadAdminInfo or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.WorkspaceAadAdminInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceAadAdminInfo"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + aad_admin_info=aad_admin_info, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a workspace active directory admin. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 new file mode 100644 index 000000000000..f2399498a20a --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_identity_sql_control_settings_operations.py @@ -0,0 +1,173 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from 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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WorkspaceManagedIdentitySqlControlSettingsOperations: + """WorkspaceManagedIdentitySqlControlSettingsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> "_models.ManagedIdentitySqlControlSettingsModel": + """Get Managed Identity Sql Control Settings. + + Get Managed Identity Sql Control Settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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: ManagedIdentitySqlControlSettingsModel, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.ManagedIdentitySqlControlSettingsModel + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedIdentitySqlControlSettingsModel"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedIdentitySqlControlSettingsModel', pipeline_response) + + if cls: + 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( + self, + resource_group_name: str, + workspace_name: str, + managed_identity_sql_control_settings: "_models.ManagedIdentitySqlControlSettingsModel", + **kwargs + ) -> Optional["_models.ManagedIdentitySqlControlSettingsModel"]: + """Create or update Managed Identity Sql Control Settings. + + Create or update Managed Identity Sql Control Settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedIdentitySqlControlSettingsModel, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.ManagedIdentitySqlControlSettingsModel or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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['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(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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ManagedIdentitySqlControlSettingsModel', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + 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 new file mode 100644 index 000000000000..cc9bc7a0775b --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_blob_auditing_policies_operations.py @@ -0,0 +1,319 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WorkspaceManagedSqlServerBlobAuditingPoliciesOperations: + """WorkspaceManagedSqlServerBlobAuditingPoliciesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + blob_auditing_policy_name: Union[str, "_models.BlobAuditingPolicyName"], + **kwargs + ) -> "_models.ServerBlobAuditingPolicy": + """Get server's blob auditing policy. + + Get a workspace managed sql server's blob auditing policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param blob_auditing_policy_name: The name of the blob auditing policy. + :type blob_auditing_policy_name: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServerBlobAuditingPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.ServerBlobAuditingPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerBlobAuditingPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ServerBlobAuditingPolicy', pipeline_response) + + if cls: + 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, + workspace_name: str, + blob_auditing_policy_name: Union[str, "_models.BlobAuditingPolicyName"], + parameters: "_models.ServerBlobAuditingPolicy", + **kwargs + ) -> 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['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, '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 + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ServerBlobAuditingPolicy', pipeline_response) + + if cls: + 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 + + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + blob_auditing_policy_name: Union[str, "_models.BlobAuditingPolicyName"], + parameters: "_models.ServerBlobAuditingPolicy", + **kwargs + ) -> AsyncLROPoller["_models.ServerBlobAuditingPolicy"]: + """Create or Update server's blob auditing policy. + + Create or Update a workspace managed sql server's blob auditing policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param blob_auditing_policy_name: The name of the blob auditing policy. + :type blob_auditing_policy_name: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyName + :param parameters: Properties of extended blob auditing policy. + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServerBlobAuditingPolicy or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.ServerBlobAuditingPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerBlobAuditingPolicy"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + blob_auditing_policy_name=blob_auditing_policy_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/auditingSettings/{blobAuditingPolicyName}'} # type: ignore + + def list_by_workspace( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> AsyncIterable["_models.ServerBlobAuditingPolicyListResult"]: + """List workspace server's blob auditing policies. + + List workspace managed sql server's blob auditing policies. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerBlobAuditingPolicyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ServerBlobAuditingPolicyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/auditingSettings'} # 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 new file mode 100644 index 000000000000..64ff15fb3a28 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_extended_blob_auditing_policies_operations.py @@ -0,0 +1,319 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations: + """WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + blob_auditing_policy_name: Union[str, "_models.BlobAuditingPolicyName"], + **kwargs + ) -> "_models.ExtendedServerBlobAuditingPolicy": + """Get server's extended blob auditing policy. + + Get a workspace SQL server's extended blob auditing policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param blob_auditing_policy_name: The name of the blob auditing policy. + :type blob_auditing_policy_name: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExtendedServerBlobAuditingPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.ExtendedServerBlobAuditingPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtendedServerBlobAuditingPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ExtendedServerBlobAuditingPolicy', pipeline_response) + + if cls: + 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, + workspace_name: str, + blob_auditing_policy_name: Union[str, "_models.BlobAuditingPolicyName"], + parameters: "_models.ExtendedServerBlobAuditingPolicy", + **kwargs + ) -> 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['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, '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 + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ExtendedServerBlobAuditingPolicy', pipeline_response) + + if cls: + 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 + + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + blob_auditing_policy_name: Union[str, "_models.BlobAuditingPolicyName"], + parameters: "_models.ExtendedServerBlobAuditingPolicy", + **kwargs + ) -> AsyncLROPoller["_models.ExtendedServerBlobAuditingPolicy"]: + """Create or Update server's extended blob auditing policy. + + Create or Update a workspace managed sql server's extended blob auditing policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param blob_auditing_policy_name: The name of the blob auditing policy. + :type blob_auditing_policy_name: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyName + :param parameters: Properties of extended blob auditing policy. + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtendedServerBlobAuditingPolicy"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + blob_auditing_policy_name=blob_auditing_policy_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/extendedAuditingSettings/{blobAuditingPolicyName}'} # type: ignore + + def list_by_workspace( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> AsyncIterable["_models.ExtendedServerBlobAuditingPolicyListResult"]: + """List server's extended blob auditing policies. + + List workspace managed sql server's extended blob auditing policies. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtendedServerBlobAuditingPolicyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ExtendedServerBlobAuditingPolicyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/extendedAuditingSettings'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_recoverable_sqlpools_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_recoverable_sqlpools_operations.py new file mode 100644 index 000000000000..ff8b71c03888 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_recoverable_sqlpools_operations.py @@ -0,0 +1,182 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WorkspaceManagedSqlServerRecoverableSqlpoolsOperations: + """WorkspaceManagedSqlServerRecoverableSqlpoolsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> AsyncIterable["_models.RecoverableSqlPoolListResult"]: + """Get list of recoverable sql pools for the server. + + Get list of recoverable sql pools for workspace managed sql server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoverableSqlPoolListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('RecoverableSqlPoolListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/recoverableSqlpools'} # type: ignore + + async def get( + self, + resource_group_name: str, + workspace_name: str, + sql_compute_name: str, + **kwargs + ) -> "_models.RecoverableSqlPool": + """Get recoverable sql pools for the server. + + Get recoverable sql pools for workspace managed sql server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_compute_name: The name of the sql compute. + :type sql_compute_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecoverableSqlPool, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.RecoverableSqlPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoverableSqlPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'sqlComputeName': self._serialize.url("sql_compute_name", sql_compute_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, 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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RecoverableSqlPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/recoverableSqlPools/{sqlComputeName}'} # 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 new file mode 100644 index 000000000000..8b469b24eb08 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_security_alert_policy_operations.py @@ -0,0 +1,319 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WorkspaceManagedSqlServerSecurityAlertPolicyOperations: + """WorkspaceManagedSqlServerSecurityAlertPolicyOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyNameAutoGenerated"], + **kwargs + ) -> "_models.ServerSecurityAlertPolicy": + """Get server's security alert policy. + + Get a workspace managed sql server's security alert policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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 + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerSecurityAlertPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ServerSecurityAlertPolicy', pipeline_response) + + if cls: + 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, + workspace_name: str, + security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyNameAutoGenerated"], + parameters: "_models.ServerSecurityAlertPolicy", + **kwargs + ) -> 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['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, '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 + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ServerSecurityAlertPolicy', pipeline_response) + + if cls: + 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 + + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + security_alert_policy_name: Union[str, "_models.SecurityAlertPolicyNameAutoGenerated"], + parameters: "_models.ServerSecurityAlertPolicy", + **kwargs + ) -> AsyncLROPoller["_models.ServerSecurityAlertPolicy"]: + """Create or Update server's threat detection policy. + + Create or Update a workspace managed sql server's threat detection policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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 + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either 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] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerSecurityAlertPolicy"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + security_alert_policy_name=security_alert_policy_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/securityAlertPolicies/{securityAlertPolicyName}'} # type: ignore + + def list( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> AsyncIterable["_models.ServerSecurityAlertPolicyListResult"]: + """Get server's threat detection policies. + + Get workspace managed sql server's threat detection policies. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerSecurityAlertPolicyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ServerSecurityAlertPolicyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/securityAlertPolicies'} # type: ignore 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 new file mode 100644 index 000000000000..bc0fda8176b0 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_usages_operations.py @@ -0,0 +1,118 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WorkspaceManagedSqlServerUsagesOperations: + """WorkspaceManagedSqlServerUsagesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> AsyncIterable["_models.ServerUsageListResult"]: + """Get list of usages metric for the server. + + Get list of server usages metric for workspace managed sql server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerUsageListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ServerUsageListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlUsages'} # type: ignore 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 new file mode 100644 index 000000000000..993db5d7391c --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_managed_sql_server_vulnerability_assessments_operations.py @@ -0,0 +1,317 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations: + """WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + **kwargs + ) -> "_models.ServerVulnerabilityAssessment": + """Get server's vulnerability assessment. + + Get workspace managed sql server's vulnerability assessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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 + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerVulnerabilityAssessment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ServerVulnerabilityAssessment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + parameters: "_models.ServerVulnerabilityAssessment", + **kwargs + ) -> "_models.ServerVulnerabilityAssessment": + """Create or Update server's vulnerability assessment. + + Create or Update workspace managed sql server's vulnerability assessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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 + :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 + :return: ServerVulnerabilityAssessment, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.ServerVulnerabilityAssessment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerVulnerabilityAssessment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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['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, '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 + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServerVulnerabilityAssessment', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ServerVulnerabilityAssessment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + workspace_name: str, + vulnerability_assessment_name: Union[str, "_models.VulnerabilityAssessmentName"], + **kwargs + ) -> None: + """Remove server's vulnerability assessment. + + Remove workspace managed sql server's vulnerability assessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = "2019-06-01-preview" + + # 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} # type: ignore + + def list( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> AsyncIterable["_models.ServerVulnerabilityAssessmentListResult"]: + """Lists the vulnerability assessment policies associated with a server. + + Lists the vulnerability assessment policies associated with a workspace managed sql server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerVulnerabilityAssessmentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ServerVulnerabilityAssessmentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments'} # type: ignore 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 new file mode 100644 index 000000000000..653b2c6e9982 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspace_sql_aad_admins_operations.py @@ -0,0 +1,340 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WorkspaceSqlAadAdminsOperations: + """WorkspaceSqlAadAdminsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> "_models.WorkspaceAadAdminInfo": + """Gets a workspace SQL active directory admin. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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: WorkspaceAadAdminInfo, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.WorkspaceAadAdminInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) + + if cls: + 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, + workspace_name: str, + aad_admin_info: "_models.WorkspaceAadAdminInfo", + **kwargs + ) -> "_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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['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(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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) + + if cls: + 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 + + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + aad_admin_info: "_models.WorkspaceAadAdminInfo", + **kwargs + ) -> AsyncLROPoller["_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. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param aad_admin_info: Workspace active directory administrator properties. + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either WorkspaceAadAdminInfo or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.WorkspaceAadAdminInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceAadAdminInfo"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + aad_admin_info=aad_admin_info, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlAdministrators/activeDirectory'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlAdministrators/activeDirectory'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a workspace SQL active directory admin. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 new file mode 100644 index 000000000000..be65e88b3022 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_workspaces_operations.py @@ -0,0 +1,619 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WorkspacesOperations: + """WorkspacesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_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) + :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"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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_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, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('WorkspaceInfoListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces'} # type: ignore + + async def get( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> "_models.Workspace": + """Gets a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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: Workspace, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.Workspace + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Workspace', pipeline_response) + + if cls: + 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, + workspace_name: str, + workspace_patch_info: "_models.WorkspacePatchInfo", + **kwargs + ) -> "_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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['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(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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Workspace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Workspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_patch_info: "_models.WorkspacePatchInfo", + **kwargs + ) -> AsyncLROPoller["_models.Workspace"]: + """Updates a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param workspace_patch_info: Workspace patch request properties. + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Workspace or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.Workspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_patch_info=workspace_patch_info, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + workspace_info: "_models.Workspace", + **kwargs + ) -> "_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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['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(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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Workspace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Workspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace_info: "_models.Workspace", + **kwargs + ) -> AsyncLROPoller["_models.Workspace"]: + """Creates or updates a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param workspace_info: Workspace create or update request properties. + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Workspace or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.Workspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_info=workspace_info, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> Optional[object]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional[object]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('object', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> AsyncLROPoller[object]: + """Deletes a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either object or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[object] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[object] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore + + def list( + self, + **kwargs + ) -> AsyncIterable["_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) + :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"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('WorkspaceInfoListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/workspaces'} # type: ignore 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 3110806c789d..dabe1ee721f7 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 @@ -1,12 +1,9 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- try: @@ -17,21 +14,34 @@ from ._models_py3 import AzureEntityResource 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 CloudError + from ._models_py3 import CloudErrorAutoGenerated from ._models_py3 import CmdkeySetup from ._models_py3 import ComponentSetup from ._models_py3 import CreateSqlPoolRestorePointDefinition from ._models_py3 import CustomSetupBase + from ._models_py3 import CustomerManagedKeyDetails 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 EncryptionDetails from ._models_py3 import EntityReference from ._models_py3 import EnvironmentVariableSetup from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorContract, ErrorContractException + from ._models_py3 import ErrorContract from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse + from ._models_py3 import ExtendedServerBlobAuditingPolicy + from ._models_py3 import ExtendedServerBlobAuditingPolicyListResult + from ._models_py3 import ExtendedSqlPoolBlobAuditingPolicy + from ._models_py3 import ExtendedSqlPoolBlobAuditingPolicyListResult 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 @@ -40,6 +50,7 @@ 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 @@ -51,12 +62,16 @@ from ._models_py3 import IntegrationRuntimeStatusResponse from ._models_py3 import IntegrationRuntimeVNetProperties from ._models_py3 import IpFirewallRuleInfo + from ._models_py3 import IpFirewallRuleInfoListResult from ._models_py3 import IpFirewallRuleProperties + from ._models_py3 import Key + from ._models_py3 import KeyInfoListResult from ._models_py3 import LibraryRequirements from ._models_py3 import LinkedIntegrationRuntime from ._models_py3 import LinkedIntegrationRuntimeKeyAuthorization from ._models_py3 import LinkedIntegrationRuntimeRbacAuthorization from ._models_py3 import LinkedIntegrationRuntimeType + from ._models_py3 import ListSqlPoolSecurityAlertPolicies from ._models_py3 import ManagedIdentity from ._models_py3 import ManagedIdentitySqlControlSettingsModel from ._models_py3 import ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity @@ -65,6 +80,7 @@ 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 OperationMetaLogSpecification from ._models_py3 import OperationMetaMetricDimensionSpecification @@ -73,37 +89,70 @@ from ._models_py3 import OperationResource 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 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 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 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 @@ -122,190 +171,258 @@ 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 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 AutoPauseProperties - from ._models import AutoScaleProperties - from ._models import AvailableRpOperation - from ._models import AvailableRpOperationDisplayInfo - from ._models import AzureEntityResource - from ._models import BigDataPoolPatchInfo - from ._models import BigDataPoolResourceInfo - from ._models import CheckNameAvailabilityRequest - from ._models import CheckNameAvailabilityResponse - from ._models import CmdkeySetup - from ._models import ComponentSetup - from ._models import CreateSqlPoolRestorePointDefinition - from ._models import CustomSetupBase - from ._models import DataLakeStorageAccountDetails - from ._models import DataWarehouseUserActivities - from ._models import EntityReference - from ._models import EnvironmentVariableSetup - from ._models import ErrorAdditionalInfo - from ._models import ErrorContract, ErrorContractException - from ._models import ErrorDetail - from ._models import ErrorResponse - from ._models import GeoBackupPolicy - from ._models import GetSsisObjectMetadataRequest - from ._models import IntegrationRuntime - from ._models import IntegrationRuntimeAuthKeys - from ._models import IntegrationRuntimeComputeProperties - from ._models import IntegrationRuntimeConnectionInfo - from ._models import IntegrationRuntimeCustomSetupScriptProperties - from ._models import IntegrationRuntimeDataFlowProperties - from ._models import IntegrationRuntimeDataProxyProperties - from ._models import IntegrationRuntimeMonitoringData - from ._models import IntegrationRuntimeNodeIpAddress - from ._models import IntegrationRuntimeNodeMonitoringData - from ._models import IntegrationRuntimeRegenerateKeyParameters - from ._models import IntegrationRuntimeResource - from ._models import IntegrationRuntimeSsisCatalogInfo - from ._models import IntegrationRuntimeSsisProperties - from ._models import IntegrationRuntimeStatus - from ._models import IntegrationRuntimeStatusResponse - from ._models import IntegrationRuntimeVNetProperties - from ._models import IpFirewallRuleInfo - from ._models import IpFirewallRuleProperties - from ._models import LibraryRequirements - from ._models import LinkedIntegrationRuntime - from ._models import LinkedIntegrationRuntimeKeyAuthorization - from ._models import LinkedIntegrationRuntimeRbacAuthorization - from ._models import LinkedIntegrationRuntimeType - from ._models import ManagedIdentity - from ._models import ManagedIdentitySqlControlSettingsModel - from ._models import ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity - from ._models import ManagedIntegrationRuntime - from ._models import ManagedIntegrationRuntimeError - from ._models import ManagedIntegrationRuntimeNode - from ._models import ManagedIntegrationRuntimeOperationResult - from ._models import ManagedIntegrationRuntimeStatus - from ._models import MetadataSyncConfig - from ._models import OperationMetaLogSpecification - from ._models import OperationMetaMetricDimensionSpecification - from ._models import OperationMetaMetricSpecification - from ._models import OperationMetaServiceSpecification - from ._models import OperationResource - from ._models import PrivateEndpoint - from ._models import PrivateEndpointConnection - from ._models import PrivateLinkResource - from ._models import PrivateLinkResourceProperties - from ._models import PrivateLinkServiceConnectionState - from ._models import ProxyResource - from ._models import QueryInterval - from ._models import QueryMetric - from ._models import QueryStatistic - from ._models import ReplaceAllFirewallRulesOperationResponse - from ._models import ReplaceAllIpFirewallRulesRequest - from ._models import ReplicationLink - from ._models import Resource - from ._models import ResourceMoveDefinition - from ._models import RestorePoint - from ._models import SecretBase - from ._models import SecureString - from ._models import SelfHostedIntegrationRuntime - from ._models import SelfHostedIntegrationRuntimeNode - from ._models import SelfHostedIntegrationRuntimeStatus - from ._models import SensitivityLabel - from ._models import Sku - from ._models import SqlPool - from ._models import SqlPoolBlobAuditingPolicy - from ._models import SqlPoolColumn - from ._models import SqlPoolConnectionPolicy - from ._models import SqlPoolOperation - from ._models import SqlPoolPatchInfo - from ._models import SqlPoolSchema - from ._models import SqlPoolSecurityAlertPolicy - from ._models import SqlPoolTable - from ._models import SqlPoolUsage - from ._models import SqlPoolVulnerabilityAssessment - from ._models import SqlPoolVulnerabilityAssessmentRuleBaseline - from ._models import SqlPoolVulnerabilityAssessmentRuleBaselineItem - from ._models import SqlPoolVulnerabilityAssessmentScansExport - from ._models import SsisEnvironment - from ._models import SsisEnvironmentReference - from ._models import SsisFolder - from ._models import SsisObjectMetadata - from ._models import SsisObjectMetadataListResponse - from ._models import SsisObjectMetadataStatusResponse - from ._models import SsisPackage - from ._models import SsisParameter - from ._models import SsisProject - from ._models import SsisVariable - from ._models import SubResource - from ._models import TopQueries - from ._models import TopQueriesListResult - from ._models import TrackedResource - from ._models import TransparentDataEncryption - from ._models import UpdateIntegrationRuntimeNodeRequest - from ._models import UpdateIntegrationRuntimeRequest - from ._models import VirtualNetworkProfile - from ._models import VulnerabilityAssessmentRecurringScansProperties - from ._models import VulnerabilityAssessmentScanError - from ._models import VulnerabilityAssessmentScanRecord - from ._models import Workspace - from ._models import WorkspaceAadAdminInfo - from ._models import WorkspacePatchInfo -from ._paged_models import BigDataPoolResourceInfoPaged -from ._paged_models import IntegrationRuntimeResourcePaged -from ._paged_models import IpFirewallRuleInfoPaged -from ._paged_models import PrivateEndpointConnectionPaged -from ._paged_models import PrivateLinkResourcePaged -from ._paged_models import ReplicationLinkPaged -from ._paged_models import RestorePointPaged -from ._paged_models import SensitivityLabelPaged -from ._paged_models import SqlPoolColumnPaged -from ._paged_models import SqlPoolOperationPaged -from ._paged_models import SqlPoolPaged -from ._paged_models import SqlPoolSchemaPaged -from ._paged_models import SqlPoolTablePaged -from ._paged_models import SqlPoolUsagePaged -from ._paged_models import SqlPoolVulnerabilityAssessmentPaged -from ._paged_models import VulnerabilityAssessmentScanRecordPaged -from ._paged_models import WorkspacePaged + 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 AzureEntityResource # 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 CloudError # type: ignore + from ._models import CloudErrorAutoGenerated # type: ignore + from ._models import CmdkeySetup # type: ignore + from ._models import ComponentSetup # type: ignore + from ._models import CreateSqlPoolRestorePointDefinition # type: ignore + from ._models import CustomSetupBase # type: ignore + from ._models import CustomerManagedKeyDetails # 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 EncryptionDetails # type: ignore + from ._models import EntityReference # type: ignore + from ._models import EnvironmentVariableSetup # type: ignore + from ._models import ErrorAdditionalInfo # type: ignore + from ._models import ErrorContract # type: ignore + from ._models import ErrorDetail # type: ignore + from ._models import ErrorResponse # 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 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 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 IpFirewallRuleInfo # type: ignore + from ._models import IpFirewallRuleInfoListResult # type: ignore + from ._models import IpFirewallRuleProperties # type: ignore + from ._models import Key # type: ignore + from ._models import KeyInfoListResult # type: ignore + from ._models import LibraryRequirements # 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 ListSqlPoolSecurityAlertPolicies # 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 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 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 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 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 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 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 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 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 ._synapse_management_client_enums import ( + BlobAuditingPolicyName, + BlobAuditingPolicyState, + ColumnDataType, + ConnectionPolicyName, + DataFlowComputeType, + DataMaskingFunction, + DataMaskingRuleState, + DataMaskingState, + DataWarehouseUserActivityName, + GeoBackupPolicyName, + GeoBackupPolicyState, + IntegrationRuntimeAuthKeyName, + IntegrationRuntimeAutoUpdate, + IntegrationRuntimeEdition, + IntegrationRuntimeEntityReferenceType, + IntegrationRuntimeInternalChannelEncryptionMode, + IntegrationRuntimeLicenseType, + IntegrationRuntimeSsisCatalogPricingTier, + IntegrationRuntimeState, + IntegrationRuntimeType, + IntegrationRuntimeUpdateResult, + ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentityActualState, + ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentityDesiredState, + ManagedIntegrationRuntimeNodeStatus, + ManagementOperationState, NodeSize, NodeSizeFamily, - ProvisioningState, OperationStatus, - GeoBackupPolicyState, + ProvisioningState, QueryAggregationFunction, QueryExecutionType, - QueryObservedMetricType, QueryMetricUnit, - RestorePointType, + QueryObservedMetricType, ReplicationRole, ReplicationState, - TransparentDataEncryptionStatus, - BlobAuditingPolicyState, - ManagementOperationState, - ColumnDataType, - VulnerabilityAssessmentScanTriggerType, - VulnerabilityAssessmentScanState, - SecurityAlertPolicyState, ResourceIdentityType, - IntegrationRuntimeType, - IntegrationRuntimeState, - DataFlowComputeType, - IntegrationRuntimeSsisCatalogPricingTier, - IntegrationRuntimeLicenseType, - IntegrationRuntimeEntityReferenceType, - IntegrationRuntimeEdition, - ManagedIntegrationRuntimeNodeStatus, - IntegrationRuntimeInternalChannelEncryptionMode, + RestorePointType, + SecurityAlertPolicyName, + SecurityAlertPolicyNameAutoGenerated, + SecurityAlertPolicyState, SelfHostedIntegrationRuntimeNodeStatus, - IntegrationRuntimeUpdateResult, - IntegrationRuntimeAutoUpdate, - IntegrationRuntimeAuthKeyName, + SensitivityLabelSource, SsisObjectMetadataType, + TransparentDataEncryptionName, + TransparentDataEncryptionStatus, + VulnerabilityAssessmentName, VulnerabilityAssessmentPolicyBaselineName, + VulnerabilityAssessmentScanState, + VulnerabilityAssessmentScanTriggerType, ) __all__ = [ @@ -316,21 +433,34 @@ 'AzureEntityResource', 'BigDataPoolPatchInfo', 'BigDataPoolResourceInfo', + 'BigDataPoolResourceInfoListResult', 'CheckNameAvailabilityRequest', 'CheckNameAvailabilityResponse', + 'CloudError', + 'CloudErrorAutoGenerated', 'CmdkeySetup', 'ComponentSetup', 'CreateSqlPoolRestorePointDefinition', 'CustomSetupBase', + 'CustomerManagedKeyDetails', 'DataLakeStorageAccountDetails', + 'DataMaskingPolicy', + 'DataMaskingRule', + 'DataMaskingRuleListResult', 'DataWarehouseUserActivities', + 'EncryptionDetails', 'EntityReference', 'EnvironmentVariableSetup', 'ErrorAdditionalInfo', - 'ErrorContract', 'ErrorContractException', + 'ErrorContract', 'ErrorDetail', 'ErrorResponse', + 'ExtendedServerBlobAuditingPolicy', + 'ExtendedServerBlobAuditingPolicyListResult', + 'ExtendedSqlPoolBlobAuditingPolicy', + 'ExtendedSqlPoolBlobAuditingPolicyListResult', 'GeoBackupPolicy', + 'GeoBackupPolicyListResult', 'GetSsisObjectMetadataRequest', 'IntegrationRuntime', 'IntegrationRuntimeAuthKeys', @@ -339,6 +469,7 @@ 'IntegrationRuntimeCustomSetupScriptProperties', 'IntegrationRuntimeDataFlowProperties', 'IntegrationRuntimeDataProxyProperties', + 'IntegrationRuntimeListResponse', 'IntegrationRuntimeMonitoringData', 'IntegrationRuntimeNodeIpAddress', 'IntegrationRuntimeNodeMonitoringData', @@ -350,12 +481,16 @@ 'IntegrationRuntimeStatusResponse', 'IntegrationRuntimeVNetProperties', 'IpFirewallRuleInfo', + 'IpFirewallRuleInfoListResult', 'IpFirewallRuleProperties', + 'Key', + 'KeyInfoListResult', 'LibraryRequirements', 'LinkedIntegrationRuntime', 'LinkedIntegrationRuntimeKeyAuthorization', 'LinkedIntegrationRuntimeRbacAuthorization', 'LinkedIntegrationRuntimeType', + 'ListSqlPoolSecurityAlertPolicies', 'ManagedIdentity', 'ManagedIdentitySqlControlSettingsModel', 'ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity', @@ -364,6 +499,7 @@ 'ManagedIntegrationRuntimeNode', 'ManagedIntegrationRuntimeOperationResult', 'ManagedIntegrationRuntimeStatus', + 'ManagedVirtualNetworkSettings', 'MetadataSyncConfig', 'OperationMetaLogSpecification', 'OperationMetaMetricDimensionSpecification', @@ -372,37 +508,70 @@ 'OperationResource', 'PrivateEndpoint', 'PrivateEndpointConnection', + 'PrivateEndpointConnectionForPrivateLinkHub', + 'PrivateEndpointConnectionForPrivateLinkHubBasic', + 'PrivateEndpointConnectionForPrivateLinkHubBasicAutoGenerated', + 'PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse', + 'PrivateEndpointConnectionList', + 'PrivateEndpointConnectionProperties', + 'PrivateLinkHub', + 'PrivateLinkHubInfoListResult', + 'PrivateLinkHubPatchInfo', 'PrivateLinkResource', + 'PrivateLinkResourceListResult', 'PrivateLinkResourceProperties', 'PrivateLinkServiceConnectionState', 'ProxyResource', + 'PurviewConfiguration', 'QueryInterval', 'QueryMetric', 'QueryStatistic', + 'RecoverableSqlPool', + 'RecoverableSqlPoolListResult', 'ReplaceAllFirewallRulesOperationResponse', 'ReplaceAllIpFirewallRulesRequest', 'ReplicationLink', + 'ReplicationLinkListResult', 'Resource', - 'ResourceMoveDefinition', + 'RestorableDroppedSqlPool', + 'RestorableDroppedSqlPoolListResult', 'RestorePoint', + 'RestorePointListResult', 'SecretBase', 'SecureString', 'SelfHostedIntegrationRuntime', 'SelfHostedIntegrationRuntimeNode', 'SelfHostedIntegrationRuntimeStatus', 'SensitivityLabel', + 'SensitivityLabelListResult', + 'ServerBlobAuditingPolicy', + 'ServerBlobAuditingPolicyListResult', + 'ServerSecurityAlertPolicy', + 'ServerSecurityAlertPolicyListResult', + 'ServerUsage', + 'ServerUsageListResult', + 'ServerVulnerabilityAssessment', + 'ServerVulnerabilityAssessmentListResult', 'Sku', 'SqlPool', 'SqlPoolBlobAuditingPolicy', + 'SqlPoolBlobAuditingPolicyListResult', + 'SqlPoolBlobAuditingPolicySqlPoolOperationListResult', 'SqlPoolColumn', + 'SqlPoolColumnListResult', 'SqlPoolConnectionPolicy', + 'SqlPoolInfoListResult', 'SqlPoolOperation', 'SqlPoolPatchInfo', 'SqlPoolSchema', + 'SqlPoolSchemaListResult', 'SqlPoolSecurityAlertPolicy', 'SqlPoolTable', + 'SqlPoolTableListResult', 'SqlPoolUsage', + 'SqlPoolUsageListResult', 'SqlPoolVulnerabilityAssessment', + 'SqlPoolVulnerabilityAssessmentListResult', 'SqlPoolVulnerabilityAssessmentRuleBaseline', 'SqlPoolVulnerabilityAssessmentRuleBaselineItem', 'SqlPoolVulnerabilityAssessmentScansExport', @@ -421,65 +590,71 @@ 'TopQueriesListResult', 'TrackedResource', 'TransparentDataEncryption', + 'TransparentDataEncryptionListResult', 'UpdateIntegrationRuntimeNodeRequest', 'UpdateIntegrationRuntimeRequest', 'VirtualNetworkProfile', 'VulnerabilityAssessmentRecurringScansProperties', 'VulnerabilityAssessmentScanError', 'VulnerabilityAssessmentScanRecord', + 'VulnerabilityAssessmentScanRecordListResult', + 'WorkloadClassifier', + 'WorkloadClassifierListResult', + 'WorkloadGroup', + 'WorkloadGroupListResult', 'Workspace', 'WorkspaceAadAdminInfo', + 'WorkspaceInfoListResult', + 'WorkspaceKeyDetails', 'WorkspacePatchInfo', - 'BigDataPoolResourceInfoPaged', - 'IpFirewallRuleInfoPaged', - 'SqlPoolPaged', - 'RestorePointPaged', - 'ReplicationLinkPaged', - 'SqlPoolOperationPaged', - 'SqlPoolUsagePaged', - 'SensitivityLabelPaged', - 'SqlPoolSchemaPaged', - 'SqlPoolTablePaged', - 'SqlPoolColumnPaged', - 'SqlPoolVulnerabilityAssessmentPaged', - 'VulnerabilityAssessmentScanRecordPaged', - 'WorkspacePaged', - 'IntegrationRuntimeResourcePaged', - 'PrivateLinkResourcePaged', - 'PrivateEndpointConnectionPaged', + 'WorkspaceRepositoryConfiguration', + 'BlobAuditingPolicyName', + 'BlobAuditingPolicyState', + 'ColumnDataType', + 'ConnectionPolicyName', + 'DataFlowComputeType', + 'DataMaskingFunction', + 'DataMaskingRuleState', + 'DataMaskingState', + 'DataWarehouseUserActivityName', + 'GeoBackupPolicyName', + 'GeoBackupPolicyState', + 'IntegrationRuntimeAuthKeyName', + 'IntegrationRuntimeAutoUpdate', + 'IntegrationRuntimeEdition', + 'IntegrationRuntimeEntityReferenceType', + 'IntegrationRuntimeInternalChannelEncryptionMode', + 'IntegrationRuntimeLicenseType', + 'IntegrationRuntimeSsisCatalogPricingTier', + 'IntegrationRuntimeState', + 'IntegrationRuntimeType', + 'IntegrationRuntimeUpdateResult', + 'ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentityActualState', + 'ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentityDesiredState', + 'ManagedIntegrationRuntimeNodeStatus', + 'ManagementOperationState', 'NodeSize', 'NodeSizeFamily', - 'ProvisioningState', 'OperationStatus', - 'GeoBackupPolicyState', + 'ProvisioningState', 'QueryAggregationFunction', 'QueryExecutionType', - 'QueryObservedMetricType', 'QueryMetricUnit', - 'RestorePointType', + 'QueryObservedMetricType', 'ReplicationRole', 'ReplicationState', - 'TransparentDataEncryptionStatus', - 'BlobAuditingPolicyState', - 'ManagementOperationState', - 'ColumnDataType', - 'VulnerabilityAssessmentScanTriggerType', - 'VulnerabilityAssessmentScanState', - 'SecurityAlertPolicyState', 'ResourceIdentityType', - 'IntegrationRuntimeType', - 'IntegrationRuntimeState', - 'DataFlowComputeType', - 'IntegrationRuntimeSsisCatalogPricingTier', - 'IntegrationRuntimeLicenseType', - 'IntegrationRuntimeEntityReferenceType', - 'IntegrationRuntimeEdition', - 'ManagedIntegrationRuntimeNodeStatus', - 'IntegrationRuntimeInternalChannelEncryptionMode', + 'RestorePointType', + 'SecurityAlertPolicyName', + 'SecurityAlertPolicyNameAutoGenerated', + 'SecurityAlertPolicyState', 'SelfHostedIntegrationRuntimeNodeStatus', - 'IntegrationRuntimeUpdateResult', - 'IntegrationRuntimeAutoUpdate', - 'IntegrationRuntimeAuthKeyName', + 'SensitivityLabelSource', 'SsisObjectMetadataType', + 'TransparentDataEncryptionName', + 'TransparentDataEncryptionStatus', + 'VulnerabilityAssessmentName', 'VulnerabilityAssessmentPolicyBaselineName', + 'VulnerabilityAssessmentScanState', + 'VulnerabilityAssessmentScanTriggerType', ] 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 index 42f32838433e..c21e0572a273 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_models.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_models.py @@ -1,25 +1,20 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +from azure.core.exceptions import HttpResponseError +import msrest.serialization -class AutoPauseProperties(Model): - """Spark pool auto-pausing properties. +class AutoPauseProperties(msrest.serialization.Model): + """Auto-pausing properties of a Big Data pool powered by Apache Spark. - 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. + :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 @@ -30,25 +25,23 @@ class AutoPauseProperties(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + 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(Model): - """Spark pool auto-scaling properties. - - Auto-scaling properties of a Big Data pool powered by Apache Spark. +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. + :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. + :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. + :param max_node_count: The maximum number of nodes the Big Data pool can support. :type max_node_count: int """ @@ -58,56 +51,61 @@ class AutoScaleProperties(Model): 'max_node_count': {'key': 'maxNodeCount', 'type': 'int'}, } - def __init__(self, **kwargs): + 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(Model): +class AvailableRpOperation(msrest.serialization.Model): """An operation that is available in this resource provider. - :param display: Display properties of the operation + :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 + :param is_data_action: Whether this operation is a data action. :type is_data_action: str - :param name: Operation name + :param name: Operation name. :type name: str - :param service_specification: Operation service specification - :type service_specification: - ~azure.mgmt.synapse.models.OperationMetaServiceSpecification - :param origin: Operation origin + :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'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'OperationMetaServiceSpecification'}, 'origin': {'key': 'origin', 'type': 'str'}, + 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'OperationMetaServiceSpecification'}, } - def __init__(self, **kwargs): + 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.service_specification = kwargs.get('service_specification', None) self.origin = kwargs.get('origin', None) + self.service_specification = kwargs.get('service_specification', None) -class AvailableRpOperationDisplayInfo(Model): +class AvailableRpOperationDisplayInfo(msrest.serialization.Model): """Description of an available operation. - :param description: Operation description + :param description: Operation description. :type description: str - :param resource: Resource type + :param resource: Resource type. :type resource: str - :param provider: Resource provider name + :param provider: Resource provider name. :type provider: str - :param operation: Operation name + :param operation: Operation name. :type operation: str """ @@ -118,7 +116,10 @@ class AvailableRpOperationDisplayInfo(Model): 'operation': {'key': 'operation', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AvailableRpOperationDisplayInfo, self).__init__(**kwargs) self.description = kwargs.get('description', None) self.resource = kwargs.get('resource', None) @@ -126,19 +127,18 @@ def __init__(self, **kwargs): self.operation = kwargs.get('operation', None) -class Resource(Model): - """Resource. +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. + 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} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -154,7 +154,10 @@ class Resource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -162,19 +165,17 @@ def __init__(self, **kwargs): class AzureEntityResource(Resource): - """The resource model definition for a Azure Resource Manager resource with an - etag. + """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. + 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} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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 @@ -194,17 +195,18 @@ class AzureEntityResource(Resource): 'etag': {'key': 'etag', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AzureEntityResource, self).__init__(**kwargs) self.etag = None -class BigDataPoolPatchInfo(Model): - """Patch for a Big Data pool. +class BigDataPoolPatchInfo(msrest.serialization.Model): + """Properties patch for a Big Data pool. - Properties patch for a Big Data pool. - - :param tags: Updated tags for the Big Data pool + :param tags: A set of tags. Updated tags for the Big Data pool. :type tags: dict[str, str] """ @@ -212,30 +214,32 @@ class BigDataPoolPatchInfo(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BigDataPoolPatchInfo, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level 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. + Variables are only 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} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives + :param location: Required. The geo-location where the resource lives. :type location: str """ @@ -254,58 +258,65 @@ class TrackedResource(Resource): 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TrackedResource, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) - self.location = kwargs.get('location', None) + self.location = kwargs['location'] class BigDataPoolResourceInfo(TrackedResource): - """Big Data pool. + """A Big Data pool. - A Big Data pool. - - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives + :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 + :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 - :param auto_pause: Auto-pausing properties + :type creation_date: ~datetime.datetime + :param auto_pause: Auto-pausing properties. :type auto_pause: ~azure.mgmt.synapse.models.AutoPauseProperties - :param spark_events_folder: The Spark events folder + :param is_compute_isolation_enabled: Whether compute isolation is required or not. + :type is_compute_isolation_enabled: bool + :param have_library_requirements_changed: Whether library requirements changed. + :type have_library_requirements_changed: bool + :param session_level_packages_enabled: Whether session level packages enabled. + :type session_level_packages_enabled: bool + :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 + :param library_requirements: Library version requirements. :type library_requirements: ~azure.mgmt.synapse.models.LibraryRequirements + :param spark_config_properties: Spark configuration file to specify additional properties. + :type spark_config_properties: ~azure.mgmt.synapse.models.LibraryRequirements :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. + :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' + :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' + :param node_size_family: The kind of nodes that the Big Data pool provides. Possible values + include: "None", "MemoryOptimized". :type node_size_family: str or ~azure.mgmt.synapse.models.NodeSizeFamily """ @@ -314,7 +325,6 @@ class BigDataPoolResourceInfo(TrackedResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'node_count': {'maximum': 200, 'minimum': 3}, } _attribute_map = { @@ -327,38 +337,70 @@ class BigDataPoolResourceInfo(TrackedResource): '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'}, + 'have_library_requirements_changed': {'key': 'properties.haveLibraryRequirementsChanged', 'type': 'bool'}, + 'session_level_packages_enabled': {'key': 'properties.sessionLevelPackagesEnabled', 'type': 'bool'}, 'spark_events_folder': {'key': 'properties.sparkEventsFolder', 'type': 'str'}, 'node_count': {'key': 'properties.nodeCount', 'type': 'int'}, 'library_requirements': {'key': 'properties.libraryRequirements', 'type': 'LibraryRequirements'}, + 'spark_config_properties': {'key': 'properties.sparkConfigProperties', 'type': 'LibraryRequirements'}, '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'}, } - def __init__(self, **kwargs): + 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.have_library_requirements_changed = kwargs.get('have_library_requirements_changed', None) + self.session_level_packages_enabled = kwargs.get('session_level_packages_enabled', 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.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) -class CheckNameAvailabilityRequest(Model): - """Check name availability request. +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) + - A request about whether a workspace name is available. +class CheckNameAvailabilityRequest(msrest.serialization.Model): + """A request about whether a workspace name is available. - :param name: Workspace name + :param name: Workspace name. :type name: str - :param type: Type: workspace + :param type: Type: workspace. :type type: str """ @@ -367,24 +409,25 @@ class CheckNameAvailabilityRequest(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CheckNameAvailabilityRequest, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.type = kwargs.get('type', None) -class CheckNameAvailabilityResponse(Model): - """Check name availability response. +class CheckNameAvailabilityResponse(msrest.serialization.Model): + """A response saying whether the workspace name is available. - A response saying whether the workspace name is available. - - :param message: Validation message + :param message: Validation message. :type message: str - :param available: Whether the workspace name is available + :param available: Whether the workspace name is available. :type available: bool - :param reason: Reason the workspace name is or is not available + :param reason: Reason the workspace name is or is not available. :type reason: str - :param name: Workspace name + :param name: Workspace name. :type name: str """ @@ -395,7 +438,10 @@ class CheckNameAvailabilityResponse(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CheckNameAvailabilityResponse, self).__init__(**kwargs) self.message = kwargs.get('message', None) self.available = kwargs.get('available', None) @@ -403,7 +449,7 @@ def __init__(self, **kwargs): self.name = kwargs.get('name', None) -class CloudError(Model): +class CloudError(msrest.serialization.Model): """The object that defines the structure of an Azure Synapse error response. All required parameters must be populated in order to send to Azure. @@ -430,35 +476,64 @@ class CloudError(Model): 'details': {'key': 'error.details', 'type': '[CloudError]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CloudError, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) + self.code = kwargs['code'] + self.message = kwargs['message'] self.target = kwargs.get('target', None) self.details = kwargs.get('details', None) -class CloudErrorException(HttpOperationError): - """Server responsed with exception of type: 'CloudError'. +class CloudErrorAutoGenerated(msrest.serialization.Model): + """The object that defines the structure of an Azure Synapse error response. + + All required parameters must be populated in order to send to Azure. - :param deserialize: A deserializer - :param response: Server response to be deserialized. + :param code: Required. Error code. + :type code: str + :param message: Required. Error message. + :type message: str + :param target: Property name/path in request associated with error. + :type target: str + :param details: Array with additional error details. + :type details: list[~azure.mgmt.synapse.models.CloudErrorAutoGenerated] """ - def __init__(self, deserialize, response, *args): + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } + + _attribute_map = { + 'code': {'key': 'error.code', 'type': 'str'}, + 'message': {'key': 'error.message', 'type': 'str'}, + 'target': {'key': 'error.target', 'type': 'str'}, + 'details': {'key': 'error.details', 'type': '[CloudErrorAutoGenerated]'}, + } - super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + def __init__( + self, + **kwargs + ): + super(CloudErrorAutoGenerated, self).__init__(**kwargs) + self.code = kwargs['code'] + self.message = kwargs['message'] + self.target = kwargs.get('target', None) + self.details = kwargs.get('details', None) -class CustomSetupBase(Model): +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, EnvironmentVariableSetup, ComponentSetup + sub-classes are: CmdkeySetup, ComponentSetup, EnvironmentVariableSetup. All required parameters must be populated in order to send to Azure. - :param type: Required. Constant filled by server. + :param type: Required. The type of custom setup.Constant filled by server. :type type: str """ @@ -471,12 +546,15 @@ class CustomSetupBase(Model): } _subtype_map = { - 'type': {'CmdkeySetup': 'CmdkeySetup', 'EnvironmentVariableSetup': 'EnvironmentVariableSetup', 'ComponentSetup': 'ComponentSetup'} + 'type': {'CmdkeySetup': 'CmdkeySetup', 'ComponentSetup': 'ComponentSetup', 'EnvironmentVariableSetup': 'EnvironmentVariableSetup'} } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CustomSetupBase, self).__init__(**kwargs) - self.type = None + self.type = None # type: Optional[str] class CmdkeySetup(CustomSetupBase): @@ -484,7 +562,7 @@ class CmdkeySetup(CustomSetupBase): All required parameters must be populated in order to send to Azure. - :param type: Required. Constant filled by server. + :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: object @@ -508,12 +586,15 @@ class CmdkeySetup(CustomSetupBase): 'password': {'key': 'typeProperties.password', 'type': 'SecretBase'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CmdkeySetup, self).__init__(**kwargs) - self.target_name = kwargs.get('target_name', None) - self.user_name = kwargs.get('user_name', None) - self.password = kwargs.get('password', None) - self.type = 'CmdkeySetup' + self.type = 'CmdkeySetup' # type: str + self.target_name = kwargs['target_name'] + self.user_name = kwargs['user_name'] + self.password = kwargs['password'] class ComponentSetup(CustomSetupBase): @@ -521,7 +602,7 @@ class ComponentSetup(CustomSetupBase): All required parameters must be populated in order to send to Azure. - :param type: Required. Constant filled by server. + :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 @@ -540,20 +621,22 @@ class ComponentSetup(CustomSetupBase): 'license_key': {'key': 'typeProperties.licenseKey', 'type': 'SecretBase'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ComponentSetup, self).__init__(**kwargs) - self.component_name = kwargs.get('component_name', None) + self.type = 'ComponentSetup' # type: str + self.component_name = kwargs['component_name'] self.license_key = kwargs.get('license_key', None) - self.type = 'ComponentSetup' -class CreateSqlPoolRestorePointDefinition(Model): - """Contains the information necessary to perform a create Sql pool restore - point operation. +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 + :param restore_point_label: Required. The restore point label to apply. :type restore_point_label: str """ @@ -565,17 +648,49 @@ class CreateSqlPoolRestorePointDefinition(Model): 'restore_point_label': {'key': 'restorePointLabel', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CreateSqlPoolRestorePointDefinition, self).__init__(**kwargs) - self.restore_point_label = kwargs.get('restore_point_label', None) + self.restore_point_label = kwargs['restore_point_label'] + + +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. -class DataLakeStorageAccountDetails(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 + """ + + _validation = { + 'status': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'WorkspaceKeyDetails'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomerManagedKeyDetails, self).__init__(**kwargs) + self.status = None + self.key = kwargs.get('key', None) + + +class DataLakeStorageAccountDetails(msrest.serialization.Model): """Details of the data lake storage account associated with the workspace. - :param account_url: Account URL + :param account_url: Account URL. :type account_url: str - :param filesystem: Filesystem name + :param filesystem: Filesystem name. :type filesystem: str """ @@ -584,58 +699,220 @@ class DataLakeStorageAccountDetails(Model): 'filesystem': {'key': 'filesystem', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DataLakeStorageAccountDetails, self).__init__(**kwargs) self.account_url = kwargs.get('account_url', None) self.filesystem = kwargs.get('filesystem', None) -class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have - everything other than required location and tags. +class DataMaskingPolicy(Resource): + """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 - 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} +class DataMaskingRule(Resource): + """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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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(ProxyResource, self).__init__(**kwargs) + def __init__( + self, + **kwargs + ): + super(DataMaskingRuleListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) -class DataWarehouseUserActivities(ProxyResource): +class DataWarehouseUserActivities(Resource): """User activities of a data warehouse. - Variables are only populated by the server, and will be ignored when - sending a request. + 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} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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 @@ -655,18 +932,49 @@ class DataWarehouseUserActivities(ProxyResource): 'active_queries_count': {'key': 'properties.activeQueriesCount', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DataWarehouseUserActivities, self).__init__(**kwargs) self.active_queries_count = None -class EntityReference(Model): +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 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 + "IntegrationRuntimeReference", "LinkedServiceReference". + :type type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeEntityReferenceType :param reference_name: The name of this referenced entity. :type reference_name: str """ @@ -676,7 +984,10 @@ class EntityReference(Model): 'reference_name': {'key': 'referenceName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(EntityReference, self).__init__(**kwargs) self.type = kwargs.get('type', None) self.reference_name = kwargs.get('reference_name', None) @@ -687,7 +998,7 @@ class EnvironmentVariableSetup(CustomSetupBase): All required parameters must be populated in order to send to Azure. - :param type: Required. Constant filled by server. + :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 @@ -707,18 +1018,20 @@ class EnvironmentVariableSetup(CustomSetupBase): 'variable_value': {'key': 'typeProperties.variableValue', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(EnvironmentVariableSetup, self).__init__(**kwargs) - self.variable_name = kwargs.get('variable_name', None) - self.variable_value = kwargs.get('variable_value', None) - self.type = 'EnvironmentVariableSetup' + self.type = 'EnvironmentVariableSetup' # type: str + self.variable_name = kwargs['variable_name'] + self.variable_value = kwargs['variable_value'] -class ErrorAdditionalInfo(Model): +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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar type: The additional info type. :vartype type: str @@ -736,16 +1049,17 @@ class ErrorAdditionalInfo(Model): 'info': {'key': 'info', 'type': 'object'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None -class ErrorContract(Model): - """Error details. - - Contains details when the response code indicates an error. +class ErrorContract(msrest.serialization.Model): + """Contains details when the response code indicates an error. :param error: The error details. :type error: ~azure.mgmt.synapse.models.ErrorResponse @@ -755,31 +1069,22 @@ class ErrorContract(Model): 'error': {'key': 'error', 'type': 'ErrorResponse'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ErrorContract, self).__init__(**kwargs) self.error = kwargs.get('error', None) -class ErrorContractException(HttpOperationError): - """Server responsed with exception of type: 'ErrorContract'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(ErrorContractException, self).__init__(deserialize, response, 'ErrorContract', *args) - - -class ErrorDetail(Model): +class ErrorDetail(msrest.serialization.Model): """Error details. - :param message: Error message + :param message: Error message. :type message: str - :param code: Error code + :param code: Error code. :type code: str - :param target: Error target + :param target: Error target. :type target: str """ @@ -789,18 +1094,20 @@ class ErrorDetail(Model): 'target': {'key': 'target', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ErrorDetail, self).__init__(**kwargs) self.message = kwargs.get('message', None) self.code = kwargs.get('code', None) self.target = kwargs.get('target', None) -class ErrorResponse(Model): - """The resource management error response. +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.). - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar code: The error code. :vartype code: str @@ -811,8 +1118,7 @@ class ErrorResponse(Model): :ivar details: The error details. :vartype details: list[~azure.mgmt.synapse.models.ErrorResponse] :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.synapse.models.ErrorAdditionalInfo] + :vartype additional_info: list[~azure.mgmt.synapse.models.ErrorAdditionalInfo] """ _validation = { @@ -831,7 +1137,10 @@ class ErrorResponse(Model): 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ErrorResponse, self).__init__(**kwargs) self.code = None self.message = None @@ -840,163 +1149,603 @@ def __init__(self, **kwargs): self.additional_info = None -class GeoBackupPolicy(ProxyResource): - """A database geo backup policy. - - Variables are only populated by the server, and will be ignored when - sending a request. +class ExtendedServerBlobAuditingPolicy(Resource): + """An extended server blob auditing policy. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: 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 - :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 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}, - 'state': {'required': True}, - 'storage_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'}, - 'state': {'key': 'properties.state', 'type': 'GeoBackupPolicyState'}, - 'storage_type': {'key': 'properties.storageType', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', '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(GeoBackupPolicy, self).__init__(**kwargs) + 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_type = None - self.kind = None - self.location = None - - -class GetSsisObjectMetadataRequest(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) - + 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 IntegrationRuntime(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 +class ExtendedServerBlobAuditingPolicyListResult(msrest.serialization.Model): + """A list of server extended auditing settings. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param additional_properties: Unmatched properties from the message are - deserialized this collection - :type additional_properties: dict[str, object] - :param description: Integration runtime description. - :type description: str - :param type: Required. Constant filled by server. - :type type: str + :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 = { - 'type': {'required': True}, + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'description': {'key': 'description', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'Managed': 'ManagedIntegrationRuntime', 'SelfHosted': 'SelfHostedIntegrationRuntime'} + 'value': {'key': 'value', 'type': '[ExtendedServerBlobAuditingPolicy]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): - super(IntegrationRuntime, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.description = kwargs.get('description', None) - self.type = None - - -class IntegrationRuntimeAuthKeys(Model): - """The integration runtime authentication keys. + def __init__( + self, + **kwargs + ): + super(ExtendedServerBlobAuditingPolicyListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None - :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'}, - } +class ExtendedSqlPoolBlobAuditingPolicy(Resource): + """An extended Sql pool blob auditing policy. - 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) + 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 GeoBackupPolicy(Resource): + """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, object] + :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. -class IntegrationRuntimeComputeProperties(Model): + :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 this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] - :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 + :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. + :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. + :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. + :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 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 + :type v_net_properties: ~azure.mgmt.synapse.models.IntegrationRuntimeVNetProperties """ _validation = { @@ -1014,7 +1763,10 @@ class IntegrationRuntimeComputeProperties(Model): 'v_net_properties': {'key': 'vNetProperties', 'type': 'IntegrationRuntimeVNetProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IntegrationRuntimeComputeProperties, self).__init__(**kwargs) self.additional_properties = kwargs.get('additional_properties', None) self.location = kwargs.get('location', None) @@ -1025,31 +1777,28 @@ def __init__(self, **kwargs): self.v_net_properties = kwargs.get('v_net_properties', None) -class IntegrationRuntimeConnectionInfo(Model): - """Connection information for encrypting the on-premises data source - credentials. +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. + 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 this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] - :ivar service_token: The token generated in service. Callers use this - token to authenticate to integration runtime. + :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. + :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. + :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. + :ivar is_identity_cert_exprired: Whether the identity certificate is expired. :vartype is_identity_cert_exprired: bool """ @@ -1072,7 +1821,10 @@ class IntegrationRuntimeConnectionInfo(Model): 'is_identity_cert_exprired': {'key': 'isIdentityCertExprired', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IntegrationRuntimeConnectionInfo, self).__init__(**kwargs) self.additional_properties = kwargs.get('additional_properties', None) self.service_token = None @@ -1083,11 +1835,11 @@ def __init__(self, **kwargs): self.is_identity_cert_exprired = None -class IntegrationRuntimeCustomSetupScriptProperties(Model): +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. + :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 @@ -1098,27 +1850,29 @@ class IntegrationRuntimeCustomSetupScriptProperties(Model): 'sas_token': {'key': 'sasToken', 'type': 'SecureString'}, } - def __init__(self, **kwargs): + 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(Model): +class IntegrationRuntimeDataFlowProperties(msrest.serialization.Model): """Data flow properties for managed integration runtime. - :param additional_properties: Unmatched properties from the message are - deserialized this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] - :param compute_type: Compute type of the cluster which will execute data - flow job. Possible values include: 'General', 'MemoryOptimized', - 'ComputeOptimized' + :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. + :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. + :param time_to_live: Time to live (in minutes) setting of the cluster which will execute data + flow job. :type time_to_live: int """ @@ -1133,7 +1887,10 @@ class IntegrationRuntimeDataFlowProperties(Model): 'time_to_live': {'key': 'timeToLive', 'type': 'int'}, } - def __init__(self, **kwargs): + 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) @@ -1141,7 +1898,7 @@ def __init__(self, **kwargs): self.time_to_live = kwargs.get('time_to_live', None) -class IntegrationRuntimeDataProxyProperties(Model): +class IntegrationRuntimeDataProxyProperties(msrest.serialization.Model): """Data proxy properties for a managed dedicated integration runtime. :param connect_via: The self-hosted integration runtime reference. @@ -1158,21 +1915,52 @@ class IntegrationRuntimeDataProxyProperties(Model): 'path': {'key': 'path', 'type': 'str'}, } - def __init__(self, **kwargs): + 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 IntegrationRuntimeMonitoringData(Model): +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] + :type nodes: list[~azure.mgmt.synapse.models.IntegrationRuntimeNodeMonitoringData] """ _attribute_map = { @@ -1180,17 +1968,19 @@ class IntegrationRuntimeMonitoringData(Model): 'nodes': {'key': 'nodes', 'type': '[IntegrationRuntimeNodeMonitoringData]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IntegrationRuntimeMonitoringData, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.nodes = kwargs.get('nodes', None) -class IntegrationRuntimeNodeIpAddress(Model): +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. + 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 @@ -1204,35 +1994,34 @@ class IntegrationRuntimeNodeIpAddress(Model): 'ip_address': {'key': 'ipAddress', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IntegrationRuntimeNodeIpAddress, self).__init__(**kwargs) self.ip_address = None -class IntegrationRuntimeNodeMonitoringData(Model): +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. + 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 this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] :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. + :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. + :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. + :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. + :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 @@ -1263,7 +2052,10 @@ class IntegrationRuntimeNodeMonitoringData(Model): 'received_bytes': {'key': 'receivedBytes', 'type': 'float'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IntegrationRuntimeNodeMonitoringData, self).__init__(**kwargs) self.additional_properties = kwargs.get('additional_properties', None) self.node_name = None @@ -1276,38 +2068,45 @@ def __init__(self, **kwargs): self.received_bytes = None -class IntegrationRuntimeRegenerateKeyParameters(Model): +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 + :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): + def __init__( + self, + **kwargs + ): super(IntegrationRuntimeRegenerateKeyParameters, self).__init__(**kwargs) self.key_name = kwargs.get('key_name', None) -class SubResource(Model): - """Azure Synapse nested resource, which belongs to a factory. +class IntegrationRuntimeResource(AzureEntityResource): + """Integration runtime resource type. + + Variables are only populated by the server, and will be ignored when sending a request. - Variables are only populated by the server, and will be ignored when - sending a request. + All required parameters must be populated in order to send to Azure. - :ivar id: The resource identifier. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: The resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar etag: Etag identifies change in the resource. + :ivar etag: Resource Etag. :vartype etag: str + :param properties: Required. Integration runtime properties. + :type properties: ~azure.mgmt.synapse.models.IntegrationRuntime """ _validation = { @@ -1315,6 +2114,7 @@ class SubResource(Model): 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, + 'properties': {'required': True}, } _attribute_map = { @@ -1322,78 +2122,36 @@ class SubResource(Model): '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(SubResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.etag = None + def __init__( + self, + **kwargs + ): + super(IntegrationRuntimeResource, self).__init__(**kwargs) + self.properties = kwargs['properties'] -class IntegrationRuntimeResource(SubResource): - """Integration runtime resource type. +class IntegrationRuntimeSsisCatalogInfo(msrest.serialization.Model): + """Catalog information for managed dedicated integration runtime. - Variables are only 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: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :ivar etag: Etag identifies change in the resource. - :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.get('properties', None) - - -class IntegrationRuntimeSsisCatalogInfo(Model): - """Catalog information for managed dedicated integration runtime. - - :param additional_properties: Unmatched properties from the message are - deserialized this collection - :type additional_properties: dict[str, object] - :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 - """ + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. + :type additional_properties: dict[str, object] + :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}, @@ -1407,7 +2165,10 @@ class IntegrationRuntimeSsisCatalogInfo(Model): 'catalog_pricing_tier': {'key': 'catalogPricingTier', 'type': 'str'}, } - def __init__(self, **kwargs): + 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) @@ -1416,35 +2177,30 @@ def __init__(self, **kwargs): self.catalog_pricing_tier = kwargs.get('catalog_pricing_tier', None) -class IntegrationRuntimeSsisProperties(Model): +class IntegrationRuntimeSsisProperties(msrest.serialization.Model): """SSIS properties for managed integration runtime. - :param additional_properties: Unmatched properties from the message are - deserialized this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] - :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. + :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' + :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] + :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 = { @@ -1457,7 +2213,10 @@ class IntegrationRuntimeSsisProperties(Model): 'express_custom_setup_properties': {'key': 'expressCustomSetupProperties', 'type': '[CustomSetupBase]'}, } - def __init__(self, **kwargs): + 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) @@ -1468,62 +2227,62 @@ def __init__(self, **kwargs): self.express_custom_setup_properties = kwargs.get('express_custom_setup_properties', None) -class IntegrationRuntimeStatus(Model): +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 + sub-classes are: ManagedIntegrationRuntimeStatus, SelfHostedIntegrationRuntimeStatus. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :param additional_properties: Unmatched properties from the message are - deserialized this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] - :ivar data_factory_name: The workspace name which the integration runtime - belong to. + :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' + :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 - :param type: Required. Constant filled by server. - :type type: str """ _validation = { + 'type': {'required': True}, 'data_factory_name': {'readonly': True}, 'state': {'readonly': True}, - 'type': {'required': 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'}, - 'type': {'key': 'type', 'type': 'str'}, } _subtype_map = { 'type': {'Managed': 'ManagedIntegrationRuntimeStatus', 'SelfHosted': 'SelfHostedIntegrationRuntimeStatus'} } - def __init__(self, **kwargs): + 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 - self.type = None -class IntegrationRuntimeStatusResponse(Model): +class IntegrationRuntimeStatusResponse(msrest.serialization.Model): """Integration runtime status response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -1543,66 +2302,68 @@ class IntegrationRuntimeStatusResponse(Model): 'properties': {'key': 'properties', 'type': 'IntegrationRuntimeStatus'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IntegrationRuntimeStatusResponse, self).__init__(**kwargs) self.name = None - self.properties = kwargs.get('properties', None) + self.properties = kwargs['properties'] -class IntegrationRuntimeVNetProperties(Model): +class IntegrationRuntimeVNetProperties(msrest.serialization.Model): """VNet properties for managed integration runtime. - :param additional_properties: Unmatched properties from the message are - deserialized this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] - :param v_net_id: The ID of the VNet that this integration runtime will - join. + :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_ips: Resource IDs of the public IP addresses that this - integration runtime will use. - :type public_ips: list[str] + :param public_i_ps: Resource IDs of the public IP addresses that this integration runtime will + use. + :type public_i_ps: list[str] """ _attribute_map = { 'additional_properties': {'key': '', 'type': '{object}'}, 'v_net_id': {'key': 'vNetId', 'type': 'str'}, 'subnet': {'key': 'subnet', 'type': 'str'}, - 'public_ips': {'key': 'publicIPs', 'type': '[str]'}, + 'public_i_ps': {'key': 'publicIPs', 'type': '[str]'}, } - def __init__(self, **kwargs): + 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_ips = kwargs.get('public_ips', None) + self.public_i_ps = kwargs.get('public_i_ps', None) -class IpFirewallRuleInfo(ProxyResource): +class IpFirewallRuleInfo(Resource): """IP firewall rule. - Variables are only populated by the server, and will be ignored when - sending a request. + 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} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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 + :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 + :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 """ @@ -1622,28 +2383,51 @@ class IpFirewallRuleInfo(ProxyResource): 'start_ip_address': {'key': 'properties.startIpAddress', 'type': 'str'}, } - def __init__(self, **kwargs): + 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 IpFirewallRuleProperties(Model): +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. + 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 + :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 + :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 """ @@ -1657,23 +2441,88 @@ class IpFirewallRuleProperties(Model): 'start_ip_address': {'key': 'startIpAddress', 'type': 'str'}, } - def __init__(self, **kwargs): + 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 LibraryRequirements(Model): - """Spark pool library version requirements. +class Key(Resource): + """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) + - Library requirements for a Big Data pool powered by Apache Spark. +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. + 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 + :vartype time: ~datetime.datetime :param content: The library requirements. :type content: str :param filename: The filename of the library requirements file. @@ -1690,32 +2539,33 @@ class LibraryRequirements(Model): 'filename': {'key': 'filename', 'type': 'str'}, } - def __init__(self, **kwargs): + 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 LinkedIntegrationRuntime(Model): +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. + 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. + :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. + :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. + :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 + :vartype create_time: ~datetime.datetime """ _validation = { @@ -1734,7 +2584,10 @@ class LinkedIntegrationRuntime(Model): 'create_time': {'key': 'createTime', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LinkedIntegrationRuntime, self).__init__(**kwargs) self.name = None self.subscription_id = None @@ -1743,16 +2596,16 @@ def __init__(self, **kwargs): self.create_time = None -class LinkedIntegrationRuntimeType(Model): +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 + sub-classes are: LinkedIntegrationRuntimeKeyAuthorization, LinkedIntegrationRuntimeRbacAuthorization. All required parameters must be populated in order to send to Azure. - :param authorization_type: Required. Constant filled by server. + :param authorization_type: Required. The authorization type for integration runtime + sharing.Constant filled by server. :type authorization_type: str """ @@ -1768,9 +2621,12 @@ class LinkedIntegrationRuntimeType(Model): 'authorization_type': {'Key': 'LinkedIntegrationRuntimeKeyAuthorization', 'RBAC': 'LinkedIntegrationRuntimeRbacAuthorization'} } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LinkedIntegrationRuntimeType, self).__init__(**kwargs) - self.authorization_type = None + self.authorization_type = None # type: Optional[str] class LinkedIntegrationRuntimeKeyAuthorization(LinkedIntegrationRuntimeType): @@ -1778,7 +2634,8 @@ class LinkedIntegrationRuntimeKeyAuthorization(LinkedIntegrationRuntimeType): All required parameters must be populated in order to send to Azure. - :param authorization_type: Required. Constant filled by server. + :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 @@ -1794,22 +2651,24 @@ class LinkedIntegrationRuntimeKeyAuthorization(LinkedIntegrationRuntimeType): 'key': {'key': 'key', 'type': 'SecureString'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LinkedIntegrationRuntimeKeyAuthorization, self).__init__(**kwargs) - self.key = kwargs.get('key', None) - self.authorization_type = 'Key' + self.authorization_type = 'Key' # type: str + self.key = kwargs['key'] class LinkedIntegrationRuntimeRbacAuthorization(LinkedIntegrationRuntimeType): - """The role based access control (RBAC) authorization type integration - runtime. + """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. Constant filled by server. + :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. + :param resource_id: Required. The resource identifier of the integration runtime to be shared. :type resource_id: str """ @@ -1823,24 +2682,56 @@ class LinkedIntegrationRuntimeRbacAuthorization(LinkedIntegrationRuntimeType): 'resource_id': {'key': 'resourceId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LinkedIntegrationRuntimeRbacAuthorization, self).__init__(**kwargs) - self.resource_id = kwargs.get('resource_id', None) - self.authorization_type = 'RBAC' + self.authorization_type = 'RBAC' # type: str + self.resource_id = kwargs['resource_id'] + + +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 ManagedIdentity(Model): +class ManagedIdentity(msrest.serialization.Model): """The workspace managed identity. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar principal_id: The principal ID of the workspace managed identity + :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 + :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' + :param type: The type of managed identity for the workspace. Possible values include: "None", + "SystemAssigned". :type type: str or ~azure.mgmt.synapse.models.ResourceIdentityType """ @@ -1852,34 +2743,33 @@ class ManagedIdentity(Model): _attribute_map = { 'principal_id': {'key': 'principalId', 'type': 'str'}, 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ResourceIdentityType'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ManagedIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = kwargs.get('type', None) -class ManagedIdentitySqlControlSettingsModel(ProxyResource): - """Managed Identity Sql Control Settings. +class ManagedIdentitySqlControlSettingsModel(Resource): + """Sql Control Settings for workspace managed identity. - Sql Control Settings for workspace managed identity. + Variables are only populated by the server, and will be ignored when sending a request. - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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 + :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 """ @@ -1897,23 +2787,26 @@ class ManagedIdentitySqlControlSettingsModel(ProxyResource): 'grant_sql_control_to_managed_identity': {'key': 'properties.grantSqlControlToManagedIdentity', 'type': 'ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity'}, } - def __init__(self, **kwargs): + 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(Model): +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. + 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.enum - :ivar actual_state: Actual state. Possible values include: 'Enabling', - 'Enabled', 'Disabling', 'Disabled', 'Unknown' - :vartype actual_state: str or ~azure.mgmt.synapse.models.enum + :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 = { @@ -1925,40 +2818,38 @@ class ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedId 'actual_state': {'key': 'actualState', 'type': 'str'}, } - def __init__(self, **kwargs): + 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. + """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. + Variables are only populated 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 this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] + :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 type: Required. Constant filled by server. - :type type: 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' + :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 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 + :type ssis_properties: ~azure.mgmt.synapse.models.IntegrationRuntimeSsisProperties """ _validation = { @@ -1968,32 +2859,34 @@ class ManagedIntegrationRuntime(IntegrationRuntime): _attribute_map = { 'additional_properties': {'key': '', 'type': '{object}'}, - 'description': {'key': 'description', 'type': 'str'}, '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): + 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) - self.type = 'Managed' -class ManagedIntegrationRuntimeError(Model): +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. + 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 this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] :ivar time: The time when the error occurred. - :vartype time: datetime + :vartype time: ~datetime.datetime :ivar code: Error code. :vartype code: str :ivar parameters: Managed integration runtime error parameters. @@ -2017,7 +2910,10 @@ class ManagedIntegrationRuntimeError(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ManagedIntegrationRuntimeError, self).__init__(**kwargs) self.additional_properties = kwargs.get('additional_properties', None) self.time = None @@ -2026,24 +2922,21 @@ def __init__(self, **kwargs): self.message = None -class ManagedIntegrationRuntimeNode(Model): +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. + 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 this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] :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 + :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] + :type errors: list[~azure.mgmt.synapse.models.ManagedIntegrationRuntimeError] """ _validation = { @@ -2058,7 +2951,10 @@ class ManagedIntegrationRuntimeNode(Model): 'errors': {'key': 'errors', 'type': '[ManagedIntegrationRuntimeError]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ManagedIntegrationRuntimeNode, self).__init__(**kwargs) self.additional_properties = kwargs.get('additional_properties', None) self.node_id = None @@ -2066,19 +2962,18 @@ def __init__(self, **kwargs): self.errors = kwargs.get('errors', None) -class ManagedIntegrationRuntimeOperationResult(Model): +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. + 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 this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] :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 + :vartype start_time: ~datetime.datetime :ivar result: The operation result. :vartype result: str :ivar error_code: The error code. @@ -2108,7 +3003,10 @@ class ManagedIntegrationRuntimeOperationResult(Model): 'activity_id': {'key': 'activityId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ManagedIntegrationRuntimeOperationResult, self).__init__(**kwargs) self.additional_properties = kwargs.get('additional_properties', None) self.type = None @@ -2122,42 +3020,36 @@ def __init__(self, **kwargs): class ManagedIntegrationRuntimeStatus(IntegrationRuntimeStatus): """Managed integration runtime status. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :param additional_properties: Unmatched properties from the message are - deserialized this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] - :ivar data_factory_name: The workspace name which the integration runtime - belong to. + :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' + :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 - :param type: Required. Constant filled by server. - :type type: str - :ivar create_time: The time at which the integration runtime was created, - in ISO8601 format. - :vartype create_time: datetime + :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] + :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 + :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}, - 'type': {'required': True}, 'create_time': {'readonly': True}, 'nodes': {'readonly': True}, 'other_errors': {'readonly': True}, @@ -2166,42 +3058,71 @@ class ManagedIntegrationRuntimeStatus(IntegrationRuntimeStatus): _attribute_map = { 'additional_properties': {'key': '', 'type': '{object}'}, + 'type': {'key': 'type', 'type': 'str'}, 'data_factory_name': {'key': 'dataFactoryName', 'type': 'str'}, 'state': {'key': 'state', 'type': 'str'}, - 'type': {'key': 'type', '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): + 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 - self.type = 'Managed' -class MetadataSyncConfig(ProxyResource): - """Metadata sync configuration. +class ManagedVirtualNetworkSettings(msrest.serialization.Model): + """Managed Virtual Network Settings. - Configuration for metadata sync. + :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]'}, + } - Variables are only populated by the server, and will be ignored when - sending a request. + 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) - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + +class MetadataSyncConfig(Resource): + """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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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 + :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 = { @@ -2215,21 +3136,26 @@ class MetadataSyncConfig(ProxyResource): '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): + 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 OperationMetaLogSpecification(Model): +class OperationMetaLogSpecification(msrest.serialization.Model): """What is this?. - :param display_name: Log display name + :param display_name: Log display name. :type display_name: str - :param blob_duration: Time range the log covers + :param blob_duration: Time range the log covers. :type blob_duration: str - :param name: Log unique name + :param name: Log unique name. :type name: str """ @@ -2239,22 +3165,24 @@ class OperationMetaLogSpecification(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, **kwargs): + 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(Model): +class OperationMetaMetricDimensionSpecification(msrest.serialization.Model): """What is this?. - :param display_name: Dimension display name + :param display_name: Dimension display name. :type display_name: str - :param name: Dimension unique name + :param name: Dimension unique name. :type name: str - :param to_be_exported_for_shoebox: Whether this metric should be exported - for Shoebox + :param to_be_exported_for_shoebox: Whether this metric should be exported for Shoebox. :type to_be_exported_for_shoebox: bool """ @@ -2264,40 +3192,41 @@ class OperationMetaMetricDimensionSpecification(Model): 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } - def __init__(self, **kwargs): + 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(Model): +class OperationMetaMetricSpecification(msrest.serialization.Model): """What is this?. - :param source_mdm_namespace: The source MDM namespace + :param source_mdm_namespace: The source MDM namespace. :type source_mdm_namespace: str - :param display_name: Metric display name + :param display_name: Metric display name. :type display_name: str - :param name: Metric unique name + :param name: Metric unique name. :type name: str - :param aggregation_type: Metric aggregation type + :param aggregation_type: Metric aggregation type. :type aggregation_type: str - :param display_description: Metric description + :param display_description: Metric description. :type display_description: str - :param source_mdm_account: The source MDM account + :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 + :param enable_regional_mdm_account: Whether the regional MDM account is enabled. :type enable_regional_mdm_account: bool - :param unit: Metric units + :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 + :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 + :param metric_filter_pattern: Metric filter. :type metric_filter_pattern: str """ @@ -2315,7 +3244,10 @@ class OperationMetaMetricSpecification(Model): 'metric_filter_pattern': {'key': 'metricFilterPattern', 'type': 'str'}, } - def __init__(self, **kwargs): + 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) @@ -2330,15 +3262,13 @@ def __init__(self, **kwargs): self.metric_filter_pattern = kwargs.get('metric_filter_pattern', None) -class OperationMetaServiceSpecification(Model): +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] + :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 = { @@ -2346,31 +3276,34 @@ class OperationMetaServiceSpecification(Model): 'log_specifications': {'key': 'logSpecifications', 'type': '[OperationMetaLogSpecification]'}, } - def __init__(self, **kwargs): + 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(Model): +class OperationResource(msrest.serialization.Model): """An operation. - :param id: Operation ID + :param id: Operation ID. :type id: str - :param name: Operation name + :param name: Operation name. :type name: str - :param status: Operation status. Possible values include: 'InProgress', - 'Succeeded', 'Failed', 'Canceled' + :param status: Operation status. Possible values include: "InProgress", "Succeeded", "Failed", + "Canceled". :type status: str or ~azure.mgmt.synapse.models.OperationStatus - :param properties: Operation properties + :param properties: Operation properties. :type properties: object - :param error: Errors from the operation + :param error: Errors from the operation. :type error: ~azure.mgmt.synapse.models.ErrorDetail - :param start_time: Operation start time - :type start_time: datetime - :param end_time: Operation start time - :type end_time: datetime - :param percent_complete: Completion percentage of the operation + :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 """ @@ -2385,7 +3318,10 @@ class OperationResource(Model): 'percent_complete': {'key': 'percentComplete', 'type': 'float'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OperationResource, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = kwargs.get('name', None) @@ -2397,11 +3333,10 @@ def __init__(self, **kwargs): self.percent_complete = kwargs.get('percent_complete', None) -class PrivateEndpoint(Model): +class PrivateEndpoint(msrest.serialization.Model): """Private endpoint details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource id of the private endpoint. :vartype id: str @@ -2415,34 +3350,34 @@ class PrivateEndpoint(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateEndpoint, self).__init__(**kwargs) self.id = None -class PrivateEndpointConnection(ProxyResource): +class PrivateEndpointConnection(Resource): """A private endpoint connection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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. + :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. + :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. + :ivar provisioning_state: Provisioning state of the private endpoint connection. :vartype provisioning_state: str """ @@ -2462,902 +3397,2014 @@ class PrivateEndpointConnection(ProxyResource): 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, **kwargs): + 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 PrivateLinkResource(ProxyResource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when - sending a request. +class PrivateEndpointConnectionForPrivateLinkHubBasicAutoGenerated(msrest.serialization.Model): + """PrivateEndpointConnectionForPrivateLinkHubBasicAutoGenerated. - :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. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - :vartype type: str - :ivar properties: The private link resource properties. - :vartype properties: - ~azure.mgmt.synapse.models.PrivateLinkResourceProperties + :param id: + :type id: str + :param properties: Properties of a private endpoint connection. + :type properties: ~azure.mgmt.synapse.models.PrivateEndpointConnectionProperties """ - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'properties': {'readonly': True}, + _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'}, - 'properties': {'key': 'properties', 'type': 'PrivateLinkResourceProperties'}, } - def __init__(self, **kwargs): - super(PrivateLinkResource, self).__init__(**kwargs) - self.properties = None + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionForPrivateLinkHub, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) -class PrivateLinkResourceProperties(Model): - """Properties of a private link resource. +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. + 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] + :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 = { - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - 'required_zone_names': {'readonly': True}, + 'id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { - 'group_id': {'key': 'groupId', 'type': 'str'}, - 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'requiredZoneNames', 'type': '[str]'}, + '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(PrivateLinkResourceProperties, self).__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = None - + 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 PrivateLinkServiceConnectionState(Model): - """Connection state details of the private endpoint. - Variables are only populated by the server, and will be ignored when - sending a request. +class PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse(msrest.serialization.Model): + """PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse. - :param status: The private link service connection status. Possible values - include: 'Approved', 'Pending', 'Rejected', 'Disconnected' - :type status: str or ~azure.mgmt.synapse.models.enum - :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 + :param value: + :type value: list[~azure.mgmt.synapse.models.PrivateEndpointConnectionForPrivateLinkHub] + :param next_link: + :type next_link: str """ - _validation = { - 'actions_required': {'readonly': True}, - } - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[PrivateEndpointConnectionForPrivateLinkHub]'}, + 'next_link': {'key': 'nextLink', '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 + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) -class QueryInterval(Model): - """A database query. +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. + 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 - :ivar execution_count: The number of times the query was executed during - this interval. - :vartype execution_count: float - :ivar metrics: The list of query metrics during this interval. - :vartype metrics: list[~azure.mgmt.synapse.models.QueryMetric] + :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 = { - 'interval_start_time': {'readonly': True}, - 'execution_count': {'readonly': True}, - 'metrics': {'readonly': True}, + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'interval_start_time': {'key': 'intervalStartTime', 'type': 'iso-8601'}, - 'execution_count': {'key': 'executionCount', 'type': 'float'}, - 'metrics': {'key': 'metrics', 'type': '[QueryMetric]'}, + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): - super(QueryInterval, self).__init__(**kwargs) - self.interval_start_time = None - self.execution_count = None - self.metrics = None + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionList, self).__init__(**kwargs) + self.value = None + self.next_link = None -class QueryMetric(Model): - """A database query. +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. + 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 + :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 = { - 'name': {'readonly': True}, - 'display_name': {'readonly': True}, - 'unit': {'readonly': True}, - 'value': {'readonly': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'QueryMetricUnit'}, - 'value': {'key': 'value', 'type': 'float'}, + '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(QueryMetric, self).__init__(**kwargs) - self.name = None - self.display_name = None - self.unit = None - self.value = None + 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 QueryStatistic(Model): - """A database query. +class PrivateLinkHub(TrackedResource): + """A privateLinkHub. - Variables are only populated by the server, and will be ignored when - sending a request. + 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] + 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 = { - 'query_id': {'readonly': True}, - 'intervals': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'private_endpoint_connections': {'readonly': True}, } _attribute_map = { - 'query_id': {'key': 'queryId', 'type': 'str'}, - 'intervals': {'key': 'intervals', 'type': '[QueryInterval]'}, + '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(QueryStatistic, self).__init__(**kwargs) - self.query_id = None - self.intervals = None + def __init__( + self, + **kwargs + ): + super(PrivateLinkHub, self).__init__(**kwargs) + self.provisioning_state = kwargs.get('provisioning_state', None) + self.private_endpoint_connections = None -class ReplaceAllFirewallRulesOperationResponse(Model): - """An existing operation for replacing the firewall rules. +class PrivateLinkHubInfoListResult(msrest.serialization.Model): + """List of privateLinkHubs. - :param operation_id: The operation ID - :type operation_id: str + :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 = { - 'operation_id': {'key': 'operationId', 'type': 'str'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[PrivateLinkHub]'}, } - def __init__(self, **kwargs): - super(ReplaceAllFirewallRulesOperationResponse, self).__init__(**kwargs) - self.operation_id = kwargs.get('operation_id', None) + def __init__( + self, + **kwargs + ): + super(PrivateLinkHubInfoListResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) -class ReplaceAllIpFirewallRulesRequest(Model): - """Replace all IP firewall rules request. +class PrivateLinkHubPatchInfo(msrest.serialization.Model): + """PrivateLinkHub patch details. - :param ip_firewall_rules: IP firewall rule properties - :type ip_firewall_rules: dict[str, - ~azure.mgmt.synapse.models.IpFirewallRuleProperties] + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] """ _attribute_map = { - 'ip_firewall_rules': {'key': 'ipFirewallRules', 'type': '{IpFirewallRuleProperties}'}, + 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): - super(ReplaceAllIpFirewallRulesRequest, self).__init__(**kwargs) - self.ip_firewall_rules = kwargs.get('ip_firewall_rules', None) + def __init__( + self, + **kwargs + ): + super(PrivateLinkHubPatchInfo, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) -class ReplicationLink(ProxyResource): - """Represents a Sql pool replication link. +class PrivateLinkResource(Resource): + """A private link resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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 - :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 + :ivar properties: The private link resource properties. + :vartype properties: ~azure.mgmt.synapse.models.PrivateLinkResourceProperties """ _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}, + 'properties': {'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': 'ReplicationRole'}, - 'partner_role': {'key': 'properties.partnerRole', 'type': 'ReplicationRole'}, - 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, - 'percent_complete': {'key': 'properties.percentComplete', 'type': 'int'}, - 'replication_state': {'key': 'properties.replicationState', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'PrivateLinkResourceProperties'}, } - 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 + def __init__( + self, + **kwargs + ): + super(PrivateLinkResource, self).__init__(**kwargs) + self.properties = None -class ResourceMoveDefinition(Model): - """Contains the information necessary to perform a resource move (rename). +class PrivateLinkResourceListResult(msrest.serialization.Model): + """A list of private link resources. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param id: Required. The target ID for the resource - :type id: str + :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 = { - 'id': {'required': True}, + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): - super(ResourceMoveDefinition, self).__init__(**kwargs) - self.id = kwargs.get('id', None) + def __init__( + self, + **kwargs + ): + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None -class RestorePoint(ProxyResource): - """Database restore points. +class PrivateLinkResourceProperties(msrest.serialization.Model): + """Properties of a private link resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar 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. Ex- - 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 - :ivar restore_point_creation_date: The time the backup was taken - :vartype restore_point_creation_date: datetime - :ivar restore_point_label: The label of restore point for backup request - by user - :vartype restore_point_label: str + :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 = { - '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}, + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + 'required_zone_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'}, - 'restore_point_type': {'key': 'properties.restorePointType', 'type': 'RestorePointType'}, - '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'}, + 'group_id': {'key': 'groupId', 'type': 'str'}, + 'required_members': {'key': 'requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'requiredZoneNames', '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 - + def __init__( + self, + **kwargs + ): + super(PrivateLinkResourceProperties, self).__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = None -class SecretBase(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 +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """Connection state details of the private endpoint. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param type: Required. Constant filled by server. - :type type: str + :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 = { - 'type': {'required': True}, + 'actions_required': {'readonly': True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'SecureString': 'SecureString'} + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } - def __init__(self, **kwargs): - super(SecretBase, self).__init__(**kwargs) - self.type = None + 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 SecureString(SecretBase): - """Azure Synapse secure string definition. The string value will be masked - with asterisks '*' during Get or List API calls. +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param type: Required. Constant filled by server. - :type type: str - :param value: Required. Value of secure string. - :type value: str + :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 = { - 'type': {'required': True}, - 'value': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, } _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): - super(SecureString, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.type = 'SecureString' + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) -class SelfHostedIntegrationRuntime(IntegrationRuntime): - """Self-hosted integration runtime. +class PurviewConfiguration(msrest.serialization.Model): + """Purview Configuration. - All required parameters must be populated in order to send to Azure. + :param purview_resource_id: Purview Resource ID. + :type purview_resource_id: str + """ - :param additional_properties: Unmatched properties from the message are - deserialized this collection - :type additional_properties: dict[str, object] - :param description: Integration runtime description. - :type description: str - :param type: Required. Constant filled by server. - :type type: str - :param linked_info: - :type linked_info: ~azure.mgmt.synapse.models.LinkedIntegrationRuntimeType + _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 = { - 'type': {'required': True}, + 'interval_start_time': {'readonly': True}, + 'execution_count': {'readonly': True}, + 'metrics': {'readonly': True}, } _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'description': {'key': 'description', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'linked_info': {'key': 'typeProperties.linkedInfo', 'type': 'LinkedIntegrationRuntimeType'}, + 'interval_start_time': {'key': 'intervalStartTime', 'type': 'iso-8601'}, + 'execution_count': {'key': 'executionCount', 'type': 'int'}, + 'metrics': {'key': 'metrics', 'type': '[QueryMetric]'}, } - def __init__(self, **kwargs): - super(SelfHostedIntegrationRuntime, self).__init__(**kwargs) - self.linked_info = kwargs.get('linked_info', None) - self.type = 'SelfHosted' + def __init__( + self, + **kwargs + ): + super(QueryInterval, self).__init__(**kwargs) + self.interval_start_time = None + self.execution_count = None + self.metrics = None -class SelfHostedIntegrationRuntimeNode(Model): - """Properties of Self-hosted integration runtime node. +class QueryMetric(msrest.serialization.Model): + """A database query. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param additional_properties: Unmatched properties from the message are - deserialized this collection - :type additional_properties: dict[str, object] - :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 - :ivar last_connect_time: The most recent time at which the integration - runtime was connected in ISO8601 format. - :vartype last_connect_time: datetime - :ivar expiry_time: The time at which the integration runtime will expire - in ISO8601 format. - :vartype expiry_time: datetime - :ivar last_start_time: The time the node last started up. - :vartype last_start_time: datetime - :ivar last_stop_time: The integration runtime node last stop time. - :vartype last_stop_time: 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 - :ivar last_end_update_time: The last time for the integration runtime node - update end. - :vartype last_end_update_time: 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 - """ + :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 RecoverableSqlPool(Resource): + """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(Resource): + """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 RestorableDroppedSqlPool(Resource): + """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(Resource): + """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, object] + :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, object] + :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, object] + :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(Resource): + """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 + :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 + """ _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}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'is_disabled': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', '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'}, + } + + def __init__( + self, + **kwargs + ): + super(SensitivityLabel, self).__init__(**kwargs) + 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 + + +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 ServerBlobAuditingPolicy(Resource): + """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(Resource): + """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 = { - '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'}, + '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(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 + 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 SelfHostedIntegrationRuntimeStatus(IntegrationRuntimeStatus): - """Self-hosted integration runtime status. +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. + Variables are only populated 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 this collection - :type additional_properties: dict[str, object] - :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 - :param type: Required. Constant filled by server. - :type type: str - :ivar create_time: The time at which the integration runtime was created, - in ISO8601 format. - :vartype create_time: datetime - :ivar task_queue_id: The task queue id of the integration runtime. - :vartype task_queue_id: 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 - :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 + :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 = { - 'data_factory_name': {'readonly': True}, - 'state': {'readonly': True}, - 'type': {'required': True}, - 'create_time': {'readonly': True}, - 'task_queue_id': {'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}, + 'value': {'required': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'data_factory_name': {'key': 'dataFactoryName', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'create_time': {'key': 'typeProperties.createTime', 'type': 'iso-8601'}, - 'task_queue_id': {'key': 'typeProperties.taskQueueId', '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'}, + 'value': {'key': 'value', 'type': '[ServerUsage]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): - super(SelfHostedIntegrationRuntimeStatus, self).__init__(**kwargs) - self.create_time = None - self.task_queue_id = 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 - self.type = 'SelfHosted' + def __init__( + self, + **kwargs + ): + super(ServerUsageListResult, self).__init__(**kwargs) + self.value = kwargs['value'] + self.next_link = None -class SensitivityLabel(ProxyResource): - """A sensitivity label. +class ServerVulnerabilityAssessment(Resource): + """A server vulnerability assessment. - Variables are only populated by the server, and will be ignored when - sending a request. + 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} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: 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 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}, - 'is_disabled': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', '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'}, + '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(SensitivityLabel, self).__init__(**kwargs) - 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 + 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(Model): - """Sku. - SQL pool SKU. +class Sku(msrest.serialization.Model): + """SQL pool SKU. - :param tier: The service tier + :param tier: The service tier. :type tier: str - :param name: The SKU name + :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): + 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 SqlPool(TrackedResource): - """SQL pool. - - A SQL Analytics pool. + """A SQL Analytics pool. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives + :param location: Required. The geo-location where the resource lives. :type location: str - :param sku: SQL pool SKU + :param sku: SQL pool SKU. :type sku: ~azure.mgmt.synapse.models.Sku - :param max_size_bytes: Maximum size in bytes + :param max_size_bytes: Maximum size in bytes. :type max_size_bytes: long - :param collation: Collation mode + :param collation: Collation mode. :type collation: str - :param source_database_id: Source database to create from + :param source_database_id: Source database to create from. :type source_database_id: str - :param recoverable_database_id: Backup database to restore from + :param recoverable_database_id: Backup database to restore from. :type recoverable_database_id: str - :param provisioning_state: Resource state + :param provisioning_state: Resource state. :type provisioning_state: str - :param status: Resource status + :param status: Resource status. :type status: str - :param restore_point_in_time: Snapshot time to restore - :type restore_point_in_time: datetime - :param create_mode: What is this? + :param restore_point_in_time: Snapshot time to restore. + :type restore_point_in_time: str + :param create_mode: What is this?. :type create_mode: str - :param creation_date: Date the SQL pool was created - :type creation_date: datetime + :param creation_date: Date the SQL pool was created. + :type creation_date: ~datetime.datetime """ _validation = { @@ -3380,12 +5427,15 @@ class SqlPool(TrackedResource): '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'}, + 'restore_point_in_time': {'key': 'properties.restorePointInTime', 'type': 'str'}, 'create_mode': {'key': 'properties.createMode', 'type': 'str'}, 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + 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) @@ -3399,52 +5449,50 @@ def __init__(self, **kwargs): self.creation_date = kwargs.get('creation_date', None) -class SqlPoolBlobAuditingPolicy(ProxyResource): +class SqlPoolBlobAuditingPolicy(Resource): """A Sql pool blob auditing 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. + 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} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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: Required. Specifies the state of the policy. If state is - Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. - Possible values include: 'Enabled', 'Disabled' + :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. + 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. + :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. + :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: + :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): + + 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 @@ -3465,14 +5513,17 @@ class SqlPoolBlobAuditingPolicy(ProxyResource): 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](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#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: + + 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 @@ -3480,41 +5531,45 @@ class SqlPoolBlobAuditingPolicy(ProxyResource): EXECUTE RECEIVE REFERENCES + The general form for defining an action to be audited is: {action} ON {object} BY {principal} - Note that 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. + + 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](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) + + 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. + :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. + :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}. + :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](https://go.microsoft.com/fwlink/?linkid=2033207) - or [Diagnostic Settings - PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) + 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 """ @@ -3523,7 +5578,6 @@ class SqlPoolBlobAuditingPolicy(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'kind': {'readonly': True}, - 'state': {'required': True}, } _attribute_map = { @@ -3531,7 +5585,7 @@ class SqlPoolBlobAuditingPolicy(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'BlobAuditingPolicyState'}, + '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'}, @@ -3541,7 +5595,10 @@ class SqlPoolBlobAuditingPolicy(ProxyResource): 'is_azure_monitor_target_enabled': {'key': 'properties.isAzureMonitorTargetEnabled', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SqlPoolBlobAuditingPolicy, self).__init__(**kwargs) self.kind = None self.state = kwargs.get('state', None) @@ -3554,27 +5611,84 @@ def __init__(self, **kwargs): self.is_azure_monitor_target_enabled = kwargs.get('is_azure_monitor_target_enabled', None) -class SqlPoolColumn(ProxyResource): +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(Resource): """A Sql pool column resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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' + :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 """ @@ -3591,24 +5705,56 @@ class SqlPoolColumn(ProxyResource): 'column_type': {'key': 'properties.columnType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SqlPoolColumn, self).__init__(**kwargs) self.column_type = kwargs.get('column_type', None) -class SqlPoolConnectionPolicy(ProxyResource): +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(Resource): """A Sql pool connection policy. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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 @@ -3616,8 +5762,7 @@ class SqlPoolConnectionPolicy(ProxyResource): :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. + :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 @@ -3654,7 +5799,10 @@ class SqlPoolConnectionPolicy(ProxyResource): 'state': {'key': 'properties.state', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SqlPoolConnectionPolicy, self).__init__(**kwargs) self.kind = None self.location = None @@ -3667,22 +5815,43 @@ def __init__(self, **kwargs): self.state = kwargs.get('state', None) -class SqlPoolOperation(ProxyResource): +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(Resource): """A Sql pool operation. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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. + :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 @@ -3693,9 +5862,9 @@ class SqlPoolOperation(ProxyResource): :ivar server_name: The name of the server. :vartype server_name: str :ivar start_time: The operation start time. - :vartype start_time: datetime - :ivar state: The operation state. Possible values include: 'Pending', - 'InProgress', 'Succeeded', 'Failed', 'CancelInProgress', 'Cancelled' + :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 @@ -3705,9 +5874,8 @@ class SqlPoolOperation(ProxyResource): :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 + :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. @@ -3754,7 +5922,10 @@ class SqlPoolOperation(ProxyResource): 'is_cancellable': {'key': 'properties.isCancellable', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SqlPoolOperation, self).__init__(**kwargs) self.database_name = None self.operation = None @@ -3772,35 +5943,33 @@ def __init__(self, **kwargs): self.is_cancellable = None -class SqlPoolPatchInfo(Model): - """SQL pool patch info. +class SqlPoolPatchInfo(msrest.serialization.Model): + """A SQL Analytics pool patch info. - A SQL Analytics pool patch info. - - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: The geo-location where the resource lives + :param location: The geo-location where the resource lives. :type location: str - :param sku: SQL pool SKU + :param sku: SQL pool SKU. :type sku: ~azure.mgmt.synapse.models.Sku - :param max_size_bytes: Maximum size in bytes + :param max_size_bytes: Maximum size in bytes. :type max_size_bytes: long - :param collation: Collation mode + :param collation: Collation mode. :type collation: str - :param source_database_id: Source database to create from + :param source_database_id: Source database to create from. :type source_database_id: str - :param recoverable_database_id: Backup database to restore from + :param recoverable_database_id: Backup database to restore from. :type recoverable_database_id: str - :param provisioning_state: Resource state + :param provisioning_state: Resource state. :type provisioning_state: str - :param status: Resource status + :param status: Resource status. :type status: str - :param restore_point_in_time: Snapshot time to restore - :type restore_point_in_time: datetime - :param create_mode: What is this? + :param restore_point_in_time: Snapshot time to restore. + :type restore_point_in_time: str + :param create_mode: What is this?. :type create_mode: str - :param creation_date: Date the SQL pool was created - :type creation_date: datetime + :param creation_date: Date the SQL pool was created. + :type creation_date: ~datetime.datetime """ _attribute_map = { @@ -3813,12 +5982,15 @@ class SqlPoolPatchInfo(Model): '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'}, + 'restore_point_in_time': {'key': 'properties.restorePointInTime', 'type': 'str'}, 'create_mode': {'key': 'properties.createMode', 'type': 'str'}, 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SqlPoolPatchInfo, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) self.location = kwargs.get('location', None) @@ -3834,19 +6006,18 @@ def __init__(self, **kwargs): self.creation_date = kwargs.get('creation_date', None) -class SqlPoolSchema(ProxyResource): +class SqlPoolSchema(Resource): """A Sql pool schema resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -3862,59 +6033,84 @@ class SqlPoolSchema(ProxyResource): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SqlPoolSchema, self).__init__(**kwargs) -class SqlPoolSecurityAlertPolicy(ProxyResource): - """A Sql pool security alert policy. +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. + Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + :ivar value: Array of results. + :vartype value: list[~azure.mgmt.synapse.models.Resource] + :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': '[Resource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + def __init__( + self, + **kwargs + ): + super(SqlPoolSchemaListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class SqlPoolSecurityAlertPolicy(Resource): + """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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param state: Required. 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' + :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 + :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. + :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. + :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. + 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. + :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. + :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 + :vartype creation_time: ~datetime.datetime """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'state': {'required': True}, 'creation_time': {'readonly': True}, } @@ -3922,7 +6118,7 @@ class SqlPoolSecurityAlertPolicy(ProxyResource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'SecurityAlertPolicyState'}, + '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'}, @@ -3932,7 +6128,10 @@ class SqlPoolSecurityAlertPolicy(ProxyResource): 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SqlPoolSecurityAlertPolicy, self).__init__(**kwargs) self.state = kwargs.get('state', None) self.disabled_alerts = kwargs.get('disabled_alerts', None) @@ -3944,19 +6143,18 @@ def __init__(self, **kwargs): self.creation_time = None -class SqlPoolTable(ProxyResource): +class SqlPoolTable(Resource): """A Sql pool table resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -3972,15 +6170,47 @@ class SqlPoolTable(ProxyResource): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SqlPoolTable, self).__init__(**kwargs) -class SqlPoolUsage(Model): +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.Resource] + :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': '[Resource]'}, + '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. + 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 @@ -3994,9 +6224,8 @@ class SqlPoolUsage(Model): :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 + :ivar next_reset_time: The next reset time for the usage metric (ISO8601 format). + :vartype next_reset_time: ~datetime.datetime """ _validation = { @@ -4019,7 +6248,10 @@ class SqlPoolUsage(Model): 'next_reset_time': {'key': 'nextResetTime', 'type': 'iso-8601'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SqlPoolUsage, self).__init__(**kwargs) self.name = None self.resource_name = None @@ -4030,35 +6262,64 @@ def __init__(self, **kwargs): self.next_reset_time = None -class SqlPoolVulnerabilityAssessment(ProxyResource): +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(Resource): """A Sql pool vulnerability assessment. - Variables are only populated by the server, and will be ignored when - sending a request. + 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} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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 + :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. + :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. + :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 + :param recurring_scans: The recurring scans settings. :type recurring_scans: ~azure.mgmt.synapse.models.VulnerabilityAssessmentRecurringScansProperties """ @@ -4079,7 +6340,10 @@ class SqlPoolVulnerabilityAssessment(ProxyResource): 'recurring_scans': {'key': 'properties.recurringScans', 'type': 'VulnerabilityAssessmentRecurringScansProperties'}, } - def __init__(self, **kwargs): + 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) @@ -4087,23 +6351,50 @@ def __init__(self, **kwargs): self.recurring_scans = kwargs.get('recurring_scans', None) -class SqlPoolVulnerabilityAssessmentRuleBaseline(ProxyResource): - """A Sql pool vulnerability assessment rule baseline. +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. + Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + :ivar value: 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}, + } - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + _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(Resource): + """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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param baseline_results: Required. The rule baseline result + :param baseline_results: The rule baseline result. :type baseline_results: list[~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessmentRuleBaselineItem] """ @@ -4112,7 +6403,6 @@ class SqlPoolVulnerabilityAssessmentRuleBaseline(ProxyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'baseline_results': {'required': True}, } _attribute_map = { @@ -4122,17 +6412,20 @@ class SqlPoolVulnerabilityAssessmentRuleBaseline(ProxyResource): 'baseline_results': {'key': 'properties.baselineResults', 'type': '[SqlPoolVulnerabilityAssessmentRuleBaselineItem]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SqlPoolVulnerabilityAssessmentRuleBaseline, self).__init__(**kwargs) self.baseline_results = kwargs.get('baseline_results', None) -class SqlPoolVulnerabilityAssessmentRuleBaselineItem(Model): +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 + :param result: Required. The rule baseline result. :type result: list[str] """ @@ -4144,24 +6437,26 @@ class SqlPoolVulnerabilityAssessmentRuleBaselineItem(Model): 'result': {'key': 'result', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SqlPoolVulnerabilityAssessmentRuleBaselineItem, self).__init__(**kwargs) - self.result = kwargs.get('result', None) + self.result = kwargs['result'] -class SqlPoolVulnerabilityAssessmentScansExport(ProxyResource): +class SqlPoolVulnerabilityAssessmentScansExport(Resource): """A Sql pool Vulnerability Assessment scan export resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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). @@ -4182,27 +6477,31 @@ class SqlPoolVulnerabilityAssessmentScansExport(ProxyResource): 'exported_report_location': {'key': 'properties.exportedReportLocation', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SqlPoolVulnerabilityAssessmentScansExport, self).__init__(**kwargs) self.exported_report_location = None -class SsisObjectMetadata(Model): +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: SsisFolder, SsisProject, SsisPackage, SsisEnvironment + 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 - :param type: Required. Constant filled by server. - :type type: str """ _validation = { @@ -4210,22 +6509,25 @@ class SsisObjectMetadata(Model): } _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, 'id': {'key': 'id', 'type': 'long'}, 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, } _subtype_map = { - 'type': {'Folder': 'SsisFolder', 'Project': 'SsisProject', 'Package': 'SsisPackage', 'Environment': 'SsisEnvironment'} + 'type': {'Environment': 'SsisEnvironment', 'Folder': 'SsisFolder', 'Package': 'SsisPackage', 'Project': 'SsisProject'} } - def __init__(self, **kwargs): + 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) - self.type = None class SsisEnvironment(SsisObjectMetadata): @@ -4233,17 +6535,18 @@ 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: + "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 type: Required. Constant filled by server. - :type type: str :param folder_id: Folder id which contains environment. :type folder_id: long - :param variables: Variable in environment + :param variables: Variable in environment. :type variables: list[~azure.mgmt.synapse.models.SsisVariable] """ @@ -4252,22 +6555,25 @@ class SsisEnvironment(SsisObjectMetadata): } _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, 'id': {'key': 'id', 'type': 'long'}, 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, 'folder_id': {'key': 'folderId', 'type': 'long'}, 'variables': {'key': 'variables', 'type': '[SsisVariable]'}, } - def __init__(self, **kwargs): + 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) - self.type = 'Environment' -class SsisEnvironmentReference(Model): +class SsisEnvironmentReference(msrest.serialization.Model): """Ssis environment reference. :param id: Environment reference id. @@ -4276,7 +6582,7 @@ class SsisEnvironmentReference(Model): :type environment_folder_name: str :param environment_name: Environment name. :type environment_name: str - :param reference_type: Reference type + :param reference_type: Reference type. :type reference_type: str """ @@ -4287,7 +6593,10 @@ class SsisEnvironmentReference(Model): 'reference_type': {'key': 'referenceType', 'type': 'str'}, } - def __init__(self, **kwargs): + 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) @@ -4300,14 +6609,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: + "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 type: Required. Constant filled by server. - :type type: str """ _validation = { @@ -4315,24 +6625,26 @@ class SsisFolder(SsisObjectMetadata): } _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, 'id': {'key': 'id', 'type': 'long'}, 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SsisFolder, self).__init__(**kwargs) - self.type = 'Folder' + self.type = 'Folder' # type: str -class SsisObjectMetadataListResponse(Model): +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. + :param next_link: The link to the next page of results, if any remaining results exist. :type next_link: str """ @@ -4341,13 +6653,16 @@ class SsisObjectMetadataListResponse(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + 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(Model): +class SsisObjectMetadataStatusResponse(msrest.serialization.Model): """The status of the operation. :param status: The status of the operation. @@ -4367,7 +6682,10 @@ class SsisObjectMetadataStatusResponse(Model): 'error': {'key': 'error', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SsisObjectMetadataStatusResponse, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.name = kwargs.get('name', None) @@ -4380,21 +6698,22 @@ 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: + "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 type: Required. Constant filled by server. - :type type: 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 + :param parameters: Parameters in package. :type parameters: list[~azure.mgmt.synapse.models.SsisParameter] """ @@ -4403,26 +6722,29 @@ class SsisPackage(SsisObjectMetadata): } _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, 'id': {'key': 'id', 'type': 'long'}, 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'type': {'key': 'type', '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): + 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) - self.type = 'Package' -class SsisParameter(Model): +class SsisParameter(msrest.serialization.Model): """Ssis parameter. :param id: Parameter id. @@ -4466,7 +6788,10 @@ class SsisParameter(Model): 'variable': {'key': 'variable', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SsisParameter, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = kwargs.get('name', None) @@ -4487,22 +6812,22 @@ 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: + "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 type: Required. Constant filled by server. - :type type: 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 + :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] """ @@ -4511,26 +6836,29 @@ class SsisProject(SsisObjectMetadata): } _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, 'id': {'key': 'id', 'type': 'long'}, 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'type': {'key': 'type', '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): + 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) - self.type = 'Project' -class SsisVariable(Model): +class SsisVariable(msrest.serialization.Model): """Ssis variable. :param id: Variable id. @@ -4559,7 +6887,10 @@ class SsisVariable(Model): 'sensitive_value': {'key': 'sensitiveValue', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SsisVariable, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.name = kwargs.get('name', None) @@ -4570,37 +6901,66 @@ def __init__(self, **kwargs): self.sensitive_value = kwargs.get('sensitive_value', None) -class TopQueries(Model): +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 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). + 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: float - :ivar observation_start_time: The start time for queries that are returned - (ISO8601 format) - :vartype observation_start_time: datetime - :ivar observation_end_time: The end time for queries that are returned - (ISO8601 format) - :vartype observation_end_time: 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 + :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] """ @@ -4617,17 +6977,20 @@ class TopQueries(Model): } _attribute_map = { - 'aggregation_function': {'key': 'aggregationFunction', 'type': 'QueryAggregationFunction'}, - 'execution_type': {'key': 'executionType', 'type': 'QueryExecutionType'}, + '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': 'float'}, + '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': 'QueryObservedMetricType'}, + 'observed_metric': {'key': 'observedMetric', 'type': 'str'}, 'queries': {'key': 'queries', 'type': '[QueryStatistic]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TopQueries, self).__init__(**kwargs) self.aggregation_function = None self.execution_type = None @@ -4639,7 +7002,7 @@ def __init__(self, **kwargs): self.queries = None -class TopQueriesListResult(Model): +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. @@ -4656,31 +7019,32 @@ class TopQueriesListResult(Model): 'value': {'key': 'value', 'type': '[TopQueries]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TopQueriesListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) + self.value = kwargs['value'] -class TransparentDataEncryption(ProxyResource): +class TransparentDataEncryption(Resource): """Represents a Sql pool transparent data encryption configuration. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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 + :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 = { @@ -4695,21 +7059,53 @@ class TransparentDataEncryption(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'TransparentDataEncryptionStatus'}, + 'status': {'key': 'properties.status', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(TransparentDataEncryption, self).__init__(**kwargs) self.location = None self.status = kwargs.get('status', None) -class UpdateIntegrationRuntimeNodeRequest(Model): +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. + :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 """ @@ -4721,23 +7117,23 @@ class UpdateIntegrationRuntimeNodeRequest(Model): 'concurrent_jobs_limit': {'key': 'concurrentJobsLimit', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(UpdateIntegrationRuntimeNodeRequest, self).__init__(**kwargs) self.concurrent_jobs_limit = kwargs.get('concurrent_jobs_limit', None) -class UpdateIntegrationRuntimeRequest(Model): +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. + :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 """ @@ -4746,16 +7142,19 @@ class UpdateIntegrationRuntimeRequest(Model): 'update_delay_offset': {'key': 'updateDelayOffset', 'type': 'str'}, } - def __init__(self, **kwargs): + 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 VirtualNetworkProfile(Model): +class VirtualNetworkProfile(msrest.serialization.Model): """Virtual Network Profile. - :param compute_subnet_id: Subnet ID used for computes in workspace + :param compute_subnet_id: Subnet ID used for computes in workspace. :type compute_subnet_id: str """ @@ -4763,22 +7162,23 @@ class VirtualNetworkProfile(Model): 'compute_subnet_id': {'key': 'computeSubnetId', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VirtualNetworkProfile, self).__init__(**kwargs) self.compute_subnet_id = kwargs.get('compute_subnet_id', None) -class VulnerabilityAssessmentRecurringScansProperties(Model): +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. Default - value: True . + :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. + :param emails: Specifies an array of e-mail addresses to which the scan notification is sent. :type emails: list[str] """ @@ -4788,18 +7188,20 @@ class VulnerabilityAssessmentRecurringScansProperties(Model): 'emails': {'key': 'emails', 'type': '[str]'}, } - def __init__(self, **kwargs): + 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(Model): +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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar code: The error code. :vartype code: str @@ -4817,47 +7219,44 @@ class VulnerabilityAssessmentScanError(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VulnerabilityAssessmentScanError, self).__init__(**kwargs) self.code = None self.message = None -class VulnerabilityAssessmentScanRecord(ProxyResource): +class VulnerabilityAssessmentScanRecord(Resource): """A vulnerability assessment scan record. - Variables are only populated by the server, and will be ignored when - sending a request. + 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} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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 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 + :vartype start_time: ~datetime.datetime :ivar end_time: The scan end time (UTC). - :vartype end_time: datetime + :vartype end_time: ~datetime.datetime :ivar errors: The scan errors. - :vartype errors: - list[~azure.mgmt.synapse.models.VulnerabilityAssessmentScanError] + :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. + :ivar number_of_failed_security_checks: The number of failed security checks. :vartype number_of_failed_security_checks: int """ @@ -4889,7 +7288,10 @@ class VulnerabilityAssessmentScanRecord(ProxyResource): 'number_of_failed_security_checks': {'key': 'properties.numberOfFailedSecurityChecks', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VulnerabilityAssessmentScanRecord, self).__init__(**kwargs) self.scan_id = None self.trigger_type = None @@ -4901,54 +7303,269 @@ def __init__(self, **kwargs): 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(Resource): + """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(Resource): + """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. + Variables are only 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} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives + :param location: Required. The geo-location where the resource lives. :type location: str - :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 + :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 - :ivar managed_resource_group_name: Workspace managed resource group - :vartype managed_resource_group_name: str - :ivar provisioning_state: Resource provisioning state + :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 + :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 + :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. + :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 identity: Identity of the workspace - :type identity: ~azure.mgmt.synapse.models.ManagedIdentity + :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, object] + :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 """ _validation = { @@ -4956,8 +7573,9 @@ class Workspace(TrackedResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'managed_resource_group_name': {'readonly': True}, 'provisioning_state': {'readonly': True}, + 'workspace_uid': {'readonly': True}, + 'extra_properties': {'readonly': True}, } _attribute_map = { @@ -4966,6 +7584,7 @@ class Workspace(TrackedResource): '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'}, @@ -4975,45 +7594,57 @@ class Workspace(TrackedResource): 'connectivity_endpoints': {'key': 'properties.connectivityEndpoints', 'type': '{str}'}, 'managed_virtual_network': {'key': 'properties.managedVirtualNetwork', 'type': 'str'}, 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, - } - - def __init__(self, **kwargs): + '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'}, + } + + 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 = 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.identity = kwargs.get('identity', 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) -class WorkspaceAadAdminInfo(ProxyResource): +class WorkspaceAadAdminInfo(Resource): """Workspace active directory administrator. - Variables are only populated by the server, and will be ignored when - sending a request. + 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} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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 + :param tenant_id: Tenant ID of the workspace active directory administrator. :type tenant_id: str - :param login: Login of the workspace active directory administrator + :param login: Login of the workspace active directory administrator. :type login: str - :param administrator_type: Workspace active directory administrator type + :param administrator_type: Workspace active directory administrator type. :type administrator_type: str - :param sid: Object ID of the workspace active directory administrator + :param sid: Object ID of the workspace active directory administrator. :type sid: str """ @@ -5033,7 +7664,10 @@ class WorkspaceAadAdminInfo(ProxyResource): 'sid': {'key': 'properties.sid', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(WorkspaceAadAdminInfo, self).__init__(**kwargs) self.tenant_id = kwargs.get('tenant_id', None) self.login = kwargs.get('login', None) @@ -5041,19 +7675,72 @@ def __init__(self, **kwargs): self.sid = kwargs.get('sid', None) -class WorkspacePatchInfo(Model): +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. + Variables are only populated by the server, and will be ignored when sending a request. - :param tags: Resource tags + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param identity: The identity of the workspace + :param identity: The identity of the workspace. :type identity: ~azure.mgmt.synapse.models.ManagedIdentity - :param sql_administrator_login_password: SQL administrator login password + :param sql_administrator_login_password: SQL administrator login password. :type sql_administrator_login_password: str - :ivar provisioning_state: Resource provisioning state + :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 """ @@ -5065,12 +7752,65 @@ class WorkspacePatchInfo(Model): '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'}, } - def __init__(self, **kwargs): + 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 + + +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 + """ + + _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'}, + } + + 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) 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 0a4457f4b985..6836b36cc3a8 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 @@ -1,25 +1,25 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +import datetime +from typing import Dict, List, Optional, Union +from azure.core.exceptions import HttpResponseError +import msrest.serialization -class AutoPauseProperties(Model): - """Spark pool auto-pausing properties. +from ._synapse_management_client_enums import * - 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. +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 @@ -30,25 +30,26 @@ class AutoPauseProperties(Model): 'enabled': {'key': 'enabled', 'type': 'bool'}, } - def __init__(self, *, delay_in_minutes: int=None, enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + delay_in_minutes: Optional[int] = None, + enabled: Optional[bool] = None, + **kwargs + ): super(AutoPauseProperties, self).__init__(**kwargs) self.delay_in_minutes = delay_in_minutes self.enabled = enabled -class AutoScaleProperties(Model): - """Spark pool auto-scaling properties. - - Auto-scaling properties of a Big Data pool powered by Apache Spark. +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. + :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. + :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. + :param max_node_count: The maximum number of nodes the Big Data pool can support. :type max_node_count: int """ @@ -58,56 +59,71 @@ class AutoScaleProperties(Model): 'max_node_count': {'key': 'maxNodeCount', 'type': 'int'}, } - def __init__(self, *, min_node_count: int=None, enabled: bool=None, max_node_count: int=None, **kwargs) -> None: + def __init__( + self, + *, + min_node_count: Optional[int] = None, + enabled: Optional[bool] = None, + max_node_count: Optional[int] = None, + **kwargs + ): super(AutoScaleProperties, self).__init__(**kwargs) self.min_node_count = min_node_count self.enabled = enabled self.max_node_count = max_node_count -class AvailableRpOperation(Model): +class AvailableRpOperation(msrest.serialization.Model): """An operation that is available in this resource provider. - :param display: Display properties of the operation + :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 + :param is_data_action: Whether this operation is a data action. :type is_data_action: str - :param name: Operation name + :param name: Operation name. :type name: str - :param service_specification: Operation service specification - :type service_specification: - ~azure.mgmt.synapse.models.OperationMetaServiceSpecification - :param origin: Operation origin + :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'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'OperationMetaServiceSpecification'}, 'origin': {'key': 'origin', 'type': 'str'}, + 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'OperationMetaServiceSpecification'}, } - def __init__(self, *, display=None, is_data_action: str=None, name: str=None, service_specification=None, origin: str=None, **kwargs) -> None: + def __init__( + self, + *, + display: Optional["AvailableRpOperationDisplayInfo"] = None, + is_data_action: Optional[str] = None, + name: Optional[str] = None, + origin: Optional[str] = None, + service_specification: Optional["OperationMetaServiceSpecification"] = None, + **kwargs + ): super(AvailableRpOperation, self).__init__(**kwargs) self.display = display self.is_data_action = is_data_action self.name = name - self.service_specification = service_specification self.origin = origin + self.service_specification = service_specification -class AvailableRpOperationDisplayInfo(Model): +class AvailableRpOperationDisplayInfo(msrest.serialization.Model): """Description of an available operation. - :param description: Operation description + :param description: Operation description. :type description: str - :param resource: Resource type + :param resource: Resource type. :type resource: str - :param provider: Resource provider name + :param provider: Resource provider name. :type provider: str - :param operation: Operation name + :param operation: Operation name. :type operation: str """ @@ -118,7 +134,15 @@ class AvailableRpOperationDisplayInfo(Model): 'operation': {'key': 'operation', 'type': 'str'}, } - def __init__(self, *, description: str=None, resource: str=None, provider: str=None, operation: str=None, **kwargs) -> None: + def __init__( + self, + *, + description: Optional[str] = None, + resource: Optional[str] = None, + provider: Optional[str] = None, + operation: Optional[str] = None, + **kwargs + ): super(AvailableRpOperationDisplayInfo, self).__init__(**kwargs) self.description = description self.resource = resource @@ -126,19 +150,18 @@ def __init__(self, *, description: str=None, resource: str=None, provider: str=N self.operation = operation -class Resource(Model): - """Resource. +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. + 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} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -154,7 +177,10 @@ class Resource(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -162,19 +188,17 @@ def __init__(self, **kwargs) -> None: class AzureEntityResource(Resource): - """The resource model definition for a Azure Resource Manager resource with an - etag. + """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. + 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} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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 @@ -194,17 +218,18 @@ class AzureEntityResource(Resource): 'etag': {'key': 'etag', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(AzureEntityResource, self).__init__(**kwargs) self.etag = None -class BigDataPoolPatchInfo(Model): - """Patch for a Big Data pool. +class BigDataPoolPatchInfo(msrest.serialization.Model): + """Properties patch for a Big Data pool. - Properties patch for a Big Data pool. - - :param tags: Updated tags for the Big Data pool + :param tags: A set of tags. Updated tags for the Big Data pool. :type tags: dict[str, str] """ @@ -212,30 +237,34 @@ class BigDataPoolPatchInfo(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, tags=None, **kwargs) -> None: + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(BigDataPoolPatchInfo, self).__init__(**kwargs) self.tags = tags class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level 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. + Variables are only 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} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives + :param location: Required. The geo-location where the resource lives. :type location: str """ @@ -254,58 +283,68 @@ class TrackedResource(Resource): 'location': {'key': 'location', 'type': 'str'}, } - def __init__(self, *, location: str, tags=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location class BigDataPoolResourceInfo(TrackedResource): - """Big Data pool. - - A Big Data pool. + """A Big Data pool. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives + :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 + :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 - :param auto_pause: Auto-pausing properties + :type creation_date: ~datetime.datetime + :param auto_pause: Auto-pausing properties. :type auto_pause: ~azure.mgmt.synapse.models.AutoPauseProperties - :param spark_events_folder: The Spark events folder + :param is_compute_isolation_enabled: Whether compute isolation is required or not. + :type is_compute_isolation_enabled: bool + :param have_library_requirements_changed: Whether library requirements changed. + :type have_library_requirements_changed: bool + :param session_level_packages_enabled: Whether session level packages enabled. + :type session_level_packages_enabled: bool + :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 + :param library_requirements: Library version requirements. :type library_requirements: ~azure.mgmt.synapse.models.LibraryRequirements + :param spark_config_properties: Spark configuration file to specify additional properties. + :type spark_config_properties: ~azure.mgmt.synapse.models.LibraryRequirements :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. + :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' + :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' + :param node_size_family: The kind of nodes that the Big Data pool provides. Possible values + include: "None", "MemoryOptimized". :type node_size_family: str or ~azure.mgmt.synapse.models.NodeSizeFamily """ @@ -314,7 +353,6 @@ class BigDataPoolResourceInfo(TrackedResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'node_count': {'maximum': 200, 'minimum': 3}, } _attribute_map = { @@ -327,38 +365,91 @@ class BigDataPoolResourceInfo(TrackedResource): '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'}, + 'have_library_requirements_changed': {'key': 'properties.haveLibraryRequirementsChanged', 'type': 'bool'}, + 'session_level_packages_enabled': {'key': 'properties.sessionLevelPackagesEnabled', 'type': 'bool'}, 'spark_events_folder': {'key': 'properties.sparkEventsFolder', 'type': 'str'}, 'node_count': {'key': 'properties.nodeCount', 'type': 'int'}, 'library_requirements': {'key': 'properties.libraryRequirements', 'type': 'LibraryRequirements'}, + 'spark_config_properties': {'key': 'properties.sparkConfigProperties', 'type': 'LibraryRequirements'}, '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'}, } - def __init__(self, *, location: str, tags=None, provisioning_state: str=None, auto_scale=None, creation_date=None, auto_pause=None, spark_events_folder: str=None, node_count: int=None, library_requirements=None, spark_version: str=None, default_spark_log_folder: str=None, node_size=None, node_size_family=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + provisioning_state: Optional[str] = None, + auto_scale: Optional["AutoScaleProperties"] = None, + creation_date: Optional[datetime.datetime] = None, + auto_pause: Optional["AutoPauseProperties"] = None, + is_compute_isolation_enabled: Optional[bool] = None, + have_library_requirements_changed: Optional[bool] = None, + session_level_packages_enabled: Optional[bool] = None, + spark_events_folder: Optional[str] = None, + node_count: Optional[int] = None, + library_requirements: Optional["LibraryRequirements"] = None, + spark_config_properties: Optional["LibraryRequirements"] = None, + spark_version: Optional[str] = None, + default_spark_log_folder: Optional[str] = None, + node_size: Optional[Union[str, "NodeSize"]] = None, + node_size_family: Optional[Union[str, "NodeSizeFamily"]] = None, + **kwargs + ): super(BigDataPoolResourceInfo, self).__init__(tags=tags, location=location, **kwargs) self.provisioning_state = provisioning_state self.auto_scale = auto_scale self.creation_date = creation_date self.auto_pause = auto_pause + self.is_compute_isolation_enabled = is_compute_isolation_enabled + self.have_library_requirements_changed = have_library_requirements_changed + self.session_level_packages_enabled = session_level_packages_enabled self.spark_events_folder = spark_events_folder self.node_count = node_count self.library_requirements = library_requirements + self.spark_config_properties = spark_config_properties self.spark_version = spark_version self.default_spark_log_folder = default_spark_log_folder self.node_size = node_size self.node_size_family = node_size_family -class CheckNameAvailabilityRequest(Model): - """Check name availability request. +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, + *, + next_link: Optional[str] = None, + value: Optional[List["BigDataPoolResourceInfo"]] = None, + **kwargs + ): + super(BigDataPoolResourceInfoListResult, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + - A request about whether a workspace name is available. +class CheckNameAvailabilityRequest(msrest.serialization.Model): + """A request about whether a workspace name is available. - :param name: Workspace name + :param name: Workspace name. :type name: str - :param type: Type: workspace + :param type: Type: workspace. :type type: str """ @@ -367,24 +458,28 @@ class CheckNameAvailabilityRequest(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, name: str=None, type: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + **kwargs + ): super(CheckNameAvailabilityRequest, self).__init__(**kwargs) self.name = name self.type = type -class CheckNameAvailabilityResponse(Model): - """Check name availability response. - - A response saying whether the workspace name is available. +class CheckNameAvailabilityResponse(msrest.serialization.Model): + """A response saying whether the workspace name is available. - :param message: Validation message + :param message: Validation message. :type message: str - :param available: Whether the workspace name is available + :param available: Whether the workspace name is available. :type available: bool - :param reason: Reason the workspace name is or is not available + :param reason: Reason the workspace name is or is not available. :type reason: str - :param name: Workspace name + :param name: Workspace name. :type name: str """ @@ -395,7 +490,15 @@ class CheckNameAvailabilityResponse(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, message: str=None, available: bool=None, reason: str=None, name: str=None, **kwargs) -> None: + def __init__( + self, + *, + message: Optional[str] = None, + available: Optional[bool] = None, + reason: Optional[str] = None, + name: Optional[str] = None, + **kwargs + ): super(CheckNameAvailabilityResponse, self).__init__(**kwargs) self.message = message self.available = available @@ -403,7 +506,7 @@ def __init__(self, *, message: str=None, available: bool=None, reason: str=None, self.name = name -class CloudError(Model): +class CloudError(msrest.serialization.Model): """The object that defines the structure of an Azure Synapse error response. All required parameters must be populated in order to send to Azure. @@ -430,7 +533,15 @@ class CloudError(Model): 'details': {'key': 'error.details', 'type': '[CloudError]'}, } - def __init__(self, *, code: str, message: str, target: str=None, details=None, **kwargs) -> None: + def __init__( + self, + *, + code: str, + message: str, + target: Optional[str] = None, + details: Optional[List["CloudError"]] = None, + **kwargs + ): super(CloudError, self).__init__(**kwargs) self.code = code self.message = message @@ -438,27 +549,58 @@ def __init__(self, *, code: str, message: str, target: str=None, details=None, * self.details = details -class CloudErrorException(HttpOperationError): - """Server responsed with exception of type: 'CloudError'. +class CloudErrorAutoGenerated(msrest.serialization.Model): + """The object that defines the structure of an Azure Synapse error response. + + All required parameters must be populated in order to send to Azure. - :param deserialize: A deserializer - :param response: Server response to be deserialized. + :param code: Required. Error code. + :type code: str + :param message: Required. Error message. + :type message: str + :param target: Property name/path in request associated with error. + :type target: str + :param details: Array with additional error details. + :type details: list[~azure.mgmt.synapse.models.CloudErrorAutoGenerated] """ - def __init__(self, deserialize, response, *args): + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + } - super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + _attribute_map = { + 'code': {'key': 'error.code', 'type': 'str'}, + 'message': {'key': 'error.message', 'type': 'str'}, + 'target': {'key': 'error.target', 'type': 'str'}, + 'details': {'key': 'error.details', 'type': '[CloudErrorAutoGenerated]'}, + } + + def __init__( + self, + *, + code: str, + message: str, + target: Optional[str] = None, + details: Optional[List["CloudErrorAutoGenerated"]] = None, + **kwargs + ): + super(CloudErrorAutoGenerated, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details -class CustomSetupBase(Model): +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, EnvironmentVariableSetup, ComponentSetup + sub-classes are: CmdkeySetup, ComponentSetup, EnvironmentVariableSetup. All required parameters must be populated in order to send to Azure. - :param type: Required. Constant filled by server. + :param type: Required. The type of custom setup.Constant filled by server. :type type: str """ @@ -471,12 +613,15 @@ class CustomSetupBase(Model): } _subtype_map = { - 'type': {'CmdkeySetup': 'CmdkeySetup', 'EnvironmentVariableSetup': 'EnvironmentVariableSetup', 'ComponentSetup': 'ComponentSetup'} + 'type': {'CmdkeySetup': 'CmdkeySetup', 'ComponentSetup': 'ComponentSetup', 'EnvironmentVariableSetup': 'EnvironmentVariableSetup'} } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(CustomSetupBase, self).__init__(**kwargs) - self.type = None + self.type = None # type: Optional[str] class CmdkeySetup(CustomSetupBase): @@ -484,7 +629,7 @@ class CmdkeySetup(CustomSetupBase): All required parameters must be populated in order to send to Azure. - :param type: Required. Constant filled by server. + :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: object @@ -508,12 +653,19 @@ class CmdkeySetup(CustomSetupBase): 'password': {'key': 'typeProperties.password', 'type': 'SecretBase'}, } - def __init__(self, *, target_name, user_name, password, **kwargs) -> None: + def __init__( + self, + *, + target_name: object, + user_name: object, + password: "SecretBase", + **kwargs + ): super(CmdkeySetup, self).__init__(**kwargs) + self.type = 'CmdkeySetup' # type: str self.target_name = target_name self.user_name = user_name self.password = password - self.type = 'CmdkeySetup' class ComponentSetup(CustomSetupBase): @@ -521,7 +673,7 @@ class ComponentSetup(CustomSetupBase): All required parameters must be populated in order to send to Azure. - :param type: Required. Constant filled by server. + :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 @@ -540,20 +692,25 @@ class ComponentSetup(CustomSetupBase): 'license_key': {'key': 'typeProperties.licenseKey', 'type': 'SecretBase'}, } - def __init__(self, *, component_name: str, license_key=None, **kwargs) -> None: + def __init__( + self, + *, + component_name: str, + license_key: Optional["SecretBase"] = None, + **kwargs + ): super(ComponentSetup, self).__init__(**kwargs) + self.type = 'ComponentSetup' # type: str self.component_name = component_name self.license_key = license_key - self.type = 'ComponentSetup' -class CreateSqlPoolRestorePointDefinition(Model): - """Contains the information necessary to perform a create Sql pool restore - point operation. +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 + :param restore_point_label: Required. The restore point label to apply. :type restore_point_label: str """ @@ -565,17 +722,53 @@ class CreateSqlPoolRestorePointDefinition(Model): 'restore_point_label': {'key': 'restorePointLabel', 'type': 'str'}, } - def __init__(self, *, restore_point_label: str, **kwargs) -> None: + def __init__( + self, + *, + restore_point_label: str, + **kwargs + ): super(CreateSqlPoolRestorePointDefinition, self).__init__(**kwargs) self.restore_point_label = restore_point_label -class DataLakeStorageAccountDetails(Model): +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 + """ + + _validation = { + 'status': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'WorkspaceKeyDetails'}, + } + + def __init__( + self, + *, + key: Optional["WorkspaceKeyDetails"] = None, + **kwargs + ): + super(CustomerManagedKeyDetails, self).__init__(**kwargs) + self.status = None + self.key = key + + +class DataLakeStorageAccountDetails(msrest.serialization.Model): """Details of the data lake storage account associated with the workspace. - :param account_url: Account URL + :param account_url: Account URL. :type account_url: str - :param filesystem: Filesystem name + :param filesystem: Filesystem name. :type filesystem: str """ @@ -584,58 +777,240 @@ class DataLakeStorageAccountDetails(Model): 'filesystem': {'key': 'filesystem', 'type': 'str'}, } - def __init__(self, *, account_url: str=None, filesystem: str=None, **kwargs) -> None: + def __init__( + self, + *, + account_url: Optional[str] = None, + filesystem: Optional[str] = None, + **kwargs + ): super(DataLakeStorageAccountDetails, self).__init__(**kwargs) self.account_url = account_url self.filesystem = filesystem -class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have - everything other than required location and tags. +class DataMaskingPolicy(Resource): + """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, + *, + data_masking_state: Optional[Union[str, "DataMaskingState"]] = None, + exempt_principals: Optional[str] = None, + **kwargs + ): + super(DataMaskingPolicy, self).__init__(**kwargs) + self.location = None + self.kind = None + self.managed_by = None + self.data_masking_state = data_masking_state + self.exempt_principals = exempt_principals + self.application_principals = None + self.masking_level = None + - Variables are only populated by the server, and will be ignored when - sending a request. +class DataMaskingRule(Resource): + """Represents a Sql pool data masking rule. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + 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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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, + *, + alias_name: Optional[str] = None, + rule_state: Optional[Union[str, "DataMaskingRuleState"]] = None, + schema_name: Optional[str] = None, + table_name: Optional[str] = None, + column_name: Optional[str] = None, + masking_function: Optional[Union[str, "DataMaskingFunction"]] = None, + number_from: Optional[str] = None, + number_to: Optional[str] = None, + prefix_size: Optional[str] = None, + suffix_size: Optional[str] = None, + replacement_string: Optional[str] = None, + **kwargs + ): + super(DataMaskingRule, self).__init__(**kwargs) + self.location = None + self.kind = None + self.id_properties_id = None + self.alias_name = alias_name + self.rule_state = rule_state + self.schema_name = schema_name + self.table_name = table_name + self.column_name = column_name + self.masking_function = masking_function + self.number_from = number_from + self.number_to = number_to + self.prefix_size = prefix_size + self.suffix_size = suffix_size + self.replacement_string = replacement_string + + +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) -> None: - super(ProxyResource, self).__init__(**kwargs) + def __init__( + self, + *, + value: Optional[List["DataMaskingRule"]] = None, + **kwargs + ): + super(DataMaskingRuleListResult, self).__init__(**kwargs) + self.value = value -class DataWarehouseUserActivities(ProxyResource): +class DataWarehouseUserActivities(Resource): """User activities of a data warehouse. - Variables are only populated by the server, and will be ignored when - sending a request. + 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} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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 @@ -655,18 +1030,51 @@ class DataWarehouseUserActivities(ProxyResource): 'active_queries_count': {'key': 'properties.activeQueriesCount', 'type': 'int'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DataWarehouseUserActivities, self).__init__(**kwargs) self.active_queries_count = None -class EntityReference(Model): +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, + *, + cmk: Optional["CustomerManagedKeyDetails"] = None, + **kwargs + ): + super(EncryptionDetails, self).__init__(**kwargs) + self.double_encryption_enabled = None + self.cmk = cmk + + +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 + "IntegrationRuntimeReference", "LinkedServiceReference". + :type type: str or ~azure.mgmt.synapse.models.IntegrationRuntimeEntityReferenceType :param reference_name: The name of this referenced entity. :type reference_name: str """ @@ -676,7 +1084,13 @@ class EntityReference(Model): 'reference_name': {'key': 'referenceName', 'type': 'str'}, } - def __init__(self, *, type=None, reference_name: str=None, **kwargs) -> None: + def __init__( + self, + *, + type: Optional[Union[str, "IntegrationRuntimeEntityReferenceType"]] = None, + reference_name: Optional[str] = None, + **kwargs + ): super(EntityReference, self).__init__(**kwargs) self.type = type self.reference_name = reference_name @@ -687,7 +1101,7 @@ class EnvironmentVariableSetup(CustomSetupBase): All required parameters must be populated in order to send to Azure. - :param type: Required. Constant filled by server. + :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 @@ -707,18 +1121,23 @@ class EnvironmentVariableSetup(CustomSetupBase): 'variable_value': {'key': 'typeProperties.variableValue', 'type': 'str'}, } - def __init__(self, *, variable_name: str, variable_value: str, **kwargs) -> None: + def __init__( + self, + *, + variable_name: str, + variable_value: str, + **kwargs + ): super(EnvironmentVariableSetup, self).__init__(**kwargs) + self.type = 'EnvironmentVariableSetup' # type: str self.variable_name = variable_name self.variable_value = variable_value - self.type = 'EnvironmentVariableSetup' -class ErrorAdditionalInfo(Model): +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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar type: The additional info type. :vartype type: str @@ -736,16 +1155,17 @@ class ErrorAdditionalInfo(Model): 'info': {'key': 'info', 'type': 'object'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None -class ErrorContract(Model): - """Error details. - - Contains details when the response code indicates an error. +class ErrorContract(msrest.serialization.Model): + """Contains details when the response code indicates an error. :param error: The error details. :type error: ~azure.mgmt.synapse.models.ErrorResponse @@ -755,31 +1175,24 @@ class ErrorContract(Model): 'error': {'key': 'error', 'type': 'ErrorResponse'}, } - def __init__(self, *, error=None, **kwargs) -> None: + def __init__( + self, + *, + error: Optional["ErrorResponse"] = None, + **kwargs + ): super(ErrorContract, self).__init__(**kwargs) self.error = error -class ErrorContractException(HttpOperationError): - """Server responsed with exception of type: 'ErrorContract'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(ErrorContractException, self).__init__(deserialize, response, 'ErrorContract', *args) - - -class ErrorDetail(Model): +class ErrorDetail(msrest.serialization.Model): """Error details. - :param message: Error message + :param message: Error message. :type message: str - :param code: Error code + :param code: Error code. :type code: str - :param target: Error target + :param target: Error target. :type target: str """ @@ -789,18 +1202,24 @@ class ErrorDetail(Model): 'target': {'key': 'target', 'type': 'str'}, } - def __init__(self, *, message: str=None, code: str=None, target: str=None, **kwargs) -> None: + def __init__( + self, + *, + message: Optional[str] = None, + code: Optional[str] = None, + target: Optional[str] = None, + **kwargs + ): super(ErrorDetail, self).__init__(**kwargs) self.message = message self.code = code self.target = target -class ErrorResponse(Model): - """The resource management error response. +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.). - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar code: The error code. :vartype code: str @@ -811,8 +1230,7 @@ class ErrorResponse(Model): :ivar details: The error details. :vartype details: list[~azure.mgmt.synapse.models.ErrorResponse] :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.synapse.models.ErrorAdditionalInfo] + :vartype additional_info: list[~azure.mgmt.synapse.models.ErrorAdditionalInfo] """ _validation = { @@ -831,7 +1249,10 @@ class ErrorResponse(Model): 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(ErrorResponse, self).__init__(**kwargs) self.code = None self.message = None @@ -840,163 +1261,637 @@ def __init__(self, **kwargs) -> None: self.additional_info = None -class GeoBackupPolicy(ProxyResource): - """A database geo backup policy. - - Variables are only populated by the server, and will be ignored when - sending a request. +class ExtendedServerBlobAuditingPolicy(Resource): + """An extended server blob auditing policy. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: 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 - :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 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}, - 'state': {'required': True}, - 'storage_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'}, - 'state': {'key': 'properties.state', 'type': 'GeoBackupPolicyState'}, - 'storage_type': {'key': 'properties.storageType', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__(self, *, state, **kwargs) -> None: - super(GeoBackupPolicy, self).__init__(**kwargs) + '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, + *, + predicate_expression: Optional[str] = None, + state: Optional[Union[str, "BlobAuditingPolicyState"]] = None, + storage_endpoint: Optional[str] = None, + storage_account_access_key: Optional[str] = None, + retention_days: Optional[int] = None, + audit_actions_and_groups: Optional[List[str]] = None, + storage_account_subscription_id: Optional[str] = None, + is_storage_secondary_key_in_use: Optional[bool] = None, + is_azure_monitor_target_enabled: Optional[bool] = None, + queue_delay_ms: Optional[int] = None, + **kwargs + ): + super(ExtendedServerBlobAuditingPolicy, self).__init__(**kwargs) + self.predicate_expression = predicate_expression self.state = state - self.storage_type = None - self.kind = None - self.location = None - - -class GetSsisObjectMetadataRequest(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, *, metadata_path: str=None, **kwargs) -> None: - super(GetSsisObjectMetadataRequest, self).__init__(**kwargs) - self.metadata_path = metadata_path - + self.storage_endpoint = storage_endpoint + self.storage_account_access_key = storage_account_access_key + self.retention_days = retention_days + self.audit_actions_and_groups = audit_actions_and_groups + self.storage_account_subscription_id = storage_account_subscription_id + self.is_storage_secondary_key_in_use = is_storage_secondary_key_in_use + self.is_azure_monitor_target_enabled = is_azure_monitor_target_enabled + self.queue_delay_ms = queue_delay_ms -class IntegrationRuntime(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 +class ExtendedServerBlobAuditingPolicyListResult(msrest.serialization.Model): + """A list of server extended auditing settings. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param additional_properties: Unmatched properties from the message are - deserialized this collection - :type additional_properties: dict[str, object] - :param description: Integration runtime description. - :type description: str - :param type: Required. Constant filled by server. - :type type: str + :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 = { - 'type': {'required': True}, + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'description': {'key': 'description', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'Managed': 'ManagedIntegrationRuntime', 'SelfHosted': 'SelfHostedIntegrationRuntime'} + 'value': {'key': 'value', 'type': '[ExtendedServerBlobAuditingPolicy]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, additional_properties=None, description: str=None, **kwargs) -> None: - super(IntegrationRuntime, self).__init__(**kwargs) - self.additional_properties = additional_properties - self.description = description - self.type = None - - -class IntegrationRuntimeAuthKeys(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 - """ + def __init__( + self, + **kwargs + ): + super(ExtendedServerBlobAuditingPolicyListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None - _attribute_map = { - 'auth_key1': {'key': 'authKey1', 'type': 'str'}, - 'auth_key2': {'key': 'authKey2', 'type': 'str'}, - } - def __init__(self, *, auth_key1: str=None, auth_key2: str=None, **kwargs) -> None: - super(IntegrationRuntimeAuthKeys, self).__init__(**kwargs) - self.auth_key1 = auth_key1 - self.auth_key2 = auth_key2 +class ExtendedSqlPoolBlobAuditingPolicy(Resource): + """An extended Sql pool blob auditing policy. + Variables are only populated by the server, and will be ignored when sending a request. -class IntegrationRuntimeComputeProperties(Model): + :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, + *, + predicate_expression: Optional[str] = None, + state: Optional[Union[str, "BlobAuditingPolicyState"]] = None, + storage_endpoint: Optional[str] = None, + storage_account_access_key: Optional[str] = None, + retention_days: Optional[int] = None, + audit_actions_and_groups: Optional[List[str]] = None, + storage_account_subscription_id: Optional[str] = None, + is_storage_secondary_key_in_use: Optional[bool] = None, + is_azure_monitor_target_enabled: Optional[bool] = None, + queue_delay_ms: Optional[int] = None, + **kwargs + ): + super(ExtendedSqlPoolBlobAuditingPolicy, self).__init__(**kwargs) + self.predicate_expression = predicate_expression + self.state = state + self.storage_endpoint = storage_endpoint + self.storage_account_access_key = storage_account_access_key + self.retention_days = retention_days + self.audit_actions_and_groups = audit_actions_and_groups + self.storage_account_subscription_id = storage_account_subscription_id + self.is_storage_secondary_key_in_use = is_storage_secondary_key_in_use + self.is_azure_monitor_target_enabled = is_azure_monitor_target_enabled + self.queue_delay_ms = queue_delay_ms + + +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 GeoBackupPolicy(Resource): + """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, + *, + state: Union[str, "GeoBackupPolicyState"], + **kwargs + ): + super(GeoBackupPolicy, self).__init__(**kwargs) + self.kind = None + self.location = None + self.state = 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, + *, + value: Optional[List["GeoBackupPolicy"]] = None, + **kwargs + ): + super(GeoBackupPolicyListResult, self).__init__(**kwargs) + self.value = value + + +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, + *, + metadata_path: Optional[str] = None, + **kwargs + ): + super(GetSsisObjectMetadataRequest, self).__init__(**kwargs) + self.metadata_path = metadata_path + + +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, object] + :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, + *, + additional_properties: Optional[Dict[str, object]] = None, + description: Optional[str] = None, + **kwargs + ): + super(IntegrationRuntime, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.type = 'IntegrationRuntime' # type: str + self.description = description + + +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, + *, + auth_key1: Optional[str] = None, + auth_key2: Optional[str] = None, + **kwargs + ): + super(IntegrationRuntimeAuthKeys, self).__init__(**kwargs) + self.auth_key1 = auth_key1 + self.auth_key2 = auth_key2 + + +class IntegrationRuntimeComputeProperties(msrest.serialization.Model): """The compute resource properties for managed integration runtime. - :param additional_properties: Unmatched properties from the message are - deserialized this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] - :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 + :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. + :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. + :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. + :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 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 + :type v_net_properties: ~azure.mgmt.synapse.models.IntegrationRuntimeVNetProperties """ _validation = { @@ -1014,7 +1909,18 @@ class IntegrationRuntimeComputeProperties(Model): 'v_net_properties': {'key': 'vNetProperties', 'type': 'IntegrationRuntimeVNetProperties'}, } - def __init__(self, *, additional_properties=None, location: str=None, node_size: str=None, number_of_nodes: int=None, max_parallel_executions_per_node: int=None, data_flow_properties=None, v_net_properties=None, **kwargs) -> None: + def __init__( + self, + *, + additional_properties: Optional[Dict[str, object]] = None, + location: Optional[str] = None, + node_size: Optional[str] = None, + number_of_nodes: Optional[int] = None, + max_parallel_executions_per_node: Optional[int] = None, + data_flow_properties: Optional["IntegrationRuntimeDataFlowProperties"] = None, + v_net_properties: Optional["IntegrationRuntimeVNetProperties"] = None, + **kwargs + ): super(IntegrationRuntimeComputeProperties, self).__init__(**kwargs) self.additional_properties = additional_properties self.location = location @@ -1025,31 +1931,28 @@ def __init__(self, *, additional_properties=None, location: str=None, node_size: self.v_net_properties = v_net_properties -class IntegrationRuntimeConnectionInfo(Model): - """Connection information for encrypting the on-premises data source - credentials. +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. + 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 this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] - :ivar service_token: The token generated in service. Callers use this - token to authenticate to integration runtime. + :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. + :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. + :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. + :ivar is_identity_cert_exprired: Whether the identity certificate is expired. :vartype is_identity_cert_exprired: bool """ @@ -1072,7 +1975,12 @@ class IntegrationRuntimeConnectionInfo(Model): 'is_identity_cert_exprired': {'key': 'isIdentityCertExprired', 'type': 'bool'}, } - def __init__(self, *, additional_properties=None, **kwargs) -> None: + def __init__( + self, + *, + additional_properties: Optional[Dict[str, object]] = None, + **kwargs + ): super(IntegrationRuntimeConnectionInfo, self).__init__(**kwargs) self.additional_properties = additional_properties self.service_token = None @@ -1083,11 +1991,11 @@ def __init__(self, *, additional_properties=None, **kwargs) -> None: self.is_identity_cert_exprired = None -class IntegrationRuntimeCustomSetupScriptProperties(Model): +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. + :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 @@ -1098,27 +2006,32 @@ class IntegrationRuntimeCustomSetupScriptProperties(Model): 'sas_token': {'key': 'sasToken', 'type': 'SecureString'}, } - def __init__(self, *, blob_container_uri: str=None, sas_token=None, **kwargs) -> None: + def __init__( + self, + *, + blob_container_uri: Optional[str] = None, + sas_token: Optional["SecureString"] = None, + **kwargs + ): super(IntegrationRuntimeCustomSetupScriptProperties, self).__init__(**kwargs) self.blob_container_uri = blob_container_uri self.sas_token = sas_token -class IntegrationRuntimeDataFlowProperties(Model): +class IntegrationRuntimeDataFlowProperties(msrest.serialization.Model): """Data flow properties for managed integration runtime. - :param additional_properties: Unmatched properties from the message are - deserialized this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] - :param compute_type: Compute type of the cluster which will execute data - flow job. Possible values include: 'General', 'MemoryOptimized', - 'ComputeOptimized' + :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. + :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. + :param time_to_live: Time to live (in minutes) setting of the cluster which will execute data + flow job. :type time_to_live: int """ @@ -1133,7 +2046,15 @@ class IntegrationRuntimeDataFlowProperties(Model): 'time_to_live': {'key': 'timeToLive', 'type': 'int'}, } - def __init__(self, *, additional_properties=None, compute_type=None, core_count: int=None, time_to_live: int=None, **kwargs) -> None: + def __init__( + self, + *, + additional_properties: Optional[Dict[str, object]] = None, + compute_type: Optional[Union[str, "DataFlowComputeType"]] = None, + core_count: Optional[int] = None, + time_to_live: Optional[int] = None, + **kwargs + ): super(IntegrationRuntimeDataFlowProperties, self).__init__(**kwargs) self.additional_properties = additional_properties self.compute_type = compute_type @@ -1141,7 +2062,7 @@ def __init__(self, *, additional_properties=None, compute_type=None, core_count: self.time_to_live = time_to_live -class IntegrationRuntimeDataProxyProperties(Model): +class IntegrationRuntimeDataProxyProperties(msrest.serialization.Model): """Data proxy properties for a managed dedicated integration runtime. :param connect_via: The self-hosted integration runtime reference. @@ -1158,21 +2079,59 @@ class IntegrationRuntimeDataProxyProperties(Model): 'path': {'key': 'path', 'type': 'str'}, } - def __init__(self, *, connect_via=None, staging_linked_service=None, path: str=None, **kwargs) -> None: + def __init__( + self, + *, + connect_via: Optional["EntityReference"] = None, + staging_linked_service: Optional["EntityReference"] = None, + path: Optional[str] = None, + **kwargs + ): super(IntegrationRuntimeDataProxyProperties, self).__init__(**kwargs) self.connect_via = connect_via self.staging_linked_service = staging_linked_service self.path = path -class IntegrationRuntimeMonitoringData(Model): +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, + *, + value: List["IntegrationRuntimeResource"], + next_link: Optional[str] = None, + **kwargs + ): + super(IntegrationRuntimeListResponse, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +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] + :type nodes: list[~azure.mgmt.synapse.models.IntegrationRuntimeNodeMonitoringData] """ _attribute_map = { @@ -1180,17 +2139,22 @@ class IntegrationRuntimeMonitoringData(Model): 'nodes': {'key': 'nodes', 'type': '[IntegrationRuntimeNodeMonitoringData]'}, } - def __init__(self, *, name: str=None, nodes=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + nodes: Optional[List["IntegrationRuntimeNodeMonitoringData"]] = None, + **kwargs + ): super(IntegrationRuntimeMonitoringData, self).__init__(**kwargs) self.name = name self.nodes = nodes -class IntegrationRuntimeNodeIpAddress(Model): +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. + 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 @@ -1204,35 +2168,34 @@ class IntegrationRuntimeNodeIpAddress(Model): 'ip_address': {'key': 'ipAddress', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(IntegrationRuntimeNodeIpAddress, self).__init__(**kwargs) self.ip_address = None -class IntegrationRuntimeNodeMonitoringData(Model): +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. + 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 this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] :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. + :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. + :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. + :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. + :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 @@ -1263,7 +2226,12 @@ class IntegrationRuntimeNodeMonitoringData(Model): 'received_bytes': {'key': 'receivedBytes', 'type': 'float'}, } - def __init__(self, *, additional_properties=None, **kwargs) -> None: + def __init__( + self, + *, + additional_properties: Optional[Dict[str, object]] = None, + **kwargs + ): super(IntegrationRuntimeNodeMonitoringData, self).__init__(**kwargs) self.additional_properties = additional_properties self.node_name = None @@ -1276,38 +2244,47 @@ def __init__(self, *, additional_properties=None, **kwargs) -> None: self.received_bytes = None -class IntegrationRuntimeRegenerateKeyParameters(Model): +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 + :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, *, key_name=None, **kwargs) -> None: + def __init__( + self, + *, + key_name: Optional[Union[str, "IntegrationRuntimeAuthKeyName"]] = None, + **kwargs + ): super(IntegrationRuntimeRegenerateKeyParameters, self).__init__(**kwargs) self.key_name = key_name -class SubResource(Model): - """Azure Synapse nested resource, which belongs to a factory. +class IntegrationRuntimeResource(AzureEntityResource): + """Integration runtime resource type. + + Variables are only populated by the server, and will be ignored when sending a request. - Variables are only populated by the server, and will be ignored when - sending a request. + All required parameters must be populated in order to send to Azure. - :ivar id: The resource identifier. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: The resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar etag: Etag identifies change in the resource. + :ivar etag: Resource Etag. :vartype etag: str + :param properties: Required. Integration runtime properties. + :type properties: ~azure.mgmt.synapse.models.IntegrationRuntime """ _validation = { @@ -1315,6 +2292,7 @@ class SubResource(Model): 'name': {'readonly': True}, 'type': {'readonly': True}, 'etag': {'readonly': True}, + 'properties': {'required': True}, } _attribute_map = { @@ -1322,75 +2300,35 @@ class SubResource(Model): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'IntegrationRuntime'}, } - def __init__(self, **kwargs) -> None: - super(SubResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.etag = None - - -class IntegrationRuntimeResource(SubResource): - """Integration runtime resource type. + def __init__( + self, + *, + properties: "IntegrationRuntime", + **kwargs + ): + super(IntegrationRuntimeResource, self).__init__(**kwargs) + self.properties = properties - Variables are only populated by the server, and will be ignored when - sending a request. - All required parameters must be populated in order to send to Azure. +class IntegrationRuntimeSsisCatalogInfo(msrest.serialization.Model): + """Catalog information for managed dedicated integration runtime. - :ivar id: The resource identifier. - :vartype id: str - :ivar name: The resource name. - :vartype name: str - :ivar type: The resource type. - :vartype type: str - :ivar etag: Etag identifies change in the resource. - :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, *, properties, **kwargs) -> None: - super(IntegrationRuntimeResource, self).__init__(**kwargs) - self.properties = properties - - -class IntegrationRuntimeSsisCatalogInfo(Model): - """Catalog information for managed dedicated integration runtime. - - :param additional_properties: Unmatched properties from the message are - deserialized this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] :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. + :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. + :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' + :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 """ @@ -1407,7 +2345,16 @@ class IntegrationRuntimeSsisCatalogInfo(Model): 'catalog_pricing_tier': {'key': 'catalogPricingTier', 'type': 'str'}, } - def __init__(self, *, additional_properties=None, catalog_server_endpoint: str=None, catalog_admin_user_name: str=None, catalog_admin_password=None, catalog_pricing_tier=None, **kwargs) -> None: + def __init__( + self, + *, + additional_properties: Optional[Dict[str, object]] = None, + catalog_server_endpoint: Optional[str] = None, + catalog_admin_user_name: Optional[str] = None, + catalog_admin_password: Optional["SecureString"] = None, + catalog_pricing_tier: Optional[Union[str, "IntegrationRuntimeSsisCatalogPricingTier"]] = None, + **kwargs + ): super(IntegrationRuntimeSsisCatalogInfo, self).__init__(**kwargs) self.additional_properties = additional_properties self.catalog_server_endpoint = catalog_server_endpoint @@ -1416,35 +2363,30 @@ def __init__(self, *, additional_properties=None, catalog_server_endpoint: str=N self.catalog_pricing_tier = catalog_pricing_tier -class IntegrationRuntimeSsisProperties(Model): +class IntegrationRuntimeSsisProperties(msrest.serialization.Model): """SSIS properties for managed integration runtime. - :param additional_properties: Unmatched properties from the message are - deserialized this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] - :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. + :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' + :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] + :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 = { @@ -1457,7 +2399,18 @@ class IntegrationRuntimeSsisProperties(Model): 'express_custom_setup_properties': {'key': 'expressCustomSetupProperties', 'type': '[CustomSetupBase]'}, } - def __init__(self, *, additional_properties=None, catalog_info=None, license_type=None, custom_setup_script_properties=None, data_proxy_properties=None, edition=None, express_custom_setup_properties=None, **kwargs) -> None: + def __init__( + self, + *, + additional_properties: Optional[Dict[str, object]] = None, + catalog_info: Optional["IntegrationRuntimeSsisCatalogInfo"] = None, + license_type: Optional[Union[str, "IntegrationRuntimeLicenseType"]] = None, + custom_setup_script_properties: Optional["IntegrationRuntimeCustomSetupScriptProperties"] = None, + data_proxy_properties: Optional["IntegrationRuntimeDataProxyProperties"] = None, + edition: Optional[Union[str, "IntegrationRuntimeEdition"]] = None, + express_custom_setup_properties: Optional[List["CustomSetupBase"]] = None, + **kwargs + ): super(IntegrationRuntimeSsisProperties, self).__init__(**kwargs) self.additional_properties = additional_properties self.catalog_info = catalog_info @@ -1468,62 +2421,64 @@ def __init__(self, *, additional_properties=None, catalog_info=None, license_typ self.express_custom_setup_properties = express_custom_setup_properties -class IntegrationRuntimeStatus(Model): +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 + sub-classes are: ManagedIntegrationRuntimeStatus, SelfHostedIntegrationRuntimeStatus. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :param additional_properties: Unmatched properties from the message are - deserialized this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] - :ivar data_factory_name: The workspace name which the integration runtime - belong to. + :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' + :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 - :param type: Required. Constant filled by server. - :type type: str """ _validation = { + 'type': {'required': True}, 'data_factory_name': {'readonly': True}, 'state': {'readonly': True}, - 'type': {'required': 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'}, - 'type': {'key': 'type', 'type': 'str'}, } _subtype_map = { 'type': {'Managed': 'ManagedIntegrationRuntimeStatus', 'SelfHosted': 'SelfHostedIntegrationRuntimeStatus'} } - def __init__(self, *, additional_properties=None, **kwargs) -> None: + def __init__( + self, + *, + additional_properties: Optional[Dict[str, object]] = None, + **kwargs + ): super(IntegrationRuntimeStatus, self).__init__(**kwargs) self.additional_properties = additional_properties + self.type = 'IntegrationRuntimeStatus' # type: str self.data_factory_name = None self.state = None - self.type = None -class IntegrationRuntimeStatusResponse(Model): +class IntegrationRuntimeStatusResponse(msrest.serialization.Model): """Integration runtime status response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -1543,66 +2498,75 @@ class IntegrationRuntimeStatusResponse(Model): 'properties': {'key': 'properties', 'type': 'IntegrationRuntimeStatus'}, } - def __init__(self, *, properties, **kwargs) -> None: + def __init__( + self, + *, + properties: "IntegrationRuntimeStatus", + **kwargs + ): super(IntegrationRuntimeStatusResponse, self).__init__(**kwargs) self.name = None self.properties = properties -class IntegrationRuntimeVNetProperties(Model): +class IntegrationRuntimeVNetProperties(msrest.serialization.Model): """VNet properties for managed integration runtime. - :param additional_properties: Unmatched properties from the message are - deserialized this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] - :param v_net_id: The ID of the VNet that this integration runtime will - join. + :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_ips: Resource IDs of the public IP addresses that this - integration runtime will use. - :type public_ips: list[str] + :param public_i_ps: Resource IDs of the public IP addresses that this integration runtime will + use. + :type public_i_ps: list[str] """ _attribute_map = { 'additional_properties': {'key': '', 'type': '{object}'}, 'v_net_id': {'key': 'vNetId', 'type': 'str'}, 'subnet': {'key': 'subnet', 'type': 'str'}, - 'public_ips': {'key': 'publicIPs', 'type': '[str]'}, - } - - def __init__(self, *, additional_properties=None, v_net_id: str=None, subnet: str=None, public_ips=None, **kwargs) -> None: + 'public_i_ps': {'key': 'publicIPs', 'type': '[str]'}, + } + + def __init__( + self, + *, + additional_properties: Optional[Dict[str, object]] = None, + v_net_id: Optional[str] = None, + subnet: Optional[str] = None, + public_i_ps: Optional[List[str]] = None, + **kwargs + ): super(IntegrationRuntimeVNetProperties, self).__init__(**kwargs) self.additional_properties = additional_properties self.v_net_id = v_net_id self.subnet = subnet - self.public_ips = public_ips + self.public_i_ps = public_i_ps -class IpFirewallRuleInfo(ProxyResource): +class IpFirewallRuleInfo(Resource): """IP firewall rule. - Variables are only populated by the server, and will be ignored when - sending a request. + 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} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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 + :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 + :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 """ @@ -1622,28 +2586,57 @@ class IpFirewallRuleInfo(ProxyResource): 'start_ip_address': {'key': 'properties.startIpAddress', 'type': 'str'}, } - def __init__(self, *, end_ip_address: str=None, start_ip_address: str=None, **kwargs) -> None: + def __init__( + self, + *, + end_ip_address: Optional[str] = None, + start_ip_address: Optional[str] = None, + **kwargs + ): super(IpFirewallRuleInfo, self).__init__(**kwargs) self.end_ip_address = end_ip_address self.provisioning_state = None self.start_ip_address = start_ip_address -class IpFirewallRuleProperties(Model): +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, + *, + next_link: Optional[str] = None, + value: Optional[List["IpFirewallRuleInfo"]] = None, + **kwargs + ): + super(IpFirewallRuleInfoListResult, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class IpFirewallRuleProperties(msrest.serialization.Model): """IP firewall rule properties. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param end_ip_address: The end IP address of the firewall rule. Must be - IPv4 format. Must be greater than or equal to startIpAddress + :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 + :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 """ @@ -1657,23 +2650,97 @@ class IpFirewallRuleProperties(Model): 'start_ip_address': {'key': 'startIpAddress', 'type': 'str'}, } - def __init__(self, *, end_ip_address: str=None, start_ip_address: str=None, **kwargs) -> None: + def __init__( + self, + *, + end_ip_address: Optional[str] = None, + start_ip_address: Optional[str] = None, + **kwargs + ): super(IpFirewallRuleProperties, self).__init__(**kwargs) self.end_ip_address = end_ip_address self.provisioning_state = None self.start_ip_address = start_ip_address -class LibraryRequirements(Model): - """Spark pool library version requirements. +class Key(Resource): + """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, + *, + is_active_cmk: Optional[bool] = None, + key_vault_url: Optional[str] = None, + **kwargs + ): + super(Key, self).__init__(**kwargs) + self.is_active_cmk = is_active_cmk + self.key_vault_url = key_vault_url + + +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, + *, + next_link: Optional[str] = None, + value: Optional[List["Key"]] = None, + **kwargs + ): + super(KeyInfoListResult, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + - Library requirements for a Big Data pool powered by Apache Spark. +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. + 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 + :vartype time: ~datetime.datetime :param content: The library requirements. :type content: str :param filename: The filename of the library requirements file. @@ -1690,32 +2757,36 @@ class LibraryRequirements(Model): 'filename': {'key': 'filename', 'type': 'str'}, } - def __init__(self, *, content: str=None, filename: str=None, **kwargs) -> None: + def __init__( + self, + *, + content: Optional[str] = None, + filename: Optional[str] = None, + **kwargs + ): super(LibraryRequirements, self).__init__(**kwargs) self.time = None self.content = content self.filename = filename -class LinkedIntegrationRuntime(Model): +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. + 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. + :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. + :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. + :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 + :vartype create_time: ~datetime.datetime """ _validation = { @@ -1734,7 +2805,10 @@ class LinkedIntegrationRuntime(Model): 'create_time': {'key': 'createTime', 'type': 'iso-8601'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(LinkedIntegrationRuntime, self).__init__(**kwargs) self.name = None self.subscription_id = None @@ -1743,16 +2817,16 @@ def __init__(self, **kwargs) -> None: self.create_time = None -class LinkedIntegrationRuntimeType(Model): +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 + sub-classes are: LinkedIntegrationRuntimeKeyAuthorization, LinkedIntegrationRuntimeRbacAuthorization. All required parameters must be populated in order to send to Azure. - :param authorization_type: Required. Constant filled by server. + :param authorization_type: Required. The authorization type for integration runtime + sharing.Constant filled by server. :type authorization_type: str """ @@ -1768,9 +2842,12 @@ class LinkedIntegrationRuntimeType(Model): 'authorization_type': {'Key': 'LinkedIntegrationRuntimeKeyAuthorization', 'RBAC': 'LinkedIntegrationRuntimeRbacAuthorization'} } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(LinkedIntegrationRuntimeType, self).__init__(**kwargs) - self.authorization_type = None + self.authorization_type = None # type: Optional[str] class LinkedIntegrationRuntimeKeyAuthorization(LinkedIntegrationRuntimeType): @@ -1778,7 +2855,8 @@ class LinkedIntegrationRuntimeKeyAuthorization(LinkedIntegrationRuntimeType): All required parameters must be populated in order to send to Azure. - :param authorization_type: Required. Constant filled by server. + :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 @@ -1794,22 +2872,26 @@ class LinkedIntegrationRuntimeKeyAuthorization(LinkedIntegrationRuntimeType): 'key': {'key': 'key', 'type': 'SecureString'}, } - def __init__(self, *, key, **kwargs) -> None: + def __init__( + self, + *, + key: "SecureString", + **kwargs + ): super(LinkedIntegrationRuntimeKeyAuthorization, self).__init__(**kwargs) + self.authorization_type = 'Key' # type: str self.key = key - self.authorization_type = 'Key' class LinkedIntegrationRuntimeRbacAuthorization(LinkedIntegrationRuntimeType): - """The role based access control (RBAC) authorization type integration - runtime. + """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. Constant filled by server. + :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. + :param resource_id: Required. The resource identifier of the integration runtime to be shared. :type resource_id: str """ @@ -1823,24 +2905,58 @@ class LinkedIntegrationRuntimeRbacAuthorization(LinkedIntegrationRuntimeType): 'resource_id': {'key': 'resourceId', 'type': 'str'}, } - def __init__(self, *, resource_id: str, **kwargs) -> None: + def __init__( + self, + *, + resource_id: str, + **kwargs + ): super(LinkedIntegrationRuntimeRbacAuthorization, self).__init__(**kwargs) + self.authorization_type = 'RBAC' # type: str self.resource_id = resource_id - self.authorization_type = 'RBAC' -class ManagedIdentity(Model): +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 ManagedIdentity(msrest.serialization.Model): """The workspace managed identity. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar principal_id: The principal ID of the workspace managed identity + :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 + :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' + :param type: The type of managed identity for the workspace. Possible values include: "None", + "SystemAssigned". :type type: str or ~azure.mgmt.synapse.models.ResourceIdentityType """ @@ -1852,34 +2968,35 @@ class ManagedIdentity(Model): _attribute_map = { 'principal_id': {'key': 'principalId', 'type': 'str'}, 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'ResourceIdentityType'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, type=None, **kwargs) -> None: + def __init__( + self, + *, + type: Optional[Union[str, "ResourceIdentityType"]] = None, + **kwargs + ): super(ManagedIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type -class ManagedIdentitySqlControlSettingsModel(ProxyResource): - """Managed Identity Sql Control Settings. +class ManagedIdentitySqlControlSettingsModel(Resource): + """Sql Control Settings for workspace managed identity. - Sql Control Settings for workspace managed identity. + Variables are only populated by the server, and will be ignored when sending a request. - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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 + :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 """ @@ -1897,23 +3014,28 @@ class ManagedIdentitySqlControlSettingsModel(ProxyResource): 'grant_sql_control_to_managed_identity': {'key': 'properties.grantSqlControlToManagedIdentity', 'type': 'ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity'}, } - def __init__(self, *, grant_sql_control_to_managed_identity=None, **kwargs) -> None: + def __init__( + self, + *, + grant_sql_control_to_managed_identity: Optional["ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity"] = None, + **kwargs + ): super(ManagedIdentitySqlControlSettingsModel, self).__init__(**kwargs) self.grant_sql_control_to_managed_identity = grant_sql_control_to_managed_identity -class ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity(Model): +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. + 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.enum - :ivar actual_state: Actual state. Possible values include: 'Enabling', - 'Enabled', 'Disabling', 'Disabled', 'Unknown' - :vartype actual_state: str or ~azure.mgmt.synapse.models.enum + :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 = { @@ -1925,40 +3047,40 @@ class ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedId 'actual_state': {'key': 'actualState', 'type': 'str'}, } - def __init__(self, *, desired_state=None, **kwargs) -> None: + def __init__( + self, + *, + desired_state: Optional[Union[str, "ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentityDesiredState"]] = None, + **kwargs + ): super(ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentity, self).__init__(**kwargs) self.desired_state = desired_state self.actual_state = None class ManagedIntegrationRuntime(IntegrationRuntime): - """Managed integration runtime, including managed elastic and managed - dedicated integration runtimes. + """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. + Variables are only populated 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 this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] + :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 type: Required. Constant filled by server. - :type type: 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' + :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 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 + :type ssis_properties: ~azure.mgmt.synapse.models.IntegrationRuntimeSsisProperties """ _validation = { @@ -1968,32 +3090,39 @@ class ManagedIntegrationRuntime(IntegrationRuntime): _attribute_map = { 'additional_properties': {'key': '', 'type': '{object}'}, - 'description': {'key': 'description', 'type': 'str'}, '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, *, additional_properties=None, description: str=None, compute_properties=None, ssis_properties=None, **kwargs) -> None: + def __init__( + self, + *, + additional_properties: Optional[Dict[str, object]] = None, + description: Optional[str] = None, + compute_properties: Optional["IntegrationRuntimeComputeProperties"] = None, + ssis_properties: Optional["IntegrationRuntimeSsisProperties"] = None, + **kwargs + ): super(ManagedIntegrationRuntime, self).__init__(additional_properties=additional_properties, description=description, **kwargs) + self.type = 'Managed' # type: str self.state = None self.compute_properties = compute_properties self.ssis_properties = ssis_properties - self.type = 'Managed' -class ManagedIntegrationRuntimeError(Model): +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. + 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 this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] :ivar time: The time when the error occurred. - :vartype time: datetime + :vartype time: ~datetime.datetime :ivar code: Error code. :vartype code: str :ivar parameters: Managed integration runtime error parameters. @@ -2017,7 +3146,12 @@ class ManagedIntegrationRuntimeError(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, additional_properties=None, **kwargs) -> None: + def __init__( + self, + *, + additional_properties: Optional[Dict[str, object]] = None, + **kwargs + ): super(ManagedIntegrationRuntimeError, self).__init__(**kwargs) self.additional_properties = additional_properties self.time = None @@ -2026,24 +3160,21 @@ def __init__(self, *, additional_properties=None, **kwargs) -> None: self.message = None -class ManagedIntegrationRuntimeNode(Model): +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. + 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 this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] :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 + :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] + :type errors: list[~azure.mgmt.synapse.models.ManagedIntegrationRuntimeError] """ _validation = { @@ -2058,7 +3189,13 @@ class ManagedIntegrationRuntimeNode(Model): 'errors': {'key': 'errors', 'type': '[ManagedIntegrationRuntimeError]'}, } - def __init__(self, *, additional_properties=None, errors=None, **kwargs) -> None: + def __init__( + self, + *, + additional_properties: Optional[Dict[str, object]] = None, + errors: Optional[List["ManagedIntegrationRuntimeError"]] = None, + **kwargs + ): super(ManagedIntegrationRuntimeNode, self).__init__(**kwargs) self.additional_properties = additional_properties self.node_id = None @@ -2066,19 +3203,18 @@ def __init__(self, *, additional_properties=None, errors=None, **kwargs) -> None self.errors = errors -class ManagedIntegrationRuntimeOperationResult(Model): +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. + 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 this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] :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 + :vartype start_time: ~datetime.datetime :ivar result: The operation result. :vartype result: str :ivar error_code: The error code. @@ -2108,7 +3244,12 @@ class ManagedIntegrationRuntimeOperationResult(Model): 'activity_id': {'key': 'activityId', 'type': 'str'}, } - def __init__(self, *, additional_properties=None, **kwargs) -> None: + def __init__( + self, + *, + additional_properties: Optional[Dict[str, object]] = None, + **kwargs + ): super(ManagedIntegrationRuntimeOperationResult, self).__init__(**kwargs) self.additional_properties = additional_properties self.type = None @@ -2122,42 +3263,36 @@ def __init__(self, *, additional_properties=None, **kwargs) -> None: class ManagedIntegrationRuntimeStatus(IntegrationRuntimeStatus): """Managed integration runtime status. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :param additional_properties: Unmatched properties from the message are - deserialized this collection + :param additional_properties: Unmatched properties from the message are deserialized to this + collection. :type additional_properties: dict[str, object] - :ivar data_factory_name: The workspace name which the integration runtime - belong to. + :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' + :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 - :param type: Required. Constant filled by server. - :type type: str - :ivar create_time: The time at which the integration runtime was created, - in ISO8601 format. - :vartype create_time: datetime + :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] + :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 + :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}, - 'type': {'required': True}, 'create_time': {'readonly': True}, 'nodes': {'readonly': True}, 'other_errors': {'readonly': True}, @@ -2166,42 +3301,77 @@ class ManagedIntegrationRuntimeStatus(IntegrationRuntimeStatus): _attribute_map = { 'additional_properties': {'key': '', 'type': '{object}'}, + 'type': {'key': 'type', 'type': 'str'}, 'data_factory_name': {'key': 'dataFactoryName', 'type': 'str'}, 'state': {'key': 'state', 'type': 'str'}, - 'type': {'key': 'type', '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, *, additional_properties=None, **kwargs) -> None: + def __init__( + self, + *, + additional_properties: Optional[Dict[str, object]] = None, + **kwargs + ): super(ManagedIntegrationRuntimeStatus, self).__init__(additional_properties=additional_properties, **kwargs) + self.type = 'Managed' # type: str self.create_time = None self.nodes = None self.other_errors = None self.last_operation = None - self.type = 'Managed' -class MetadataSyncConfig(ProxyResource): - """Metadata sync configuration. +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, + *, + prevent_data_exfiltration: Optional[bool] = None, + linked_access_check_on_target_resource: Optional[bool] = None, + allowed_aad_tenant_ids_for_linking: Optional[List[str]] = None, + **kwargs + ): + 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 + self.allowed_aad_tenant_ids_for_linking = allowed_aad_tenant_ids_for_linking + - Configuration for metadata sync. +class MetadataSyncConfig(Resource): + """Configuration for metadata sync. - Variables are only populated by the server, and will be ignored when - sending a request. + 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} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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 + :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 = { @@ -2215,21 +3385,29 @@ class MetadataSyncConfig(ProxyResource): '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, *, enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + enabled: Optional[bool] = None, + sync_interval_in_minutes: Optional[int] = None, + **kwargs + ): super(MetadataSyncConfig, self).__init__(**kwargs) self.enabled = enabled + self.sync_interval_in_minutes = sync_interval_in_minutes -class OperationMetaLogSpecification(Model): +class OperationMetaLogSpecification(msrest.serialization.Model): """What is this?. - :param display_name: Log display name + :param display_name: Log display name. :type display_name: str - :param blob_duration: Time range the log covers + :param blob_duration: Time range the log covers. :type blob_duration: str - :param name: Log unique name + :param name: Log unique name. :type name: str """ @@ -2239,22 +3417,28 @@ class OperationMetaLogSpecification(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, *, display_name: str=None, blob_duration: str=None, name: str=None, **kwargs) -> None: + def __init__( + self, + *, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + name: Optional[str] = None, + **kwargs + ): super(OperationMetaLogSpecification, self).__init__(**kwargs) self.display_name = display_name self.blob_duration = blob_duration self.name = name -class OperationMetaMetricDimensionSpecification(Model): +class OperationMetaMetricDimensionSpecification(msrest.serialization.Model): """What is this?. - :param display_name: Dimension display name + :param display_name: Dimension display name. :type display_name: str - :param name: Dimension unique name + :param name: Dimension unique name. :type name: str - :param to_be_exported_for_shoebox: Whether this metric should be exported - for Shoebox + :param to_be_exported_for_shoebox: Whether this metric should be exported for Shoebox. :type to_be_exported_for_shoebox: bool """ @@ -2264,40 +3448,45 @@ class OperationMetaMetricDimensionSpecification(Model): 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, } - def __init__(self, *, display_name: str=None, name: str=None, to_be_exported_for_shoebox: bool=None, **kwargs) -> None: + def __init__( + self, + *, + display_name: Optional[str] = None, + name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + **kwargs + ): super(OperationMetaMetricDimensionSpecification, self).__init__(**kwargs) self.display_name = display_name self.name = name self.to_be_exported_for_shoebox = to_be_exported_for_shoebox -class OperationMetaMetricSpecification(Model): +class OperationMetaMetricSpecification(msrest.serialization.Model): """What is this?. - :param source_mdm_namespace: The source MDM namespace + :param source_mdm_namespace: The source MDM namespace. :type source_mdm_namespace: str - :param display_name: Metric display name + :param display_name: Metric display name. :type display_name: str - :param name: Metric unique name + :param name: Metric unique name. :type name: str - :param aggregation_type: Metric aggregation type + :param aggregation_type: Metric aggregation type. :type aggregation_type: str - :param display_description: Metric description + :param display_description: Metric description. :type display_description: str - :param source_mdm_account: The source MDM account + :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 + :param enable_regional_mdm_account: Whether the regional MDM account is enabled. :type enable_regional_mdm_account: bool - :param unit: Metric units + :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 + :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 + :param metric_filter_pattern: Metric filter. :type metric_filter_pattern: str """ @@ -2315,7 +3504,22 @@ class OperationMetaMetricSpecification(Model): 'metric_filter_pattern': {'key': 'metricFilterPattern', 'type': 'str'}, } - def __init__(self, *, source_mdm_namespace: str=None, display_name: str=None, name: str=None, aggregation_type: str=None, display_description: str=None, source_mdm_account: str=None, enable_regional_mdm_account: bool=None, unit: str=None, dimensions=None, supports_instance_level_aggregation: bool=None, metric_filter_pattern: str=None, **kwargs) -> None: + def __init__( + self, + *, + source_mdm_namespace: Optional[str] = None, + display_name: Optional[str] = None, + name: Optional[str] = None, + aggregation_type: Optional[str] = None, + display_description: Optional[str] = None, + source_mdm_account: Optional[str] = None, + enable_regional_mdm_account: Optional[bool] = None, + unit: Optional[str] = None, + dimensions: Optional[List["OperationMetaMetricDimensionSpecification"]] = None, + supports_instance_level_aggregation: Optional[bool] = None, + metric_filter_pattern: Optional[str] = None, + **kwargs + ): super(OperationMetaMetricSpecification, self).__init__(**kwargs) self.source_mdm_namespace = source_mdm_namespace self.display_name = display_name @@ -2330,15 +3534,13 @@ def __init__(self, *, source_mdm_namespace: str=None, display_name: str=None, na self.metric_filter_pattern = metric_filter_pattern -class OperationMetaServiceSpecification(Model): +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] + :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 = { @@ -2346,31 +3548,37 @@ class OperationMetaServiceSpecification(Model): 'log_specifications': {'key': 'logSpecifications', 'type': '[OperationMetaLogSpecification]'}, } - def __init__(self, *, metric_specifications=None, log_specifications=None, **kwargs) -> None: + def __init__( + self, + *, + metric_specifications: Optional[List["OperationMetaMetricSpecification"]] = None, + log_specifications: Optional[List["OperationMetaLogSpecification"]] = None, + **kwargs + ): super(OperationMetaServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications self.log_specifications = log_specifications -class OperationResource(Model): +class OperationResource(msrest.serialization.Model): """An operation. - :param id: Operation ID + :param id: Operation ID. :type id: str - :param name: Operation name + :param name: Operation name. :type name: str - :param status: Operation status. Possible values include: 'InProgress', - 'Succeeded', 'Failed', 'Canceled' + :param status: Operation status. Possible values include: "InProgress", "Succeeded", "Failed", + "Canceled". :type status: str or ~azure.mgmt.synapse.models.OperationStatus - :param properties: Operation properties + :param properties: Operation properties. :type properties: object - :param error: Errors from the operation + :param error: Errors from the operation. :type error: ~azure.mgmt.synapse.models.ErrorDetail - :param start_time: Operation start time - :type start_time: datetime - :param end_time: Operation start time - :type end_time: datetime - :param percent_complete: Completion percentage of the operation + :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 """ @@ -2385,7 +3593,19 @@ class OperationResource(Model): 'percent_complete': {'key': 'percentComplete', 'type': 'float'}, } - def __init__(self, *, id: str=None, name: str=None, status=None, properties=None, error=None, start_time=None, end_time=None, percent_complete: float=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + status: Optional[Union[str, "OperationStatus"]] = None, + properties: Optional[object] = None, + error: Optional["ErrorDetail"] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + percent_complete: Optional[float] = None, + **kwargs + ): super(OperationResource, self).__init__(**kwargs) self.id = id self.name = name @@ -2397,11 +3617,10 @@ def __init__(self, *, id: str=None, name: str=None, status=None, properties=None self.percent_complete = percent_complete -class PrivateEndpoint(Model): +class PrivateEndpoint(msrest.serialization.Model): """Private endpoint details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Resource id of the private endpoint. :vartype id: str @@ -2415,34 +3634,34 @@ class PrivateEndpoint(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(PrivateEndpoint, self).__init__(**kwargs) self.id = None -class PrivateEndpointConnection(ProxyResource): +class PrivateEndpointConnection(Resource): """A private endpoint connection. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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. + :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. + :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. + :ivar provisioning_state: Provisioning state of the private endpoint connection. :vartype provisioning_state: str """ @@ -2462,902 +3681,2102 @@ class PrivateEndpointConnection(ProxyResource): 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, *, private_endpoint=None, private_link_service_connection_state=None, **kwargs) -> None: + def __init__( + self, + *, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + **kwargs + ): super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state self.provisioning_state = None -class PrivateLinkResource(ProxyResource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when - sending a request. +class PrivateEndpointConnectionForPrivateLinkHubBasicAutoGenerated(msrest.serialization.Model): + """PrivateEndpointConnectionForPrivateLinkHubBasicAutoGenerated. - :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. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - :vartype type: str - :ivar properties: The private link resource properties. - :vartype properties: - ~azure.mgmt.synapse.models.PrivateLinkResourceProperties + :param id: + :type id: str + :param properties: Properties of a private endpoint connection. + :type properties: ~azure.mgmt.synapse.models.PrivateEndpointConnectionProperties """ - _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'}, + 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionProperties'}, } - def __init__(self, **kwargs) -> None: - super(PrivateLinkResource, self).__init__(**kwargs) - self.properties = None - + def __init__( + self, + *, + id: Optional[str] = None, + properties: Optional["PrivateEndpointConnectionProperties"] = None, + **kwargs + ): + super(PrivateEndpointConnectionForPrivateLinkHubBasicAutoGenerated, self).__init__(**kwargs) + self.id = id + self.properties = properties -class PrivateLinkResourceProperties(Model): - """Properties of a private link resource. - Variables are only populated by the server, and will be ignored when - sending a request. +class PrivateEndpointConnectionForPrivateLinkHub(PrivateEndpointConnectionForPrivateLinkHubBasicAutoGenerated): + """PrivateEndpointConnectionForPrivateLinkHub. - :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] + :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 """ - _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]'}, + 'id': {'key': 'id', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnectionProperties'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: - super(PrivateLinkResourceProperties, self).__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = None + def __init__( + self, + *, + id: Optional[str] = None, + properties: Optional["PrivateEndpointConnectionProperties"] = None, + name: Optional[str] = None, + type: Optional[str] = None, + **kwargs + ): + super(PrivateEndpointConnectionForPrivateLinkHub, self).__init__(id=id, properties=properties, **kwargs) + self.name = name + self.type = type -class PrivateLinkServiceConnectionState(Model): - """Connection state details of the private endpoint. +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. + Variables are only populated by the server, and will be ignored when sending a request. - :param status: The private link service connection status. Possible values - include: 'Approved', 'Pending', 'Rejected', 'Disconnected' - :type status: str or ~azure.mgmt.synapse.models.enum - :param description: The private link service connection description. - :type description: str - :ivar actions_required: The actions required for private link service + :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. - :vartype actions_required: str + :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 = { - 'actions_required': {'readonly': True}, + 'id': {'readonly': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + '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, *, status=None, description: str=None, **kwargs) -> None: - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = status - self.description = description - self.actions_required = None - + def __init__( + self, + *, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + **kwargs + ): + super(PrivateEndpointConnectionForPrivateLinkHubBasic, self).__init__(**kwargs) + self.id = None + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None -class QueryInterval(Model): - """A database query. - Variables are only populated by the server, and will be ignored when - sending a request. +class PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse(msrest.serialization.Model): + """PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse. - :ivar interval_start_time: The start time of the measurement interval - (ISO8601 format). - :vartype interval_start_time: datetime - :ivar execution_count: The number of times the query was executed during - this interval. - :vartype execution_count: float - :ivar metrics: The list of query metrics during this interval. - :vartype metrics: list[~azure.mgmt.synapse.models.QueryMetric] + :param value: + :type value: list[~azure.mgmt.synapse.models.PrivateEndpointConnectionForPrivateLinkHub] + :param next_link: + :type next_link: str """ - _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': 'float'}, - 'metrics': {'key': 'metrics', 'type': '[QueryMetric]'}, + 'value': {'key': 'value', 'type': '[PrivateEndpointConnectionForPrivateLinkHub]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: - super(QueryInterval, self).__init__(**kwargs) - self.interval_start_time = None - self.execution_count = None - self.metrics = None + def __init__( + self, + *, + value: Optional[List["PrivateEndpointConnectionForPrivateLinkHub"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse, self).__init__(**kwargs) + self.value = value + self.next_link = next_link -class QueryMetric(Model): - """A database query. +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. + 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 + :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 = { - 'name': {'readonly': True}, - 'display_name': {'readonly': True}, - 'unit': {'readonly': True}, 'value': {'readonly': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'QueryMetricUnit'}, - 'value': {'key': 'value', 'type': 'float'}, + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: - super(QueryMetric, self).__init__(**kwargs) - self.name = None - self.display_name = None - self.unit = None + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionList, self).__init__(**kwargs) self.value = None + self.next_link = None -class QueryStatistic(Model): - """A database query. +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. + 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] + :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 = { - 'query_id': {'readonly': True}, - 'intervals': {'readonly': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { - 'query_id': {'key': 'queryId', 'type': 'str'}, - 'intervals': {'key': 'intervals', 'type': '[QueryInterval]'}, + '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) -> None: - super(QueryStatistic, self).__init__(**kwargs) - self.query_id = None - self.intervals = None + def __init__( + self, + *, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + **kwargs + ): + super(PrivateEndpointConnectionProperties, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None -class ReplaceAllFirewallRulesOperationResponse(Model): - """An existing operation for replacing the firewall rules. +class PrivateLinkHub(TrackedResource): + """A privateLinkHub. - :param operation_id: The operation ID - :type operation_id: str + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :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 = { - 'operation_id': {'key': 'operationId', 'type': 'str'}, + '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, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + provisioning_state: Optional[str] = None, + **kwargs + ): + super(PrivateLinkHub, self).__init__(tags=tags, location=location, **kwargs) + self.provisioning_state = provisioning_state + 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, *, operation_id: str=None, **kwargs) -> None: - super(ReplaceAllFirewallRulesOperationResponse, self).__init__(**kwargs) - self.operation_id = operation_id + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["PrivateLinkHub"]] = None, + **kwargs + ): + super(PrivateLinkHubInfoListResult, self).__init__(**kwargs) + self.next_link = next_link + self.value = value -class ReplaceAllIpFirewallRulesRequest(Model): - """Replace all IP firewall rules request. +class PrivateLinkHubPatchInfo(msrest.serialization.Model): + """PrivateLinkHub patch details. - :param ip_firewall_rules: IP firewall rule properties - :type ip_firewall_rules: dict[str, - ~azure.mgmt.synapse.models.IpFirewallRuleProperties] + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] """ _attribute_map = { - 'ip_firewall_rules': {'key': 'ipFirewallRules', 'type': '{IpFirewallRuleProperties}'}, + 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, ip_firewall_rules=None, **kwargs) -> None: - super(ReplaceAllIpFirewallRulesRequest, self).__init__(**kwargs) - self.ip_firewall_rules = ip_firewall_rules + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(PrivateLinkHubPatchInfo, self).__init__(**kwargs) + self.tags = tags -class ReplicationLink(ProxyResource): - """Represents a Sql pool replication link. +class PrivateLinkResource(Resource): + """A private link resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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 - :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 + :ivar properties: The private link resource properties. + :vartype properties: ~azure.mgmt.synapse.models.PrivateLinkResourceProperties """ _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}, + 'properties': {'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': 'ReplicationRole'}, - 'partner_role': {'key': 'properties.partnerRole', 'type': 'ReplicationRole'}, - 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, - 'percent_complete': {'key': 'properties.percentComplete', 'type': 'int'}, - 'replication_state': {'key': 'properties.replicationState', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'PrivateLinkResourceProperties'}, } - def __init__(self, **kwargs) -> None: - 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 + def __init__( + self, + **kwargs + ): + super(PrivateLinkResource, self).__init__(**kwargs) + self.properties = None -class ResourceMoveDefinition(Model): - """Contains the information necessary to perform a resource move (rename). +class PrivateLinkResourceListResult(msrest.serialization.Model): + """A list of private link resources. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param id: Required. The target ID for the resource - :type id: str + :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 = { - 'id': {'required': True}, + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, id: str, **kwargs) -> None: - super(ResourceMoveDefinition, self).__init__(**kwargs) - self.id = id + def __init__( + self, + **kwargs + ): + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None -class RestorePoint(ProxyResource): - """Database restore points. +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, + *, + status: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = None - 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} +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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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 - :ivar restore_point_creation_date: The time the backup was taken - :vartype restore_point_creation_date: 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': 'RestorePointType'}, - '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) -> None: - 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 SecretBase(Model): - """The base definition of a secret type. + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) - 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. +class PurviewConfiguration(msrest.serialization.Model): + """Purview Configuration. - :param type: Required. Constant filled by server. - :type type: str + :param purview_resource_id: Purview Resource ID. + :type purview_resource_id: str """ - _validation = { - 'type': {'required': True}, - } - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'SecureString': 'SecureString'} + 'purview_resource_id': {'key': 'purviewResourceId', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: - super(SecretBase, self).__init__(**kwargs) - self.type = None + def __init__( + self, + *, + purview_resource_id: Optional[str] = None, + **kwargs + ): + super(PurviewConfiguration, self).__init__(**kwargs) + self.purview_resource_id = purview_resource_id -class SecureString(SecretBase): - """Azure Synapse secure string definition. The string value will be masked - with asterisks '*' during Get or List API calls. +class QueryInterval(msrest.serialization.Model): + """A database query. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param type: Required. Constant filled by server. - :type type: str - :param value: Required. Value of secure string. - :type value: str + :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 = { - 'type': {'required': True}, - 'value': {'required': True}, + 'interval_start_time': {'readonly': True}, + 'execution_count': {'readonly': True}, + 'metrics': {'readonly': True}, } _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, + 'interval_start_time': {'key': 'intervalStartTime', 'type': 'iso-8601'}, + 'execution_count': {'key': 'executionCount', 'type': 'int'}, + 'metrics': {'key': 'metrics', 'type': '[QueryMetric]'}, } - def __init__(self, *, value: str, **kwargs) -> None: - super(SecureString, self).__init__(**kwargs) - self.value = value - self.type = 'SecureString' + def __init__( + self, + **kwargs + ): + super(QueryInterval, self).__init__(**kwargs) + self.interval_start_time = None + self.execution_count = None + self.metrics = None -class SelfHostedIntegrationRuntime(IntegrationRuntime): - """Self-hosted integration runtime. +class QueryMetric(msrest.serialization.Model): + """A database query. - All required parameters must be populated in order to send to Azure. + Variables are only populated by the server, and will be ignored when sending a request. - :param additional_properties: Unmatched properties from the message are - deserialized this collection - :type additional_properties: dict[str, object] - :param description: Integration runtime description. - :type description: str - :param type: Required. Constant filled by server. - :type type: str - :param linked_info: - :type linked_info: ~azure.mgmt.synapse.models.LinkedIntegrationRuntimeType + :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 = { - 'type': {'required': True}, + 'name': {'readonly': True}, + 'display_name': {'readonly': True}, + 'unit': {'readonly': True}, + 'value': {'readonly': True}, } _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'description': {'key': 'description', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'linked_info': {'key': 'typeProperties.linkedInfo', 'type': 'LinkedIntegrationRuntimeType'}, + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'float'}, } - def __init__(self, *, additional_properties=None, description: str=None, linked_info=None, **kwargs) -> None: - super(SelfHostedIntegrationRuntime, self).__init__(additional_properties=additional_properties, description=description, **kwargs) - self.linked_info = linked_info - self.type = 'SelfHosted' + def __init__( + self, + **kwargs + ): + super(QueryMetric, self).__init__(**kwargs) + self.name = None + self.display_name = None + self.unit = None + self.value = None -class SelfHostedIntegrationRuntimeNode(Model): - """Properties of Self-hosted integration runtime node. +class QueryStatistic(msrest.serialization.Model): + """A database query. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param additional_properties: Unmatched properties from the message are - deserialized this collection - :type additional_properties: dict[str, object] - :ivar node_name: Name of the integration runtime node. - :vartype node_name: str + :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 RecoverableSqlPool(Resource): + """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, + *, + operation_id: Optional[str] = None, + **kwargs + ): + super(ReplaceAllFirewallRulesOperationResponse, self).__init__(**kwargs) + self.operation_id = operation_id + + +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, + *, + ip_firewall_rules: Optional[Dict[str, "IpFirewallRuleProperties"]] = None, + **kwargs + ): + super(ReplaceAllIpFirewallRulesRequest, self).__init__(**kwargs) + self.ip_firewall_rules = ip_firewall_rules + + +class ReplicationLink(Resource): + """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, + *, + value: Optional[List["ReplicationLink"]] = None, + **kwargs + ): + super(ReplicationLinkListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class RestorableDroppedSqlPool(Resource): + """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, + *, + value: List["RestorableDroppedSqlPool"], + **kwargs + ): + super(RestorableDroppedSqlPoolListResult, self).__init__(**kwargs) + self.value = value + + +class RestorePoint(Resource): + """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, + *, + value: str, + **kwargs + ): + super(SecureString, self).__init__(**kwargs) + self.type = 'SecureString' # type: str + self.value = 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, object] + :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, + *, + additional_properties: Optional[Dict[str, object]] = None, + description: Optional[str] = None, + linked_info: Optional["LinkedIntegrationRuntimeType"] = None, + **kwargs + ): + super(SelfHostedIntegrationRuntime, self).__init__(additional_properties=additional_properties, description=description, **kwargs) + self.type = 'SelfHosted' # type: str + self.linked_info = linked_info + + +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, object] + :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. + :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 + :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 - :ivar last_connect_time: The most recent time at which the integration - runtime was connected in ISO8601 format. - :vartype last_connect_time: datetime - :ivar expiry_time: The time at which the integration runtime will expire - in ISO8601 format. - :vartype expiry_time: datetime + :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 + :vartype last_start_time: ~datetime.datetime :ivar last_stop_time: The integration runtime node last stop time. - :vartype last_stop_time: 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 - :ivar last_end_update_time: The last time for the integration runtime node - update end. - :vartype last_end_update_time: datetime - :ivar is_active_dispatcher: Indicates whether this node is the active - dispatcher for integration runtime requests. + :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. + :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. + :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}, + '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, + *, + additional_properties: Optional[Dict[str, object]] = None, + **kwargs + ): + super(SelfHostedIntegrationRuntimeNode, self).__init__(**kwargs) + self.additional_properties = additional_properties + 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, object] + :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, + *, + additional_properties: Optional[Dict[str, object]] = None, + nodes: Optional[List["SelfHostedIntegrationRuntimeNode"]] = None, + links: Optional[List["LinkedIntegrationRuntime"]] = None, + **kwargs + ): + super(SelfHostedIntegrationRuntimeStatus, self).__init__(additional_properties=additional_properties, **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 = nodes + 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 = links + self.pushed_version = None + self.latest_version = None + self.auto_update_eta = None + + +class SensitivityLabel(Resource): + """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 + :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 + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'is_disabled': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', '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'}, + } + + def __init__( + self, + *, + label_name: Optional[str] = None, + label_id: Optional[str] = None, + information_type: Optional[str] = None, + information_type_id: Optional[str] = None, + **kwargs + ): + super(SensitivityLabel, self).__init__(**kwargs) + self.label_name = label_name + self.label_id = label_id + self.information_type = information_type + self.information_type_id = information_type_id + self.is_disabled = 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 ServerBlobAuditingPolicy(Resource): + """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, + *, + state: Optional[Union[str, "BlobAuditingPolicyState"]] = None, + storage_endpoint: Optional[str] = None, + storage_account_access_key: Optional[str] = None, + retention_days: Optional[int] = None, + audit_actions_and_groups: Optional[List[str]] = None, + storage_account_subscription_id: Optional[str] = None, + is_storage_secondary_key_in_use: Optional[bool] = None, + is_azure_monitor_target_enabled: Optional[bool] = None, + queue_delay_ms: Optional[int] = None, + **kwargs + ): + super(ServerBlobAuditingPolicy, self).__init__(**kwargs) + self.state = state + self.storage_endpoint = storage_endpoint + self.storage_account_access_key = storage_account_access_key + self.retention_days = retention_days + self.audit_actions_and_groups = audit_actions_and_groups + self.storage_account_subscription_id = storage_account_subscription_id + self.is_storage_secondary_key_in_use = is_storage_secondary_key_in_use + self.is_azure_monitor_target_enabled = is_azure_monitor_target_enabled + self.queue_delay_ms = queue_delay_ms + + +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(Resource): + """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, + *, + state: Optional[Union[str, "SecurityAlertPolicyState"]] = None, + disabled_alerts: Optional[List[str]] = None, + email_addresses: Optional[List[str]] = None, + email_account_admins: Optional[bool] = None, + storage_endpoint: Optional[str] = None, + storage_account_access_key: Optional[str] = None, + retention_days: Optional[int] = None, + **kwargs + ): + super(ServerSecurityAlertPolicy, self).__init__(**kwargs) + self.state = state + self.disabled_alerts = disabled_alerts + self.email_addresses = email_addresses + self.email_account_admins = email_account_admins + self.storage_endpoint = storage_endpoint + self.storage_account_access_key = storage_account_access_key + self.retention_days = retention_days + 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 = { - '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'}, + '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, *, additional_properties=None, **kwargs) -> None: - super(SelfHostedIntegrationRuntimeNode, self).__init__(**kwargs) - self.additional_properties = additional_properties - 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 + 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 SelfHostedIntegrationRuntimeStatus(IntegrationRuntimeStatus): - """Self-hosted integration runtime status. +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. + Variables are only populated 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 this collection - :type additional_properties: dict[str, object] - :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 - :param type: Required. Constant filled by server. - :type type: str - :ivar create_time: The time at which the integration runtime was created, - in ISO8601 format. - :vartype create_time: datetime - :ivar task_queue_id: The task queue id of the integration runtime. - :vartype task_queue_id: 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 - :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 + :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 = { - 'data_factory_name': {'readonly': True}, - 'state': {'readonly': True}, - 'type': {'required': True}, - 'create_time': {'readonly': True}, - 'task_queue_id': {'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}, + 'value': {'required': True}, + 'next_link': {'readonly': True}, } _attribute_map = { - 'additional_properties': {'key': '', 'type': '{object}'}, - 'data_factory_name': {'key': 'dataFactoryName', 'type': 'str'}, - 'state': {'key': 'state', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'create_time': {'key': 'typeProperties.createTime', 'type': 'iso-8601'}, - 'task_queue_id': {'key': 'typeProperties.taskQueueId', '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'}, + 'value': {'key': 'value', 'type': '[ServerUsage]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, additional_properties=None, nodes=None, links=None, **kwargs) -> None: - super(SelfHostedIntegrationRuntimeStatus, self).__init__(additional_properties=additional_properties, **kwargs) - self.create_time = None - self.task_queue_id = None - self.internal_channel_encryption = None - self.version = None - self.nodes = nodes - 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 = links - self.pushed_version = None - self.latest_version = None - self.auto_update_eta = None - self.type = 'SelfHosted' + def __init__( + self, + *, + value: List["ServerUsage"], + **kwargs + ): + super(ServerUsageListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None -class SensitivityLabel(ProxyResource): - """A sensitivity label. +class ServerVulnerabilityAssessment(Resource): + """A server vulnerability assessment. - Variables are only populated by the server, and will be ignored when - sending a request. + 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} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: 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 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}, - 'is_disabled': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', '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'}, + '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, *, label_name: str=None, label_id: str=None, information_type: str=None, information_type_id: str=None, **kwargs) -> None: - super(SensitivityLabel, self).__init__(**kwargs) - self.label_name = label_name - self.label_id = label_id - self.information_type = information_type - self.information_type_id = information_type_id - self.is_disabled = None + def __init__( + self, + *, + storage_container_path: Optional[str] = None, + storage_container_sas_key: Optional[str] = None, + storage_account_access_key: Optional[str] = None, + recurring_scans: Optional["VulnerabilityAssessmentRecurringScansProperties"] = None, + **kwargs + ): + super(ServerVulnerabilityAssessment, self).__init__(**kwargs) + self.storage_container_path = storage_container_path + self.storage_container_sas_key = storage_container_sas_key + self.storage_account_access_key = storage_account_access_key + self.recurring_scans = recurring_scans + + +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(Model): - """Sku. - SQL pool SKU. +class Sku(msrest.serialization.Model): + """SQL pool SKU. - :param tier: The service tier + :param tier: The service tier. :type tier: str - :param name: The SKU name + :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, *, tier: str=None, name: str=None, **kwargs) -> None: + def __init__( + self, + *, + tier: Optional[str] = None, + name: Optional[str] = None, + capacity: Optional[int] = None, + **kwargs + ): super(Sku, self).__init__(**kwargs) self.tier = tier self.name = name + self.capacity = capacity class SqlPool(TrackedResource): - """SQL pool. - - A SQL Analytics pool. + """A SQL Analytics pool. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives + :param location: Required. The geo-location where the resource lives. :type location: str - :param sku: SQL pool SKU + :param sku: SQL pool SKU. :type sku: ~azure.mgmt.synapse.models.Sku - :param max_size_bytes: Maximum size in bytes + :param max_size_bytes: Maximum size in bytes. :type max_size_bytes: long - :param collation: Collation mode + :param collation: Collation mode. :type collation: str - :param source_database_id: Source database to create from + :param source_database_id: Source database to create from. :type source_database_id: str - :param recoverable_database_id: Backup database to restore from + :param recoverable_database_id: Backup database to restore from. :type recoverable_database_id: str - :param provisioning_state: Resource state + :param provisioning_state: Resource state. :type provisioning_state: str - :param status: Resource status + :param status: Resource status. :type status: str - :param restore_point_in_time: Snapshot time to restore - :type restore_point_in_time: datetime - :param create_mode: What is this? + :param restore_point_in_time: Snapshot time to restore. + :type restore_point_in_time: str + :param create_mode: What is this?. :type create_mode: str - :param creation_date: Date the SQL pool was created - :type creation_date: datetime + :param creation_date: Date the SQL pool was created. + :type creation_date: ~datetime.datetime """ _validation = { @@ -3380,12 +5799,28 @@ class SqlPool(TrackedResource): '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'}, + 'restore_point_in_time': {'key': 'properties.restorePointInTime', 'type': 'str'}, 'create_mode': {'key': 'properties.createMode', 'type': 'str'}, 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, } - def __init__(self, *, location: str, tags=None, sku=None, max_size_bytes: int=None, collation: str=None, source_database_id: str=None, recoverable_database_id: str=None, provisioning_state: str=None, status: str=None, restore_point_in_time=None, create_mode: str=None, creation_date=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + sku: Optional["Sku"] = None, + max_size_bytes: Optional[int] = None, + collation: Optional[str] = None, + source_database_id: Optional[str] = None, + recoverable_database_id: Optional[str] = None, + provisioning_state: Optional[str] = None, + status: Optional[str] = None, + restore_point_in_time: Optional[str] = None, + create_mode: Optional[str] = None, + creation_date: Optional[datetime.datetime] = None, + **kwargs + ): super(SqlPool, self).__init__(tags=tags, location=location, **kwargs) self.sku = sku self.max_size_bytes = max_size_bytes @@ -3399,52 +5834,50 @@ def __init__(self, *, location: str, tags=None, sku=None, max_size_bytes: int=No self.creation_date = creation_date -class SqlPoolBlobAuditingPolicy(ProxyResource): +class SqlPoolBlobAuditingPolicy(Resource): """A Sql pool blob auditing 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. + 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} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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: Required. Specifies the state of the policy. If state is - Enabled, storageEndpoint or isAzureMonitorTargetEnabled are required. - Possible values include: 'Enabled', 'Disabled' + :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. + 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. + :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. + :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: + :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): + + 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 @@ -3465,14 +5898,17 @@ class SqlPoolBlobAuditingPolicy(ProxyResource): 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](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#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: + + 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 @@ -3480,41 +5916,45 @@ class SqlPoolBlobAuditingPolicy(ProxyResource): EXECUTE RECEIVE REFERENCES + The general form for defining an action to be audited is: {action} ON {object} BY {principal} - Note that 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. + + 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](https://docs.microsoft.com/en-us/sql/relational-databases/security/auditing/sql-server-audit-action-groups-and-actions#database-level-audit-actions) + + 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. + :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. + :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}. + :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](https://go.microsoft.com/fwlink/?linkid=2033207) - or [Diagnostic Settings - PowerShell](https://go.microsoft.com/fwlink/?linkid=2033043) + 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 """ @@ -3523,7 +5963,6 @@ class SqlPoolBlobAuditingPolicy(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'kind': {'readonly': True}, - 'state': {'required': True}, } _attribute_map = { @@ -3531,7 +5970,7 @@ class SqlPoolBlobAuditingPolicy(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'kind': {'key': 'kind', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'BlobAuditingPolicyState'}, + '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'}, @@ -3541,7 +5980,19 @@ class SqlPoolBlobAuditingPolicy(ProxyResource): 'is_azure_monitor_target_enabled': {'key': 'properties.isAzureMonitorTargetEnabled', 'type': 'bool'}, } - def __init__(self, *, state, storage_endpoint: str=None, storage_account_access_key: str=None, retention_days: int=None, audit_actions_and_groups=None, storage_account_subscription_id: str=None, is_storage_secondary_key_in_use: bool=None, is_azure_monitor_target_enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + state: Optional[Union[str, "BlobAuditingPolicyState"]] = None, + storage_endpoint: Optional[str] = None, + storage_account_access_key: Optional[str] = None, + retention_days: Optional[int] = None, + audit_actions_and_groups: Optional[List[str]] = None, + storage_account_subscription_id: Optional[str] = None, + is_storage_secondary_key_in_use: Optional[bool] = None, + is_azure_monitor_target_enabled: Optional[bool] = None, + **kwargs + ): super(SqlPoolBlobAuditingPolicy, self).__init__(**kwargs) self.kind = None self.state = state @@ -3554,27 +6005,84 @@ def __init__(self, *, state, storage_endpoint: str=None, storage_account_access_ self.is_azure_monitor_target_enabled = is_azure_monitor_target_enabled -class SqlPoolColumn(ProxyResource): +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(Resource): """A Sql pool column resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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' + :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 """ @@ -3591,24 +6099,58 @@ class SqlPoolColumn(ProxyResource): 'column_type': {'key': 'properties.columnType', 'type': 'str'}, } - def __init__(self, *, column_type=None, **kwargs) -> None: + def __init__( + self, + *, + column_type: Optional[Union[str, "ColumnDataType"]] = None, + **kwargs + ): super(SqlPoolColumn, self).__init__(**kwargs) self.column_type = column_type -class SqlPoolConnectionPolicy(ProxyResource): +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(Resource): """A Sql pool connection policy. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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 @@ -3616,8 +6158,7 @@ class SqlPoolConnectionPolicy(ProxyResource): :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. + :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 @@ -3654,7 +6195,18 @@ class SqlPoolConnectionPolicy(ProxyResource): 'state': {'key': 'properties.state', 'type': 'str'}, } - def __init__(self, *, security_enabled_access: str=None, proxy_dns_name: str=None, proxy_port: str=None, visibility: str=None, use_server_default: str=None, redirection_state: str=None, state: str=None, **kwargs) -> None: + def __init__( + self, + *, + security_enabled_access: Optional[str] = None, + proxy_dns_name: Optional[str] = None, + proxy_port: Optional[str] = None, + visibility: Optional[str] = None, + use_server_default: Optional[str] = None, + redirection_state: Optional[str] = None, + state: Optional[str] = None, + **kwargs + ): super(SqlPoolConnectionPolicy, self).__init__(**kwargs) self.kind = None self.location = None @@ -3667,22 +6219,46 @@ def __init__(self, *, security_enabled_access: str=None, proxy_dns_name: str=Non self.state = state -class SqlPoolOperation(ProxyResource): +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, + *, + next_link: Optional[str] = None, + value: Optional[List["SqlPool"]] = None, + **kwargs + ): + super(SqlPoolInfoListResult, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class SqlPoolOperation(Resource): """A Sql pool operation. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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. + :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 @@ -3693,9 +6269,9 @@ class SqlPoolOperation(ProxyResource): :ivar server_name: The name of the server. :vartype server_name: str :ivar start_time: The operation start time. - :vartype start_time: datetime - :ivar state: The operation state. Possible values include: 'Pending', - 'InProgress', 'Succeeded', 'Failed', 'CancelInProgress', 'Cancelled' + :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 @@ -3705,9 +6281,8 @@ class SqlPoolOperation(ProxyResource): :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 + :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. @@ -3754,7 +6329,10 @@ class SqlPoolOperation(ProxyResource): 'is_cancellable': {'key': 'properties.isCancellable', 'type': 'bool'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(SqlPoolOperation, self).__init__(**kwargs) self.database_name = None self.operation = None @@ -3772,35 +6350,33 @@ def __init__(self, **kwargs) -> None: self.is_cancellable = None -class SqlPoolPatchInfo(Model): - """SQL pool patch info. +class SqlPoolPatchInfo(msrest.serialization.Model): + """A SQL Analytics pool patch info. - A SQL Analytics pool patch info. - - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: The geo-location where the resource lives + :param location: The geo-location where the resource lives. :type location: str - :param sku: SQL pool SKU + :param sku: SQL pool SKU. :type sku: ~azure.mgmt.synapse.models.Sku - :param max_size_bytes: Maximum size in bytes + :param max_size_bytes: Maximum size in bytes. :type max_size_bytes: long - :param collation: Collation mode + :param collation: Collation mode. :type collation: str - :param source_database_id: Source database to create from + :param source_database_id: Source database to create from. :type source_database_id: str - :param recoverable_database_id: Backup database to restore from + :param recoverable_database_id: Backup database to restore from. :type recoverable_database_id: str - :param provisioning_state: Resource state + :param provisioning_state: Resource state. :type provisioning_state: str - :param status: Resource status + :param status: Resource status. :type status: str - :param restore_point_in_time: Snapshot time to restore - :type restore_point_in_time: datetime - :param create_mode: What is this? + :param restore_point_in_time: Snapshot time to restore. + :type restore_point_in_time: str + :param create_mode: What is this?. :type create_mode: str - :param creation_date: Date the SQL pool was created - :type creation_date: datetime + :param creation_date: Date the SQL pool was created. + :type creation_date: ~datetime.datetime """ _attribute_map = { @@ -3813,12 +6389,28 @@ class SqlPoolPatchInfo(Model): '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'}, + 'restore_point_in_time': {'key': 'properties.restorePointInTime', 'type': 'str'}, 'create_mode': {'key': 'properties.createMode', 'type': 'str'}, 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, } - def __init__(self, *, tags=None, location: str=None, sku=None, max_size_bytes: int=None, collation: str=None, source_database_id: str=None, recoverable_database_id: str=None, provisioning_state: str=None, status: str=None, restore_point_in_time=None, create_mode: str=None, creation_date=None, **kwargs) -> None: + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + location: Optional[str] = None, + sku: Optional["Sku"] = None, + max_size_bytes: Optional[int] = None, + collation: Optional[str] = None, + source_database_id: Optional[str] = None, + recoverable_database_id: Optional[str] = None, + provisioning_state: Optional[str] = None, + status: Optional[str] = None, + restore_point_in_time: Optional[str] = None, + create_mode: Optional[str] = None, + creation_date: Optional[datetime.datetime] = None, + **kwargs + ): super(SqlPoolPatchInfo, self).__init__(**kwargs) self.tags = tags self.location = location @@ -3834,19 +6426,18 @@ def __init__(self, *, tags=None, location: str=None, sku=None, max_size_bytes: i self.creation_date = creation_date -class SqlPoolSchema(ProxyResource): +class SqlPoolSchema(Resource): """A Sql pool schema resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -3862,59 +6453,84 @@ class SqlPoolSchema(ProxyResource): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(SqlPoolSchema, self).__init__(**kwargs) -class SqlPoolSecurityAlertPolicy(ProxyResource): - """A Sql pool security alert policy. +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. + Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + :ivar value: Array of results. + :vartype value: list[~azure.mgmt.synapse.models.Resource] + :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': '[Resource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + def __init__( + self, + **kwargs + ): + super(SqlPoolSchemaListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class SqlPoolSecurityAlertPolicy(Resource): + """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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param state: Required. 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' + :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 + :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. + :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. + :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. + 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. + :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. + :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 + :vartype creation_time: ~datetime.datetime """ _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'state': {'required': True}, 'creation_time': {'readonly': True}, } @@ -3922,7 +6538,7 @@ class SqlPoolSecurityAlertPolicy(ProxyResource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'SecurityAlertPolicyState'}, + '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'}, @@ -3932,7 +6548,18 @@ class SqlPoolSecurityAlertPolicy(ProxyResource): 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, } - def __init__(self, *, state, disabled_alerts=None, email_addresses=None, email_account_admins: bool=None, storage_endpoint: str=None, storage_account_access_key: str=None, retention_days: int=None, **kwargs) -> None: + def __init__( + self, + *, + state: Optional[Union[str, "SecurityAlertPolicyState"]] = None, + disabled_alerts: Optional[List[str]] = None, + email_addresses: Optional[List[str]] = None, + email_account_admins: Optional[bool] = None, + storage_endpoint: Optional[str] = None, + storage_account_access_key: Optional[str] = None, + retention_days: Optional[int] = None, + **kwargs + ): super(SqlPoolSecurityAlertPolicy, self).__init__(**kwargs) self.state = state self.disabled_alerts = disabled_alerts @@ -3944,19 +6571,18 @@ def __init__(self, *, state, disabled_alerts=None, email_addresses=None, email_a self.creation_time = None -class SqlPoolTable(ProxyResource): +class SqlPoolTable(Resource): """A Sql pool table resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str """ @@ -3972,15 +6598,47 @@ class SqlPoolTable(ProxyResource): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(SqlPoolTable, self).__init__(**kwargs) -class SqlPoolUsage(Model): +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.Resource] + :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': '[Resource]'}, + '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. + 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 @@ -3994,9 +6652,8 @@ class SqlPoolUsage(Model): :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 + :ivar next_reset_time: The next reset time for the usage metric (ISO8601 format). + :vartype next_reset_time: ~datetime.datetime """ _validation = { @@ -4019,7 +6676,10 @@ class SqlPoolUsage(Model): 'next_reset_time': {'key': 'nextResetTime', 'type': 'iso-8601'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(SqlPoolUsage, self).__init__(**kwargs) self.name = None self.resource_name = None @@ -4030,35 +6690,66 @@ def __init__(self, **kwargs) -> None: self.next_reset_time = None -class SqlPoolVulnerabilityAssessment(ProxyResource): +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, + *, + value: List["SqlPoolUsage"], + **kwargs + ): + super(SqlPoolUsageListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class SqlPoolVulnerabilityAssessment(Resource): """A Sql pool vulnerability assessment. - Variables are only populated by the server, and will be ignored when - sending a request. + 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} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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 + :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. + :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. + :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 + :param recurring_scans: The recurring scans settings. :type recurring_scans: ~azure.mgmt.synapse.models.VulnerabilityAssessmentRecurringScansProperties """ @@ -4079,7 +6770,15 @@ class SqlPoolVulnerabilityAssessment(ProxyResource): 'recurring_scans': {'key': 'properties.recurringScans', 'type': 'VulnerabilityAssessmentRecurringScansProperties'}, } - def __init__(self, *, storage_container_path: str=None, storage_container_sas_key: str=None, storage_account_access_key: str=None, recurring_scans=None, **kwargs) -> None: + def __init__( + self, + *, + storage_container_path: Optional[str] = None, + storage_container_sas_key: Optional[str] = None, + storage_account_access_key: Optional[str] = None, + recurring_scans: Optional["VulnerabilityAssessmentRecurringScansProperties"] = None, + **kwargs + ): super(SqlPoolVulnerabilityAssessment, self).__init__(**kwargs) self.storage_container_path = storage_container_path self.storage_container_sas_key = storage_container_sas_key @@ -4087,23 +6786,50 @@ def __init__(self, *, storage_container_path: str=None, storage_container_sas_ke self.recurring_scans = recurring_scans -class SqlPoolVulnerabilityAssessmentRuleBaseline(ProxyResource): - """A Sql pool vulnerability assessment rule baseline. +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. + 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 - 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} +class SqlPoolVulnerabilityAssessmentRuleBaseline(Resource): + """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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param baseline_results: Required. The rule baseline result + :param baseline_results: The rule baseline result. :type baseline_results: list[~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessmentRuleBaselineItem] """ @@ -4112,7 +6838,6 @@ class SqlPoolVulnerabilityAssessmentRuleBaseline(ProxyResource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'baseline_results': {'required': True}, } _attribute_map = { @@ -4122,17 +6847,22 @@ class SqlPoolVulnerabilityAssessmentRuleBaseline(ProxyResource): 'baseline_results': {'key': 'properties.baselineResults', 'type': '[SqlPoolVulnerabilityAssessmentRuleBaselineItem]'}, } - def __init__(self, *, baseline_results, **kwargs) -> None: + def __init__( + self, + *, + baseline_results: Optional[List["SqlPoolVulnerabilityAssessmentRuleBaselineItem"]] = None, + **kwargs + ): super(SqlPoolVulnerabilityAssessmentRuleBaseline, self).__init__(**kwargs) self.baseline_results = baseline_results -class SqlPoolVulnerabilityAssessmentRuleBaselineItem(Model): +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 + :param result: Required. The rule baseline result. :type result: list[str] """ @@ -4144,24 +6874,28 @@ class SqlPoolVulnerabilityAssessmentRuleBaselineItem(Model): 'result': {'key': 'result', 'type': '[str]'}, } - def __init__(self, *, result, **kwargs) -> None: + def __init__( + self, + *, + result: List[str], + **kwargs + ): super(SqlPoolVulnerabilityAssessmentRuleBaselineItem, self).__init__(**kwargs) self.result = result -class SqlPoolVulnerabilityAssessmentScansExport(ProxyResource): +class SqlPoolVulnerabilityAssessmentScansExport(Resource): """A Sql pool Vulnerability Assessment scan export resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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). @@ -4182,27 +6916,31 @@ class SqlPoolVulnerabilityAssessmentScansExport(ProxyResource): 'exported_report_location': {'key': 'properties.exportedReportLocation', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(SqlPoolVulnerabilityAssessmentScansExport, self).__init__(**kwargs) self.exported_report_location = None -class SsisObjectMetadata(Model): +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: SsisFolder, SsisProject, SsisPackage, SsisEnvironment + 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 - :param type: Required. Constant filled by server. - :type type: str """ _validation = { @@ -4210,22 +6948,29 @@ class SsisObjectMetadata(Model): } _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, 'id': {'key': 'id', 'type': 'long'}, 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, } _subtype_map = { - 'type': {'Folder': 'SsisFolder', 'Project': 'SsisProject', 'Package': 'SsisPackage', 'Environment': 'SsisEnvironment'} + 'type': {'Environment': 'SsisEnvironment', 'Folder': 'SsisFolder', 'Package': 'SsisPackage', 'Project': 'SsisProject'} } - def __init__(self, *, id: int=None, name: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[int] = None, + name: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(SsisObjectMetadata, self).__init__(**kwargs) + self.type = None # type: Optional[str] self.id = id self.name = name self.description = description - self.type = None class SsisEnvironment(SsisObjectMetadata): @@ -4233,17 +6978,18 @@ 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: + "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 type: Required. Constant filled by server. - :type type: str :param folder_id: Folder id which contains environment. :type folder_id: long - :param variables: Variable in environment + :param variables: Variable in environment. :type variables: list[~azure.mgmt.synapse.models.SsisVariable] """ @@ -4252,22 +6998,31 @@ class SsisEnvironment(SsisObjectMetadata): } _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, 'id': {'key': 'id', 'type': 'long'}, 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, 'folder_id': {'key': 'folderId', 'type': 'long'}, 'variables': {'key': 'variables', 'type': '[SsisVariable]'}, } - def __init__(self, *, id: int=None, name: str=None, description: str=None, folder_id: int=None, variables=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[int] = None, + name: Optional[str] = None, + description: Optional[str] = None, + folder_id: Optional[int] = None, + variables: Optional[List["SsisVariable"]] = None, + **kwargs + ): super(SsisEnvironment, self).__init__(id=id, name=name, description=description, **kwargs) + self.type = 'Environment' # type: str self.folder_id = folder_id self.variables = variables - self.type = 'Environment' -class SsisEnvironmentReference(Model): +class SsisEnvironmentReference(msrest.serialization.Model): """Ssis environment reference. :param id: Environment reference id. @@ -4276,7 +7031,7 @@ class SsisEnvironmentReference(Model): :type environment_folder_name: str :param environment_name: Environment name. :type environment_name: str - :param reference_type: Reference type + :param reference_type: Reference type. :type reference_type: str """ @@ -4287,7 +7042,15 @@ class SsisEnvironmentReference(Model): 'reference_type': {'key': 'referenceType', 'type': 'str'}, } - def __init__(self, *, id: int=None, environment_folder_name: str=None, environment_name: str=None, reference_type: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[int] = None, + environment_folder_name: Optional[str] = None, + environment_name: Optional[str] = None, + reference_type: Optional[str] = None, + **kwargs + ): super(SsisEnvironmentReference, self).__init__(**kwargs) self.id = id self.environment_folder_name = environment_folder_name @@ -4300,14 +7063,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: + "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 type: Required. Constant filled by server. - :type type: str """ _validation = { @@ -4315,24 +7079,30 @@ class SsisFolder(SsisObjectMetadata): } _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, 'id': {'key': 'id', 'type': 'long'}, 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, *, id: int=None, name: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[int] = None, + name: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(SsisFolder, self).__init__(id=id, name=name, description=description, **kwargs) - self.type = 'Folder' + self.type = 'Folder' # type: str -class SsisObjectMetadataListResponse(Model): +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. + :param next_link: The link to the next page of results, if any remaining results exist. :type next_link: str """ @@ -4341,13 +7111,19 @@ class SsisObjectMetadataListResponse(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, *, value=None, next_link: str=None, **kwargs) -> None: + def __init__( + self, + *, + value: Optional[List["SsisObjectMetadata"]] = None, + next_link: Optional[str] = None, + **kwargs + ): super(SsisObjectMetadataListResponse, self).__init__(**kwargs) self.value = value self.next_link = next_link -class SsisObjectMetadataStatusResponse(Model): +class SsisObjectMetadataStatusResponse(msrest.serialization.Model): """The status of the operation. :param status: The status of the operation. @@ -4367,7 +7143,15 @@ class SsisObjectMetadataStatusResponse(Model): 'error': {'key': 'error', 'type': 'str'}, } - def __init__(self, *, status: str=None, name: str=None, properties: str=None, error: str=None, **kwargs) -> None: + def __init__( + self, + *, + status: Optional[str] = None, + name: Optional[str] = None, + properties: Optional[str] = None, + error: Optional[str] = None, + **kwargs + ): super(SsisObjectMetadataStatusResponse, self).__init__(**kwargs) self.status = status self.name = name @@ -4380,21 +7164,22 @@ 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: + "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 type: Required. Constant filled by server. - :type type: 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 + :param parameters: Parameters in package. :type parameters: list[~azure.mgmt.synapse.models.SsisParameter] """ @@ -4403,26 +7188,37 @@ class SsisPackage(SsisObjectMetadata): } _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, 'id': {'key': 'id', 'type': 'long'}, 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'type': {'key': 'type', '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, *, id: int=None, name: str=None, description: str=None, folder_id: int=None, project_version: int=None, project_id: int=None, parameters=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[int] = None, + name: Optional[str] = None, + description: Optional[str] = None, + folder_id: Optional[int] = None, + project_version: Optional[int] = None, + project_id: Optional[int] = None, + parameters: Optional[List["SsisParameter"]] = None, + **kwargs + ): super(SsisPackage, self).__init__(id=id, name=name, description=description, **kwargs) + self.type = 'Package' # type: str self.folder_id = folder_id self.project_version = project_version self.project_id = project_id self.parameters = parameters - self.type = 'Package' -class SsisParameter(Model): +class SsisParameter(msrest.serialization.Model): """Ssis parameter. :param id: Parameter id. @@ -4466,7 +7262,23 @@ class SsisParameter(Model): 'variable': {'key': 'variable', 'type': 'str'}, } - def __init__(self, *, id: int=None, name: str=None, description: str=None, data_type: str=None, required: bool=None, sensitive: bool=None, design_default_value: str=None, default_value: str=None, sensitive_default_value: str=None, value_type: str=None, value_set: bool=None, variable: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[int] = None, + name: Optional[str] = None, + description: Optional[str] = None, + data_type: Optional[str] = None, + required: Optional[bool] = None, + sensitive: Optional[bool] = None, + design_default_value: Optional[str] = None, + default_value: Optional[str] = None, + sensitive_default_value: Optional[str] = None, + value_type: Optional[str] = None, + value_set: Optional[bool] = None, + variable: Optional[str] = None, + **kwargs + ): super(SsisParameter, self).__init__(**kwargs) self.id = id self.name = name @@ -4487,22 +7299,22 @@ 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: + "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 type: Required. Constant filled by server. - :type type: 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 + :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] """ @@ -4511,26 +7323,37 @@ class SsisProject(SsisObjectMetadata): } _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, 'id': {'key': 'id', 'type': 'long'}, 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'type': {'key': 'type', '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, *, id: int=None, name: str=None, description: str=None, folder_id: int=None, version: int=None, environment_refs=None, parameters=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[int] = None, + name: Optional[str] = None, + description: Optional[str] = None, + folder_id: Optional[int] = None, + version: Optional[int] = None, + environment_refs: Optional[List["SsisEnvironmentReference"]] = None, + parameters: Optional[List["SsisParameter"]] = None, + **kwargs + ): super(SsisProject, self).__init__(id=id, name=name, description=description, **kwargs) + self.type = 'Project' # type: str self.folder_id = folder_id self.version = version self.environment_refs = environment_refs self.parameters = parameters - self.type = 'Project' -class SsisVariable(Model): +class SsisVariable(msrest.serialization.Model): """Ssis variable. :param id: Variable id. @@ -4559,7 +7382,18 @@ class SsisVariable(Model): 'sensitive_value': {'key': 'sensitiveValue', 'type': 'str'}, } - def __init__(self, *, id: int=None, name: str=None, description: str=None, data_type: str=None, sensitive: bool=None, value: str=None, sensitive_value: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[int] = None, + name: Optional[str] = None, + description: Optional[str] = None, + data_type: Optional[str] = None, + sensitive: Optional[bool] = None, + value: Optional[str] = None, + sensitive_value: Optional[str] = None, + **kwargs + ): super(SsisVariable, self).__init__(**kwargs) self.id = id self.name = name @@ -4570,37 +7404,66 @@ def __init__(self, *, id: int=None, name: str=None, description: str=None, data_ self.sensitive_value = sensitive_value -class TopQueries(Model): +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 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). + 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: float - :ivar observation_start_time: The start time for queries that are returned - (ISO8601 format) - :vartype observation_start_time: datetime - :ivar observation_end_time: The end time for queries that are returned - (ISO8601 format) - :vartype observation_end_time: 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 + :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] """ @@ -4617,17 +7480,20 @@ class TopQueries(Model): } _attribute_map = { - 'aggregation_function': {'key': 'aggregationFunction', 'type': 'QueryAggregationFunction'}, - 'execution_type': {'key': 'executionType', 'type': 'QueryExecutionType'}, + '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': 'float'}, + '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': 'QueryObservedMetricType'}, + 'observed_metric': {'key': 'observedMetric', 'type': 'str'}, 'queries': {'key': 'queries', 'type': '[QueryStatistic]'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(TopQueries, self).__init__(**kwargs) self.aggregation_function = None self.execution_type = None @@ -4639,7 +7505,7 @@ def __init__(self, **kwargs) -> None: self.queries = None -class TopQueriesListResult(Model): +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. @@ -4656,31 +7522,34 @@ class TopQueriesListResult(Model): 'value': {'key': 'value', 'type': '[TopQueries]'}, } - def __init__(self, *, value, **kwargs) -> None: + def __init__( + self, + *, + value: List["TopQueries"], + **kwargs + ): super(TopQueriesListResult, self).__init__(**kwargs) self.value = value -class TransparentDataEncryption(ProxyResource): +class TransparentDataEncryption(Resource): """Represents a Sql pool transparent data encryption configuration. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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 + :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 = { @@ -4695,21 +7564,55 @@ class TransparentDataEncryption(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'TransparentDataEncryptionStatus'}, + 'status': {'key': 'properties.status', 'type': 'str'}, } - def __init__(self, *, status=None, **kwargs) -> None: + def __init__( + self, + *, + status: Optional[Union[str, "TransparentDataEncryptionStatus"]] = None, + **kwargs + ): super(TransparentDataEncryption, self).__init__(**kwargs) self.location = None self.status = status -class UpdateIntegrationRuntimeNodeRequest(Model): +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. + :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 """ @@ -4721,23 +7624,25 @@ class UpdateIntegrationRuntimeNodeRequest(Model): 'concurrent_jobs_limit': {'key': 'concurrentJobsLimit', 'type': 'int'}, } - def __init__(self, *, concurrent_jobs_limit: int=None, **kwargs) -> None: + def __init__( + self, + *, + concurrent_jobs_limit: Optional[int] = None, + **kwargs + ): super(UpdateIntegrationRuntimeNodeRequest, self).__init__(**kwargs) self.concurrent_jobs_limit = concurrent_jobs_limit -class UpdateIntegrationRuntimeRequest(Model): +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. + :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 """ @@ -4746,16 +7651,22 @@ class UpdateIntegrationRuntimeRequest(Model): 'update_delay_offset': {'key': 'updateDelayOffset', 'type': 'str'}, } - def __init__(self, *, auto_update=None, update_delay_offset: str=None, **kwargs) -> None: + def __init__( + self, + *, + auto_update: Optional[Union[str, "IntegrationRuntimeAutoUpdate"]] = None, + update_delay_offset: Optional[str] = None, + **kwargs + ): super(UpdateIntegrationRuntimeRequest, self).__init__(**kwargs) self.auto_update = auto_update self.update_delay_offset = update_delay_offset -class VirtualNetworkProfile(Model): +class VirtualNetworkProfile(msrest.serialization.Model): """Virtual Network Profile. - :param compute_subnet_id: Subnet ID used for computes in workspace + :param compute_subnet_id: Subnet ID used for computes in workspace. :type compute_subnet_id: str """ @@ -4763,22 +7674,25 @@ class VirtualNetworkProfile(Model): 'compute_subnet_id': {'key': 'computeSubnetId', 'type': 'str'}, } - def __init__(self, *, compute_subnet_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + compute_subnet_id: Optional[str] = None, + **kwargs + ): super(VirtualNetworkProfile, self).__init__(**kwargs) self.compute_subnet_id = compute_subnet_id -class VulnerabilityAssessmentRecurringScansProperties(Model): +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. Default - value: True . + :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. + :param emails: Specifies an array of e-mail addresses to which the scan notification is sent. :type emails: list[str] """ @@ -4788,18 +7702,24 @@ class VulnerabilityAssessmentRecurringScansProperties(Model): 'emails': {'key': 'emails', 'type': '[str]'}, } - def __init__(self, *, is_enabled: bool=None, email_subscription_admins: bool=True, emails=None, **kwargs) -> None: + def __init__( + self, + *, + is_enabled: Optional[bool] = None, + email_subscription_admins: Optional[bool] = True, + emails: Optional[List[str]] = None, + **kwargs + ): super(VulnerabilityAssessmentRecurringScansProperties, self).__init__(**kwargs) self.is_enabled = is_enabled self.email_subscription_admins = email_subscription_admins self.emails = emails -class VulnerabilityAssessmentScanError(Model): +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. + Variables are only populated by the server, and will be ignored when sending a request. :ivar code: The error code. :vartype code: str @@ -4817,47 +7737,44 @@ class VulnerabilityAssessmentScanError(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(VulnerabilityAssessmentScanError, self).__init__(**kwargs) self.code = None self.message = None -class VulnerabilityAssessmentScanRecord(ProxyResource): +class VulnerabilityAssessmentScanRecord(Resource): """A vulnerability assessment scan record. - Variables are only populated by the server, and will be ignored when - sending a request. + 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} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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 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 + :vartype start_time: ~datetime.datetime :ivar end_time: The scan end time (UTC). - :vartype end_time: datetime + :vartype end_time: ~datetime.datetime :ivar errors: The scan errors. - :vartype errors: - list[~azure.mgmt.synapse.models.VulnerabilityAssessmentScanError] + :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. + :ivar number_of_failed_security_checks: The number of failed security checks. :vartype number_of_failed_security_checks: int """ @@ -4889,7 +7806,10 @@ class VulnerabilityAssessmentScanRecord(ProxyResource): 'number_of_failed_security_checks': {'key': 'properties.numberOfFailedSecurityChecks', 'type': 'int'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(VulnerabilityAssessmentScanRecord, self).__init__(**kwargs) self.scan_id = None self.trigger_type = None @@ -4901,54 +7821,283 @@ def __init__(self, **kwargs) -> 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(Resource): + """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, + *, + member_name: Optional[str] = None, + label: Optional[str] = None, + context: Optional[str] = None, + start_time: Optional[str] = None, + end_time: Optional[str] = None, + importance: Optional[str] = None, + **kwargs + ): + super(WorkloadClassifier, self).__init__(**kwargs) + self.member_name = member_name + self.label = label + self.context = context + self.start_time = start_time + self.end_time = end_time + self.importance = importance + + +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(Resource): + """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, + *, + min_resource_percent: Optional[int] = None, + max_resource_percent: Optional[int] = None, + min_resource_percent_per_request: Optional[float] = None, + max_resource_percent_per_request: Optional[float] = None, + importance: Optional[str] = None, + query_execution_timeout: Optional[int] = None, + **kwargs + ): + super(WorkloadGroup, self).__init__(**kwargs) + self.min_resource_percent = min_resource_percent + self.max_resource_percent = max_resource_percent + self.min_resource_percent_per_request = min_resource_percent_per_request + self.max_resource_percent_per_request = max_resource_percent_per_request + self.importance = importance + self.query_execution_timeout = query_execution_timeout + + +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. + Variables are only 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} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: Resource tags. + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives + :param location: Required. The geo-location where the resource lives. :type location: str - :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 + :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 - :ivar managed_resource_group_name: Workspace managed resource group - :vartype managed_resource_group_name: str - :ivar provisioning_state: Resource provisioning state + :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 + :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 + :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. + :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 identity: Identity of the workspace - :type identity: ~azure.mgmt.synapse.models.ManagedIdentity + :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, object] + :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 """ _validation = { @@ -4956,8 +8105,9 @@ class Workspace(TrackedResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'managed_resource_group_name': {'readonly': True}, 'provisioning_state': {'readonly': True}, + 'workspace_uid': {'readonly': True}, + 'extra_properties': {'readonly': True}, } _attribute_map = { @@ -4966,6 +8116,7 @@ class Workspace(TrackedResource): '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'}, @@ -4975,45 +8126,73 @@ class Workspace(TrackedResource): 'connectivity_endpoints': {'key': 'properties.connectivityEndpoints', 'type': '{str}'}, 'managed_virtual_network': {'key': 'properties.managedVirtualNetwork', 'type': 'str'}, 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, - 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, - } - - def __init__(self, *, location: str, tags=None, default_data_lake_storage=None, sql_administrator_login_password: str=None, sql_administrator_login: str=None, virtual_network_profile=None, connectivity_endpoints=None, managed_virtual_network: str=None, private_endpoint_connections=None, identity=None, **kwargs) -> None: + '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'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional["ManagedIdentity"] = None, + default_data_lake_storage: Optional["DataLakeStorageAccountDetails"] = None, + sql_administrator_login_password: Optional[str] = None, + managed_resource_group_name: Optional[str] = None, + sql_administrator_login: Optional[str] = None, + virtual_network_profile: Optional["VirtualNetworkProfile"] = None, + connectivity_endpoints: Optional[Dict[str, str]] = None, + managed_virtual_network: Optional[str] = None, + private_endpoint_connections: Optional[List["PrivateEndpointConnection"]] = None, + encryption: Optional["EncryptionDetails"] = None, + managed_virtual_network_settings: Optional["ManagedVirtualNetworkSettings"] = None, + workspace_repository_configuration: Optional["WorkspaceRepositoryConfiguration"] = None, + purview_configuration: Optional["PurviewConfiguration"] = None, + **kwargs + ): super(Workspace, self).__init__(tags=tags, location=location, **kwargs) + self.identity = identity self.default_data_lake_storage = default_data_lake_storage self.sql_administrator_login_password = sql_administrator_login_password - self.managed_resource_group_name = None + self.managed_resource_group_name = managed_resource_group_name self.provisioning_state = None self.sql_administrator_login = sql_administrator_login self.virtual_network_profile = virtual_network_profile self.connectivity_endpoints = connectivity_endpoints self.managed_virtual_network = managed_virtual_network self.private_endpoint_connections = private_endpoint_connections - self.identity = identity + self.encryption = encryption + self.workspace_uid = None + self.extra_properties = None + self.managed_virtual_network_settings = managed_virtual_network_settings + self.workspace_repository_configuration = workspace_repository_configuration + self.purview_configuration = purview_configuration -class WorkspaceAadAdminInfo(ProxyResource): +class WorkspaceAadAdminInfo(Resource): """Workspace active directory administrator. - Variables are only populated by the server, and will be ignored when - sending a request. + 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} + :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 + :ivar name: The name of the resource. :vartype name: str - :ivar type: The type of the resource. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :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 + :param tenant_id: Tenant ID of the workspace active directory administrator. :type tenant_id: str - :param login: Login of the workspace active directory administrator + :param login: Login of the workspace active directory administrator. :type login: str - :param administrator_type: Workspace active directory administrator type + :param administrator_type: Workspace active directory administrator type. :type administrator_type: str - :param sid: Object ID of the workspace active directory administrator + :param sid: Object ID of the workspace active directory administrator. :type sid: str """ @@ -5033,7 +8212,15 @@ class WorkspaceAadAdminInfo(ProxyResource): 'sid': {'key': 'properties.sid', 'type': 'str'}, } - def __init__(self, *, tenant_id: str=None, login: str=None, administrator_type: str=None, sid: str=None, **kwargs) -> None: + def __init__( + self, + *, + tenant_id: Optional[str] = None, + login: Optional[str] = None, + administrator_type: Optional[str] = None, + sid: Optional[str] = None, + **kwargs + ): super(WorkspaceAadAdminInfo, self).__init__(**kwargs) self.tenant_id = tenant_id self.login = login @@ -5041,19 +8228,78 @@ def __init__(self, *, tenant_id: str=None, login: str=None, administrator_type: self.sid = sid -class WorkspacePatchInfo(Model): +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, + *, + next_link: Optional[str] = None, + value: Optional[List["Workspace"]] = None, + **kwargs + ): + super(WorkspaceInfoListResult, self).__init__(**kwargs) + self.next_link = next_link + self.value = value + + +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, + *, + name: Optional[str] = None, + key_vault_url: Optional[str] = None, + **kwargs + ): + super(WorkspaceKeyDetails, self).__init__(**kwargs) + self.name = name + self.key_vault_url = key_vault_url + + +class WorkspacePatchInfo(msrest.serialization.Model): """Workspace patch details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :param tags: Resource tags + :param tags: A set of tags. Resource tags. :type tags: dict[str, str] - :param identity: The identity of the workspace + :param identity: The identity of the workspace. :type identity: ~azure.mgmt.synapse.models.ManagedIdentity - :param sql_administrator_login_password: SQL administrator login password + :param sql_administrator_login_password: SQL administrator login password. :type sql_administrator_login_password: str - :ivar provisioning_state: Resource provisioning state + :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 """ @@ -5065,12 +8311,80 @@ class WorkspacePatchInfo(Model): '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'}, } - def __init__(self, *, tags=None, identity=None, sql_administrator_login_password: str=None, **kwargs) -> None: + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + identity: Optional["ManagedIdentity"] = None, + sql_administrator_login_password: Optional[str] = None, + managed_virtual_network_settings: Optional["ManagedVirtualNetworkSettings"] = None, + workspace_repository_configuration: Optional["WorkspaceRepositoryConfiguration"] = None, + purview_configuration: Optional["PurviewConfiguration"] = None, + **kwargs + ): super(WorkspacePatchInfo, self).__init__(**kwargs) self.tags = tags self.identity = identity self.sql_administrator_login_password = sql_administrator_login_password + self.managed_virtual_network_settings = managed_virtual_network_settings + self.workspace_repository_configuration = workspace_repository_configuration + self.purview_configuration = purview_configuration self.provisioning_state = 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 + """ + + _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'}, + } + + def __init__( + self, + *, + type: Optional[str] = None, + host_name: Optional[str] = None, + account_name: Optional[str] = None, + project_name: Optional[str] = None, + repository_name: Optional[str] = None, + collaboration_branch: Optional[str] = None, + root_folder: Optional[str] = None, + **kwargs + ): + super(WorkspaceRepositoryConfiguration, self).__init__(**kwargs) + self.type = type + self.host_name = host_name + self.account_name = account_name + self.project_name = project_name + self.repository_name = repository_name + self.collaboration_branch = collaboration_branch + self.root_folder = root_folder diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_paged_models.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_paged_models.py deleted file mode 100644 index 417b2a90b80a..000000000000 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/_paged_models.py +++ /dev/null @@ -1,235 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class BigDataPoolResourceInfoPaged(Paged): - """ - A paging container for iterating over a list of :class:`BigDataPoolResourceInfo ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[BigDataPoolResourceInfo]'} - } - - def __init__(self, *args, **kwargs): - - super(BigDataPoolResourceInfoPaged, self).__init__(*args, **kwargs) -class IpFirewallRuleInfoPaged(Paged): - """ - A paging container for iterating over a list of :class:`IpFirewallRuleInfo ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[IpFirewallRuleInfo]'} - } - - def __init__(self, *args, **kwargs): - - super(IpFirewallRuleInfoPaged, self).__init__(*args, **kwargs) -class SqlPoolPaged(Paged): - """ - A paging container for iterating over a list of :class:`SqlPool ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SqlPool]'} - } - - def __init__(self, *args, **kwargs): - - super(SqlPoolPaged, self).__init__(*args, **kwargs) -class RestorePointPaged(Paged): - """ - A paging container for iterating over a list of :class:`RestorePoint ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[RestorePoint]'} - } - - def __init__(self, *args, **kwargs): - - super(RestorePointPaged, self).__init__(*args, **kwargs) -class ReplicationLinkPaged(Paged): - """ - A paging container for iterating over a list of :class:`ReplicationLink ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ReplicationLink]'} - } - - def __init__(self, *args, **kwargs): - - super(ReplicationLinkPaged, self).__init__(*args, **kwargs) -class SqlPoolOperationPaged(Paged): - """ - A paging container for iterating over a list of :class:`SqlPoolOperation ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SqlPoolOperation]'} - } - - def __init__(self, *args, **kwargs): - - super(SqlPoolOperationPaged, self).__init__(*args, **kwargs) -class SqlPoolUsagePaged(Paged): - """ - A paging container for iterating over a list of :class:`SqlPoolUsage ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SqlPoolUsage]'} - } - - def __init__(self, *args, **kwargs): - - super(SqlPoolUsagePaged, self).__init__(*args, **kwargs) -class SensitivityLabelPaged(Paged): - """ - A paging container for iterating over a list of :class:`SensitivityLabel ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SensitivityLabel]'} - } - - def __init__(self, *args, **kwargs): - - super(SensitivityLabelPaged, self).__init__(*args, **kwargs) -class SqlPoolSchemaPaged(Paged): - """ - A paging container for iterating over a list of :class:`SqlPoolSchema ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SqlPoolSchema]'} - } - - def __init__(self, *args, **kwargs): - - super(SqlPoolSchemaPaged, self).__init__(*args, **kwargs) -class SqlPoolTablePaged(Paged): - """ - A paging container for iterating over a list of :class:`SqlPoolTable ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SqlPoolTable]'} - } - - def __init__(self, *args, **kwargs): - - super(SqlPoolTablePaged, self).__init__(*args, **kwargs) -class SqlPoolColumnPaged(Paged): - """ - A paging container for iterating over a list of :class:`SqlPoolColumn ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SqlPoolColumn]'} - } - - def __init__(self, *args, **kwargs): - - super(SqlPoolColumnPaged, self).__init__(*args, **kwargs) -class SqlPoolVulnerabilityAssessmentPaged(Paged): - """ - A paging container for iterating over a list of :class:`SqlPoolVulnerabilityAssessment ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SqlPoolVulnerabilityAssessment]'} - } - - def __init__(self, *args, **kwargs): - - super(SqlPoolVulnerabilityAssessmentPaged, self).__init__(*args, **kwargs) -class VulnerabilityAssessmentScanRecordPaged(Paged): - """ - A paging container for iterating over a list of :class:`VulnerabilityAssessmentScanRecord ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[VulnerabilityAssessmentScanRecord]'} - } - - def __init__(self, *args, **kwargs): - - super(VulnerabilityAssessmentScanRecordPaged, self).__init__(*args, **kwargs) -class WorkspacePaged(Paged): - """ - A paging container for iterating over a list of :class:`Workspace ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Workspace]'} - } - - def __init__(self, *args, **kwargs): - - super(WorkspacePaged, self).__init__(*args, **kwargs) -class IntegrationRuntimeResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`IntegrationRuntimeResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[IntegrationRuntimeResource]'} - } - - def __init__(self, *args, **kwargs): - - super(IntegrationRuntimeResourcePaged, self).__init__(*args, **kwargs) -class PrivateLinkResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`PrivateLinkResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[PrivateLinkResource]'} - } - - def __init__(self, *args, **kwargs): - - super(PrivateLinkResourcePaged, self).__init__(*args, **kwargs) -class PrivateEndpointConnectionPaged(Paged): - """ - A paging container for iterating over a list of :class:`PrivateEndpointConnection ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[PrivateEndpointConnection]'} - } - - def __init__(self, *args, **kwargs): - - super(PrivateEndpointConnectionPaged, self).__init__(*args, **kwargs) 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 8d1c0055e1d7..1bc3a730c0fc 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 @@ -1,304 +1,441 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class BlobAuditingPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + DEFAULT = "default" + +class BlobAuditingPolicyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the state of the policy. If state is Enabled, storageEndpoint or + isAzureMonitorTargetEnabled are required. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class ColumnDataType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The column data type. + """ + + IMAGE = "image" + TEXT = "text" + UNIQUEIDENTIFIER = "uniqueidentifier" + DATE = "date" + TIME = "time" + DATETIME2 = "datetime2" + DATETIMEOFFSET = "datetimeoffset" + TINYINT = "tinyint" + SMALLINT = "smallint" + INT = "int" + SMALLDATETIME = "smalldatetime" + REAL = "real" + MONEY = "money" + DATETIME = "datetime" + FLOAT = "float" + SQL_VARIANT = "sql_variant" + NTEXT = "ntext" + BIT = "bit" + DECIMAL = "decimal" + NUMERIC = "numeric" + SMALLMONEY = "smallmoney" + BIGINT = "bigint" + HIERARCHYID = "hierarchyid" + GEOMETRY = "geometry" + GEOGRAPHY = "geography" + VARBINARY = "varbinary" + VARCHAR = "varchar" + BINARY = "binary" + CHAR = "char" + TIMESTAMP = "timestamp" + NVARCHAR = "nvarchar" + NCHAR = "nchar" + XML = "xml" + SYSNAME = "sysname" + +class ConnectionPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + DEFAULT = "default" + +class DataFlowComputeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Compute type of the cluster which will execute data flow job. + """ + + GENERAL = "General" + MEMORY_OPTIMIZED = "MemoryOptimized" + COMPUTE_OPTIMIZED = "ComputeOptimized" + +class DataMaskingFunction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The masking function that is used for the data masking rule. + """ + + DEFAULT = "Default" + CCN = "CCN" + EMAIL = "Email" + NUMBER = "Number" + SSN = "SSN" + TEXT = "Text" + +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 + the provided value of ruleState. + """ + + DISABLED = "Disabled" + ENABLED = "Enabled" + +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)): + + CURRENT = "current" + +class GeoBackupPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + DEFAULT = "Default" + +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)): + """The name of the authentication key to regenerate. + """ + + AUTH_KEY1 = "authKey1" + AUTH_KEY2 = "authKey2" + +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)): + """The edition for the SSIS Integration Runtime + """ + + STANDARD = "Standard" + ENTERPRISE = "Enterprise" + +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)): + """It is used to set the encryption mode for node-node communication channel (when more than 2 + self-hosted integration runtime nodes exist). + """ + + NOT_SET = "NotSet" + SSL_ENCRYPTED = "SslEncrypted" + NOT_ENCRYPTED = "NotEncrypted" + +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)): + """The pricing tier for the catalog database. The valid values could be found in + https://azure.microsoft.com/en-us/pricing/details/sql-database/ + """ + + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + PREMIUM_RS = "PremiumRS" + +class IntegrationRuntimeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The state of integration runtime. + """ + + INITIAL = "Initial" + STOPPED = "Stopped" + STARTED = "Started" + STARTING = "Starting" + STOPPING = "Stopping" + NEED_REGISTRATION = "NeedRegistration" + ONLINE = "Online" + LIMITED = "Limited" + OFFLINE = "Offline" + ACCESS_DENIED = "AccessDenied" + +class IntegrationRuntimeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of integration runtime. + """ + + MANAGED = "Managed" + SELF_HOSTED = "SelfHosted" + +class IntegrationRuntimeUpdateResult(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The result of the last integration runtime node update. + """ + + NONE = "None" + SUCCEED = "Succeed" + FAIL = "Fail" + +class ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentityActualState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Actual state + """ + + ENABLING = "Enabling" + ENABLED = "Enabled" + DISABLING = "Disabling" + DISABLED = "Disabled" + UNKNOWN = "Unknown" + +class ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentityDesiredState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Desired state + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class ManagedIntegrationRuntimeNodeStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The managed integration runtime node status. + """ + + STARTING = "Starting" + AVAILABLE = "Available" + RECYCLING = "Recycling" + UNAVAILABLE = "Unavailable" + +class ManagementOperationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The operation state. + """ + + PENDING = "Pending" + IN_PROGRESS = "InProgress" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCEL_IN_PROGRESS = "CancelInProgress" + CANCELLED = "Cancelled" + +class NodeSize(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The level of compute power that each node in the Big Data pool has. + """ + + NONE = "None" + SMALL = "Small" + MEDIUM = "Medium" + LARGE = "Large" + X_LARGE = "XLarge" + XX_LARGE = "XXLarge" + XXX_LARGE = "XXXLarge" + +class NodeSizeFamily(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The kind of nodes that the Big Data pool provides. + """ + + NONE = "None" + MEMORY_OPTIMIZED = "MemoryOptimized" + +class OperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Operation status + """ + + IN_PROGRESS = "InProgress" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Resource provisioning state + """ + + PROVISIONING = "Provisioning" + SUCCEEDED = "Succeeded" + DELETING = "Deleting" + FAILED = "Failed" + DELETE_ERROR = "DeleteError" + +class QueryAggregationFunction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The function that is used to aggregate each query's metrics. + """ + + MIN = "min" + MAX = "max" + AVG = "avg" + SUM = "sum" + +class QueryExecutionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The execution type that is used to filter the query instances that are returned. + """ + + ANY = "any" + REGULAR = "regular" + IRREGULAR = "irregular" + ABORTED = "aborted" + EXCEPTION = "exception" + +class QueryMetricUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The unit of measurement + """ + + PERCENTAGE = "percentage" + KB = "KB" + MICROSECONDS = "microseconds" + +class QueryObservedMetricType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of metric to use for ordering the top metrics. + """ -class NodeSize(str, Enum): + CPU = "cpu" + IO = "io" + LOGIO = "logio" + DURATION = "duration" + EXECUTION_COUNT = "executionCount" - none = "None" - small = "Small" - medium = "Medium" - large = "Large" +class ReplicationRole(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The role of the Sql pool in the replication link. + """ + PRIMARY = "Primary" + SECONDARY = "Secondary" + NON_READABLE_SECONDARY = "NonReadableSecondary" + SOURCE = "Source" + COPY = "Copy" -class NodeSizeFamily(str, Enum): +class ReplicationState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The replication state for the replication link. + """ - none = "None" - memory_optimized = "MemoryOptimized" + PENDING = "PENDING" + SEEDING = "SEEDING" + CATCH_UP = "CATCH_UP" + SUSPENDED = "SUSPENDED" +class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of managed identity for the workspace + """ -class ProvisioningState(str, Enum): + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" - provisioning = "Provisioning" - succeeded = "Succeeded" - deleting = "Deleting" - failed = "Failed" - delete_error = "DeleteError" +class RestorePointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of restore point + """ + CONTINUOUS = "CONTINUOUS" + DISCRETE = "DISCRETE" -class OperationStatus(str, Enum): +class SecurityAlertPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - in_progress = "InProgress" - succeeded = "Succeeded" - failed = "Failed" - canceled = "Canceled" + DEFAULT = "default" +class SecurityAlertPolicyNameAutoGenerated(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): -class GeoBackupPolicyState(str, Enum): + DEFAULT = "Default" - disabled = "Disabled" - enabled = "Enabled" +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. + """ + NEW = "New" + ENABLED = "Enabled" + DISABLED = "Disabled" -class QueryAggregationFunction(str, Enum): +class SelfHostedIntegrationRuntimeNodeStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status of the integration runtime node. + """ - min = "min" - max = "max" - avg = "avg" - sum = "sum" + NEED_REGISTRATION = "NeedRegistration" + ONLINE = "Online" + LIMITED = "Limited" + OFFLINE = "Offline" + UPGRADING = "Upgrading" + INITIALIZING = "Initializing" + INITIALIZE_FAILED = "InitializeFailed" +class SensitivityLabelSource(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): -class QueryExecutionType(str, Enum): + CURRENT = "current" + RECOMMENDED = "recommended" - any = "any" - regular = "regular" - irregular = "irregular" - aborted = "aborted" - exception = "exception" +class SsisObjectMetadataType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of SSIS object metadata. + """ + FOLDER = "Folder" + PROJECT = "Project" + PACKAGE = "Package" + ENVIRONMENT = "Environment" -class QueryObservedMetricType(str, Enum): +class TransparentDataEncryptionName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - cpu = "cpu" - io = "io" - logio = "logio" - duration = "duration" - execution_count = "executionCount" + CURRENT = "current" +class TransparentDataEncryptionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The status of the database transparent data encryption. + """ -class QueryMetricUnit(str, Enum): + ENABLED = "Enabled" + DISABLED = "Disabled" - percentage = "percentage" - kb = "KB" - microseconds = "microseconds" +class VulnerabilityAssessmentName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + DEFAULT = "default" -class RestorePointType(str, Enum): +class VulnerabilityAssessmentPolicyBaselineName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - continuous = "CONTINUOUS" - discrete = "DISCRETE" + MASTER = "master" + DEFAULT = "default" +class VulnerabilityAssessmentScanState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The scan status. + """ -class ReplicationRole(str, Enum): + PASSED = "Passed" + FAILED = "Failed" + FAILED_TO_RUN = "FailedToRun" + IN_PROGRESS = "InProgress" - primary = "Primary" - secondary = "Secondary" - non_readable_secondary = "NonReadableSecondary" - source = "Source" - copy = "Copy" +class VulnerabilityAssessmentScanTriggerType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The scan trigger type. + """ - -class ReplicationState(str, Enum): - - pending = "PENDING" - seeding = "SEEDING" - catch_up = "CATCH_UP" - suspended = "SUSPENDED" - - -class TransparentDataEncryptionStatus(str, Enum): - - enabled = "Enabled" - disabled = "Disabled" - - -class BlobAuditingPolicyState(str, Enum): - - enabled = "Enabled" - disabled = "Disabled" - - -class ManagementOperationState(str, Enum): - - pending = "Pending" - in_progress = "InProgress" - succeeded = "Succeeded" - failed = "Failed" - cancel_in_progress = "CancelInProgress" - cancelled = "Cancelled" - - -class ColumnDataType(str, Enum): - - image = "image" - text = "text" - uniqueidentifier = "uniqueidentifier" - date_enum = "date" - time = "time" - datetime2 = "datetime2" - datetimeoffset = "datetimeoffset" - tinyint = "tinyint" - smallint = "smallint" - int_enum = "int" - smalldatetime = "smalldatetime" - real = "real" - money = "money" - datetime_enum = "datetime" - float_enum = "float" - sql_variant = "sql_variant" - ntext = "ntext" - bit = "bit" - decimal_enum = "decimal" - numeric = "numeric" - smallmoney = "smallmoney" - bigint = "bigint" - hierarchyid = "hierarchyid" - geometry = "geometry" - geography = "geography" - varbinary = "varbinary" - varchar = "varchar" - binary = "binary" - char = "char" - timestamp = "timestamp" - nvarchar = "nvarchar" - nchar = "nchar" - xml = "xml" - sysname = "sysname" - - -class VulnerabilityAssessmentScanTriggerType(str, Enum): - - on_demand = "OnDemand" - recurring = "Recurring" - - -class VulnerabilityAssessmentScanState(str, Enum): - - passed = "Passed" - failed = "Failed" - failed_to_run = "FailedToRun" - in_progress = "InProgress" - - -class SecurityAlertPolicyState(str, Enum): - - new = "New" - enabled = "Enabled" - disabled = "Disabled" - - -class ResourceIdentityType(str, Enum): - - none = "None" - system_assigned = "SystemAssigned" - - -class IntegrationRuntimeType(str, Enum): - - managed = "Managed" - self_hosted = "SelfHosted" - - -class IntegrationRuntimeState(str, Enum): - - initial = "Initial" - stopped = "Stopped" - started = "Started" - starting = "Starting" - stopping = "Stopping" - need_registration = "NeedRegistration" - online = "Online" - limited = "Limited" - offline = "Offline" - access_denied = "AccessDenied" - - -class DataFlowComputeType(str, Enum): - - general = "General" - memory_optimized = "MemoryOptimized" - compute_optimized = "ComputeOptimized" - - -class IntegrationRuntimeSsisCatalogPricingTier(str, Enum): - - basic = "Basic" - standard = "Standard" - premium = "Premium" - premium_rs = "PremiumRS" - - -class IntegrationRuntimeLicenseType(str, Enum): - - base_price = "BasePrice" - license_included = "LicenseIncluded" - - -class IntegrationRuntimeEntityReferenceType(str, Enum): - - integration_runtime_reference = "IntegrationRuntimeReference" - linked_service_reference = "LinkedServiceReference" - - -class IntegrationRuntimeEdition(str, Enum): - - standard = "Standard" - enterprise = "Enterprise" - - -class ManagedIntegrationRuntimeNodeStatus(str, Enum): - - starting = "Starting" - available = "Available" - recycling = "Recycling" - unavailable = "Unavailable" - - -class IntegrationRuntimeInternalChannelEncryptionMode(str, Enum): - - not_set = "NotSet" - ssl_encrypted = "SslEncrypted" - not_encrypted = "NotEncrypted" - - -class SelfHostedIntegrationRuntimeNodeStatus(str, Enum): - - need_registration = "NeedRegistration" - online = "Online" - limited = "Limited" - offline = "Offline" - upgrading = "Upgrading" - initializing = "Initializing" - initialize_failed = "InitializeFailed" - - -class IntegrationRuntimeUpdateResult(str, Enum): - - none = "None" - succeed = "Succeed" - fail = "Fail" - - -class IntegrationRuntimeAutoUpdate(str, Enum): - - on = "On" - off = "Off" - - -class IntegrationRuntimeAuthKeyName(str, Enum): - - auth_key1 = "authKey1" - auth_key2 = "authKey2" - - -class SsisObjectMetadataType(str, Enum): - - folder = "Folder" - project = "Project" - package = "Package" - environment = "Environment" - - -class VulnerabilityAssessmentPolicyBaselineName(str, Enum): - - master = "master" - default = "default" + ON_DEMAND = "OnDemand" + RECURRING = "Recurring" diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/__init__.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/__init__.py index 8a97c895a402..8f8384a9e253 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/__init__.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/__init__.py @@ -1,12 +1,9 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from ._big_data_pools_operations import BigDataPoolsOperations @@ -21,7 +18,7 @@ from ._sql_pool_replication_links_operations import SqlPoolReplicationLinksOperations from ._sql_pool_transparent_data_encryptions_operations import SqlPoolTransparentDataEncryptionsOperations from ._sql_pool_blob_auditing_policies_operations import SqlPoolBlobAuditingPoliciesOperations -from ._sql_pool_operations import SqlPoolOperations +from ._sql_pool_operations_operations import SqlPoolOperationsOperations from ._sql_pool_usages_operations import SqlPoolUsagesOperations from ._sql_pool_sensitivity_labels_operations import SqlPoolSensitivityLabelsOperations from ._sql_pool_schemas_operations import SqlPoolSchemasOperations @@ -32,9 +29,17 @@ from ._sql_pool_vulnerability_assessment_scans_operations import SqlPoolVulnerabilityAssessmentScansOperations from ._sql_pool_security_alert_policies_operations import SqlPoolSecurityAlertPoliciesOperations from ._sql_pool_vulnerability_assessment_rule_baselines_operations import SqlPoolVulnerabilityAssessmentRuleBaselinesOperations +from ._extended_sql_pool_blob_auditing_policies_operations import ExtendedSqlPoolBlobAuditingPoliciesOperations +from ._data_masking_policies_operations import DataMaskingPoliciesOperations +from ._data_masking_rules_operations import DataMaskingRulesOperations +from ._sql_pool_columns_operations import SqlPoolColumnsOperations +from ._sql_pool_workload_group_operations import SqlPoolWorkloadGroupOperations +from ._sql_pool_workload_classifier_operations import SqlPoolWorkloadClassifierOperations from ._workspaces_operations import WorkspacesOperations from ._workspace_aad_admins_operations import WorkspaceAadAdminsOperations +from ._workspace_sql_aad_admins_operations import WorkspaceSqlAadAdminsOperations from ._workspace_managed_identity_sql_control_settings_operations import WorkspaceManagedIdentitySqlControlSettingsOperations +from ._restorable_dropped_sql_pools_operations import RestorableDroppedSqlPoolsOperations from ._integration_runtimes_operations import IntegrationRuntimesOperations from ._integration_runtime_node_ip_address_operations import IntegrationRuntimeNodeIpAddressOperations from ._integration_runtime_object_metadata_operations import IntegrationRuntimeObjectMetadataOperations @@ -46,6 +51,15 @@ from ._integration_runtime_status_operations import IntegrationRuntimeStatusOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_hubs_operations import PrivateLinkHubsOperations +from ._private_endpoint_connections_private_link_hub_operations import PrivateEndpointConnectionsPrivateLinkHubOperations +from ._workspace_managed_sql_server_blob_auditing_policies_operations import WorkspaceManagedSqlServerBlobAuditingPoliciesOperations +from ._workspace_managed_sql_server_extended_blob_auditing_policies_operations import WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations +from ._workspace_managed_sql_server_security_alert_policy_operations import WorkspaceManagedSqlServerSecurityAlertPolicyOperations +from ._workspace_managed_sql_server_vulnerability_assessments_operations import WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations +from ._workspace_managed_sql_server_usages_operations import WorkspaceManagedSqlServerUsagesOperations +from ._workspace_managed_sql_server_recoverable_sqlpools_operations import WorkspaceManagedSqlServerRecoverableSqlpoolsOperations +from ._keys_operations import KeysOperations __all__ = [ 'BigDataPoolsOperations', @@ -60,7 +74,7 @@ 'SqlPoolReplicationLinksOperations', 'SqlPoolTransparentDataEncryptionsOperations', 'SqlPoolBlobAuditingPoliciesOperations', - 'SqlPoolOperations', + 'SqlPoolOperationsOperations', 'SqlPoolUsagesOperations', 'SqlPoolSensitivityLabelsOperations', 'SqlPoolSchemasOperations', @@ -71,9 +85,17 @@ 'SqlPoolVulnerabilityAssessmentScansOperations', 'SqlPoolSecurityAlertPoliciesOperations', 'SqlPoolVulnerabilityAssessmentRuleBaselinesOperations', + 'ExtendedSqlPoolBlobAuditingPoliciesOperations', + 'DataMaskingPoliciesOperations', + 'DataMaskingRulesOperations', + 'SqlPoolColumnsOperations', + 'SqlPoolWorkloadGroupOperations', + 'SqlPoolWorkloadClassifierOperations', 'WorkspacesOperations', 'WorkspaceAadAdminsOperations', + 'WorkspaceSqlAadAdminsOperations', 'WorkspaceManagedIdentitySqlControlSettingsOperations', + 'RestorableDroppedSqlPoolsOperations', 'IntegrationRuntimesOperations', 'IntegrationRuntimeNodeIpAddressOperations', 'IntegrationRuntimeObjectMetadataOperations', @@ -85,4 +107,13 @@ 'IntegrationRuntimeStatusOperations', 'PrivateLinkResourcesOperations', 'PrivateEndpointConnectionsOperations', + 'PrivateLinkHubsOperations', + 'PrivateEndpointConnectionsPrivateLinkHubOperations', + 'WorkspaceManagedSqlServerBlobAuditingPoliciesOperations', + 'WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations', + 'WorkspaceManagedSqlServerSecurityAlertPolicyOperations', + 'WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations', + 'WorkspaceManagedSqlServerUsagesOperations', + 'WorkspaceManagedSqlServerRecoverableSqlpoolsOperations', + 'KeysOperations', ] 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 026fb9921e96..030abb3371ed 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 @@ -1,470 +1,544 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +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]] class BigDataPoolsOperations(object): """BigDataPoolsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, workspace_name, big_data_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + big_data_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.BigDataPoolResourceInfo" """Get Big Data pool. Get a Big Data pool. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param big_data_pool_name: Big Data pool name + :param big_data_pool_name: Big Data pool name. :type big_data_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BigDataPoolResourceInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.BigDataPoolResourceInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorContractException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BigDataPoolResourceInfo, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.BigDataPoolResourceInfo + :raises: ~azure.core.exceptions.HttpResponseError """ + 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 = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'bigDataPoolName': self._serialize.url("big_data_pool_name", big_data_pool_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ErrorContractException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BigDataPoolResourceInfo', response) + deserialized = self._deserialize('BigDataPoolResourceInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} # type: ignore def update( - self, resource_group_name, workspace_name, big_data_pool_name, tags=None, custom_headers=None, raw=False, **operation_config): + 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" """Update a Big Data pool. Patch a Big Data pool. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param big_data_pool_name: Big Data pool name + :param big_data_pool_name: Big Data pool name. :type big_data_pool_name: str - :param tags: Updated tags for the Big Data pool - :type tags: dict[str, str] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: BigDataPoolResourceInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.BigDataPoolResourceInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorContractException` + :param big_data_pool_patch_info: The updated Big Data pool properties. + :type big_data_pool_patch_info: ~azure.mgmt.synapse.models.BigDataPoolPatchInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BigDataPoolResourceInfo, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.BigDataPoolResourceInfo + :raises: ~azure.core.exceptions.HttpResponseError """ - big_data_pool_patch_info = models.BigDataPoolPatchInfo(tags=tags) + 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 = "2019-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'bigDataPoolName': self._serialize.url("big_data_pool_name", big_data_pool_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(big_data_pool_patch_info, 'BigDataPoolPatchInfo') + 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') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ErrorContractException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BigDataPoolResourceInfo', response) + deserialized = self._deserialize('BigDataPoolResourceInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} - + 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, workspace_name, big_data_pool_name, big_data_pool_info, force=False, custom_headers=None, raw=False, **operation_config): + 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" + 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 = "2019-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create_or_update.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'bigDataPoolName': self._serialize.url("big_data_pool_name", big_data_pool_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + 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 = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(big_data_pool_info, 'BigDataPoolResourceInfo') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - raise models.ErrorContractException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('BigDataPoolResourceInfo', response) + deserialized = self._deserialize('BigDataPoolResourceInfo', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('BigDataPoolResourceInfo', response) + deserialized = self._deserialize('BigDataPoolResourceInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, workspace_name, big_data_pool_name, big_data_pool_info, force=False, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} # type: ignore + + 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"] """Create a Big Data pool. Create a new Big Data pool. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param big_data_pool_name: Big Data pool name + :param big_data_pool_name: Big Data pool name. :type big_data_pool_name: str :param big_data_pool_info: The Big Data pool to create. - :type big_data_pool_info: - ~azure.mgmt.synapse.models.BigDataPoolResourceInfo - :param force: Whether to stop any running jobs in the Big Data pool + :type big_data_pool_info: ~azure.mgmt.synapse.models.BigDataPoolResourceInfo + :param force: Whether to stop any running jobs in the Big Data pool. :type force: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns BigDataPoolResourceInfo - or ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.synapse.models.BigDataPoolResourceInfo] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.synapse.models.BigDataPoolResourceInfo]] - :raises: - :class:`ErrorContractException` + :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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.BigDataPoolResourceInfo] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - big_data_pool_name=big_data_pool_name, - big_data_pool_info=big_data_pool_info, - force=force, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.BigDataPoolResourceInfo"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('BigDataPoolResourceInfo', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + big_data_pool_name=big_data_pool_name, + big_data_pool_info=big_data_pool_info, + force=force, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('BigDataPoolResourceInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} # type: ignore def _delete_initial( - self, resource_group_name, workspace_name, big_data_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + big_data_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[object] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[object]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'bigDataPoolName': self._serialize.url("big_data_pool_name", big_data_pool_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - raise models.ErrorContractException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('object', response) + deserialized = self._deserialize('object', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('object', response) + deserialized = self._deserialize('object', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def delete( - self, resource_group_name, workspace_name, big_data_pool_name, custom_headers=None, raw=False, polling=True, **operation_config): + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + workspace_name, # type: str + big_data_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[object] """Delete a Big Data pool. Delete a Big Data pool from the workspace. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param big_data_pool_name: Big Data pool name + :param big_data_pool_name: Big Data pool name. :type big_data_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns object or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[object] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[object]] - :raises: - :class:`ErrorContractException` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either object or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[object] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - big_data_pool_name=big_data_pool_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[object] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('object', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + big_data_pool_name=big_data_pool_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools/{bigDataPoolName}'} # type: ignore def list_by_workspace( - self, resource_group_name, workspace_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.BigDataPoolResourceInfoListResult"] """List the Big Data pools in a workspace. List Big Data pools in a workspace. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of BigDataPoolResourceInfo - :rtype: - ~azure.mgmt.synapse.models.BigDataPoolResourceInfoPaged[~azure.mgmt.synapse.models.BigDataPoolResourceInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either 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"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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'] + 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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str') + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('BigDataPoolResourceInfoListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.BigDataPoolResourceInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools'} + return ItemPaged( + get_next, extract_data + ) + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/bigDataPools'} # type: ignore 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 new file mode 100644 index 000000000000..75beced1cef5 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_data_masking_policies_operations.py @@ -0,0 +1,183 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +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.mgmt.core.exceptions import ARMErrorFormat + +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]] + +class DataMaskingPoliciesOperations(object): + """DataMaskingPoliciesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + 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" + """Creates or updates a Sql pool data masking policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param parameters: Parameters for creating or updating a data masking policy. + :type parameters: ~azure.mgmt.synapse.models.DataMaskingPolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataMaskingPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.DataMaskingPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataMaskingPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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['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, '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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataMaskingPolicy', pipeline_response) + + if cls: + 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 + + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + sql_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DataMaskingPolicy" + """Gets a Sql pool data masking policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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: DataMaskingPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.DataMaskingPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataMaskingPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataMaskingPolicy', pipeline_response) + + if cls: + 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 new file mode 100644 index 000000000000..a5beef226279 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_data_masking_rules_operations.py @@ -0,0 +1,208 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# 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 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.mgmt.core.exceptions import ARMErrorFormat + +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]] + +class DataMaskingRulesOperations(object): + """DataMaskingRulesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + 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" + """Creates or updates a Sql pool data masking rule. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param data_masking_rule_name: The name of the data masking rule. + :type data_masking_rule_name: str + :param parameters: The required parameters for creating or updating a data masking rule. + :type parameters: ~azure.mgmt.synapse.models.DataMaskingRule + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataMaskingRule, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.DataMaskingRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataMaskingRule"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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['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, '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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataMaskingRule', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataMaskingRule', pipeline_response) + + if cls: + 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 + + 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"] + """Gets a list of Sql pool data masking rules. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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.paging.ItemPaged[~azure.mgmt.synapse.models.DataMaskingRuleListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataMaskingRuleListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DataMaskingRuleListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_sql_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataMaskingPolicies/{dataMaskingPolicyName}/rules'} # type: ignore 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 new file mode 100644 index 000000000000..b9f4db94e52a --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_extended_sql_pool_blob_auditing_policies_operations.py @@ -0,0 +1,267 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +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.mgmt.core.exceptions import ARMErrorFormat + +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]] + +class ExtendedSqlPoolBlobAuditingPoliciesOperations(object): + """ExtendedSqlPoolBlobAuditingPoliciesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + sql_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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: ExtendedSqlPoolBlobAuditingPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.ExtendedSqlPoolBlobAuditingPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtendedSqlPoolBlobAuditingPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ExtendedSqlPoolBlobAuditingPolicy', pipeline_response) + + if cls: + 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 + + 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" + """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. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param parameters: The extended Sql pool blob auditing policy. + :type parameters: ~azure.mgmt.synapse.models.ExtendedSqlPoolBlobAuditingPolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExtendedSqlPoolBlobAuditingPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.ExtendedSqlPoolBlobAuditingPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtendedSqlPoolBlobAuditingPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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['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, '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 + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ExtendedSqlPoolBlobAuditingPolicy', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ExtendedSqlPoolBlobAuditingPolicy', pipeline_response) + + if cls: + 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 + + 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"] + """Lists extended auditing settings of a Sql pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtendedSqlPoolBlobAuditingPolicyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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_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, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ExtendedSqlPoolBlobAuditingPolicyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_sql_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/extendedAuditingSettings'} # type: ignore 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 725ceabcb757..268a9806cc43 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 @@ -1,184 +1,186 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class IntegrationRuntimeAuthKeysOperations(object): """IntegrationRuntimeAuthKeysOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def regenerate( - self, resource_group_name, workspace_name, integration_runtime_name, key_name=None, custom_headers=None, raw=False, **operation_config): + 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" """Regenerate integration runtime authentication key. Regenerate the authentication key for an integration runtime. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param integration_runtime_name: Integration runtime name + :param integration_runtime_name: Integration runtime name. :type integration_runtime_name: str - :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 - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: IntegrationRuntimeAuthKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeAuthKeys or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param regenerate_key_parameters: The parameters for regenerating integration runtime + authentication key. + :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 + :raises: ~azure.core.exceptions.HttpResponseError """ - regenerate_key_parameters = models.IntegrationRuntimeRegenerateKeyParameters(key_name=key_name) + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeAuthKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.regenerate.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(regenerate_key_parameters, 'IntegrationRuntimeRegenerateKeyParameters') + 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') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IntegrationRuntimeAuthKeys', response) + deserialized = self._deserialize('IntegrationRuntimeAuthKeys', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - regenerate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/regenerateAuthKey'} + regenerate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/regenerateAuthKey'} # type: ignore def list( - self, resource_group_name, workspace_name, integration_runtime_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + integration_runtime_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.IntegrationRuntimeAuthKeys" """List integration runtime authentication keys. List authentication keys in an integration runtime. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param integration_runtime_name: Integration runtime name + :param integration_runtime_name: Integration runtime name. :type integration_runtime_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: IntegrationRuntimeAuthKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeAuthKeys or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeAuthKeys"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IntegrationRuntimeAuthKeys', response) + deserialized = self._deserialize('IntegrationRuntimeAuthKeys', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/listAuthKeys'} + 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 46d62e192ac0..edf9bdfd8584 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 @@ -1,108 +1,111 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class IntegrationRuntimeConnectionInfosOperations(object): """IntegrationRuntimeConnectionInfosOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, workspace_name, integration_runtime_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + integration_runtime_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.IntegrationRuntimeConnectionInfo" """Get integration runtime connection info. Get connection info for an integration runtime. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param integration_runtime_name: Integration runtime name + :param integration_runtime_name: Integration runtime name. :type integration_runtime_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: IntegrationRuntimeConnectionInfo or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeConnectionInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IntegrationRuntimeConnectionInfo, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeConnectionInfo + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeConnectionInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IntegrationRuntimeConnectionInfo', response) + deserialized = self._deserialize('IntegrationRuntimeConnectionInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/getConnectionInfo'} + 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 0f0474d8ed7d..d43a2ffe89b5 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 @@ -1,104 +1,111 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class IntegrationRuntimeCredentialsOperations(object): """IntegrationRuntimeCredentialsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def sync( - self, resource_group_name, workspace_name, integration_runtime_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + integration_runtime_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Sync integration runtime credentials. - Force the integration runtime to synchronize credentials across - integration runtime nodes, and this will override the credentials - across all worker nodes with those available on the dispatcher node. If - you already have the latest credential backup file, you should manually - import it (preferred) on any self-hosted integration runtime node than - using this API directly. + Force the integration runtime to synchronize credentials across integration runtime nodes, and + this will override the credentials across all worker nodes with those available on the + dispatcher node. If you already have the latest credential backup file, you should manually + import it (preferred) on any self-hosted integration runtime node than using this API directly. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param integration_runtime_name: Integration runtime name + :param integration_runtime_name: Integration runtime name. :type integration_runtime_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.sync.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - sync.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/syncCredentials'} + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, 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 a4d5954ce6f8..69745209e98b 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 @@ -1,108 +1,111 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class IntegrationRuntimeMonitoringDataOperations(object): """IntegrationRuntimeMonitoringDataOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config - - def get( - self, resource_group_name, workspace_name, integration_runtime_name, custom_headers=None, raw=False, **operation_config): + self._config = config + + def list( + self, + resource_group_name, # type: str + workspace_name, # type: str + integration_runtime_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.IntegrationRuntimeMonitoringData" """Get integration runtime monitoring data. Get monitoring data for an integration runtime. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param integration_runtime_name: Integration runtime name + :param integration_runtime_name: Integration runtime name. :type integration_runtime_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: IntegrationRuntimeMonitoringData or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeMonitoringData or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IntegrationRuntimeMonitoringData, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeMonitoringData + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeMonitoringData"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IntegrationRuntimeMonitoringData', response) + deserialized = self._deserialize('IntegrationRuntimeMonitoringData', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/monitoringData'} + 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 215358348791..7a035e8d5df5 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 @@ -1,111 +1,115 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class IntegrationRuntimeNodeIpAddressOperations(object): """IntegrationRuntimeNodeIpAddressOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, workspace_name, integration_runtime_name, node_name, custom_headers=None, raw=False, **operation_config): + 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" """Get integration runtime node IP address. Get the IP address of an integration runtime node. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param integration_runtime_name: Integration runtime name + :param integration_runtime_name: Integration runtime name. :type integration_runtime_name: str - :param node_name: Integration runtime node name + :param node_name: Integration runtime node name. :type node_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: IntegrationRuntimeNodeIpAddress or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeNodeIpAddress or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IntegrationRuntimeNodeIpAddress, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeNodeIpAddress + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeNodeIpAddress"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), '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') + 'nodeName': self._serialize.url("node_name", node_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IntegrationRuntimeNodeIpAddress', response) + deserialized = self._deserialize('IntegrationRuntimeNodeIpAddress', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}/ipAddress'} + 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 11f3e5b35592..00ef5e391a88 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 @@ -1,254 +1,261 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class IntegrationRuntimeNodesOperations(object): """IntegrationRuntimeNodesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, workspace_name, integration_runtime_name, node_name, custom_headers=None, raw=False, **operation_config): + 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" """Get integration runtime node. Get an integration runtime node. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param integration_runtime_name: Integration runtime name + :param integration_runtime_name: Integration runtime name. :type integration_runtime_name: str - :param node_name: Integration runtime node name + :param node_name: Integration runtime node name. :type node_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SelfHostedIntegrationRuntimeNode or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.synapse.models.SelfHostedIntegrationRuntimeNode or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SelfHostedIntegrationRuntimeNode"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), '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') + 'nodeName': self._serialize.url("node_name", node_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SelfHostedIntegrationRuntimeNode', response) + deserialized = self._deserialize('SelfHostedIntegrationRuntimeNode', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}'} # type: ignore def update( - self, resource_group_name, workspace_name, integration_runtime_name, node_name, concurrent_jobs_limit=None, custom_headers=None, raw=False, **operation_config): + 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" """Create integration runtime node. Create an integration runtime node. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param integration_runtime_name: Integration runtime name + :param integration_runtime_name: Integration runtime name. :type integration_runtime_name: str - :param node_name: Integration runtime node name + :param node_name: Integration runtime node name. :type node_name: str - :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 - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SelfHostedIntegrationRuntimeNode or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.synapse.models.SelfHostedIntegrationRuntimeNode or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 + :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 + :raises: ~azure.core.exceptions.HttpResponseError """ - update_integration_runtime_node_request = models.UpdateIntegrationRuntimeNodeRequest(concurrent_jobs_limit=concurrent_jobs_limit) + cls = kwargs.pop('cls', None) # type: ClsType["_models.SelfHostedIntegrationRuntimeNode"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), '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') + 'nodeName': self._serialize.url("node_name", node_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(update_integration_runtime_node_request, 'UpdateIntegrationRuntimeNodeRequest') + 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') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SelfHostedIntegrationRuntimeNode', response) + deserialized = self._deserialize('SelfHostedIntegrationRuntimeNode', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}'} # type: ignore def delete( - self, resource_group_name, workspace_name, integration_runtime_name, node_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + integration_runtime_name, # type: str + node_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Delete integration runtime node. Delete an integration runtime node. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param integration_runtime_name: Integration runtime name + :param integration_runtime_name: Integration runtime name. :type integration_runtime_name: str - :param node_name: Integration runtime node name + :param node_name: Integration runtime node name. :type node_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), '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') + 'nodeName': self._serialize.url("node_name", node_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/nodes/{nodeName}'} + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, 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 602073bd237e..d1d47ddce7af 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 @@ -1,189 +1,252 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +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]] class IntegrationRuntimeObjectMetadataOperations(object): """IntegrationRuntimeObjectMetadataOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config - - def get( - self, resource_group_name, workspace_name, integration_runtime_name, metadata_path=None, custom_headers=None, raw=False, **operation_config): + self._config = config + + 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" """Get integration runtime object metadata. Get object metadata from an integration runtime. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param integration_runtime_name: Integration runtime name + :param integration_runtime_name: Integration runtime name. :type integration_runtime_name: str - :param metadata_path: Metadata path. - :type metadata_path: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SsisObjectMetadataListResponse or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.synapse.models.SsisObjectMetadataListResponse or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param get_metadata_request: The parameters for getting a SSIS object metadata. + :type get_metadata_request: ~azure.mgmt.synapse.models.GetSsisObjectMetadataRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SsisObjectMetadataListResponse, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SsisObjectMetadataListResponse + :raises: ~azure.core.exceptions.HttpResponseError """ - get_metadata_request = None - if metadata_path is not None: - get_metadata_request = models.GetSsisObjectMetadataRequest(metadata_path=metadata_path) + cls = kwargs.pop('cls', None) # type: ClsType["_models.SsisObjectMetadataListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.get.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body + 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') else: body_content = None - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SsisObjectMetadataListResponse', response) + deserialized = self._deserialize('SsisObjectMetadataListResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/getObjectMetadata'} - - def refresh( - self, resource_group_name, workspace_name, integration_runtime_name, custom_headers=None, raw=False, **operation_config): - """Refresh integration runtime object metadata. - - Refresh the object metadata in an integration runtime. + 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"] + 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 = "2019-06-01-preview" + accept = "application/json" - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param workspace_name: The name of the workspace - :type workspace_name: str - :param integration_runtime_name: Integration runtime name - :type integration_runtime_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SsisObjectMetadataStatusResponse or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.synapse.models.SsisObjectMetadataStatusResponse or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ # Construct URL - url = self.refresh.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SsisObjectMetadataStatusResponse', response) + deserialized = self._deserialize('SsisObjectMetadataStatusResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/refreshObjectMetadata'} + _refresh_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/refreshObjectMetadata'} # type: ignore + + 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"] + """Refresh integration runtime object metadata. + + Refresh the object metadata in an integration runtime. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SsisObjectMetadataStatusResponse"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._refresh_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_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 23519d2bd008..a14d50aa332b 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 @@ -1,108 +1,111 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class IntegrationRuntimeStatusOperations(object): """IntegrationRuntimeStatusOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, workspace_name, integration_runtime_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + integration_runtime_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.IntegrationRuntimeStatusResponse" """Get integration runtime status. Get the integration runtime status. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param integration_runtime_name: Integration runtime name + :param integration_runtime_name: Integration runtime name. :type integration_runtime_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: IntegrationRuntimeStatusResponse or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeStatusResponse or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IntegrationRuntimeStatusResponse, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeStatusResponse + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeStatusResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IntegrationRuntimeStatusResponse', response) + deserialized = self._deserialize('IntegrationRuntimeStatusResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/getStatus'} + 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 356d7d0063fb..4f2f0e853229 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 @@ -1,597 +1,1088 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +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]] class IntegrationRuntimesOperations(object): """IntegrationRuntimesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def update( - self, resource_group_name, workspace_name, integration_runtime_name, auto_update=None, update_delay_offset=None, custom_headers=None, raw=False, **operation_config): + 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" """Update integration runtime. Update an integration runtime. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param integration_runtime_name: Integration runtime name + :param integration_runtime_name: Integration runtime name. :type integration_runtime_name: str - :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 - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: IntegrationRuntimeResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param update_integration_runtime_request: The parameters for updating an integration runtime. + :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 + :raises: ~azure.core.exceptions.HttpResponseError """ - update_integration_runtime_request = models.UpdateIntegrationRuntimeRequest(auto_update=auto_update, update_delay_offset=update_delay_offset) + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.update.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(update_integration_runtime_request, 'UpdateIntegrationRuntimeRequest') + 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') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IntegrationRuntimeResource', response) + deserialized = self._deserialize('IntegrationRuntimeResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} # type: ignore def get( - self, resource_group_name, workspace_name, integration_runtime_name, if_none_match=None, custom_headers=None, raw=False, **operation_config): + 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"] """Get integration runtime. Get an integration runtime. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param integration_runtime_name: Integration runtime name + :param integration_runtime_name: Integration runtime name. :type integration_runtime_name: str - :param if_none_match: ETag of the integration runtime entity. Should - only be specified for get. If the ETag matches the existing entity - tag, or if * was provided, then no content will be returned. + :param if_none_match: ETag of the integration runtime entity. Should only be specified for get. + If the ETag matches the existing entity tag, or if * was provided, then no content will be + returned. :type if_none_match: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: IntegrationRuntimeResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 or None + :raises: ~azure.core.exceptions.HttpResponseError """ + 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 = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_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') - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 304]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('IntegrationRuntimeResource', response) + deserialized = self._deserialize('IntegrationRuntimeResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} - - def create( - self, resource_group_name, workspace_name, integration_runtime_name, properties, if_match=None, custom_headers=None, raw=False, **operation_config): - """Create integration runtime. - - Create an integration runtime. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param workspace_name: The name of the workspace - :type workspace_name: str - :param integration_runtime_name: Integration runtime name - :type integration_runtime_name: str - :param properties: Integration runtime properties. - :type properties: ~azure.mgmt.synapse.models.IntegrationRuntime - :param if_match: ETag of the integration runtime entity. Should only - be specified for update, for which it should match existing entity or - can be * for unconditional update. - :type if_match: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: IntegrationRuntimeResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - integration_runtime = models.IntegrationRuntimeResource(properties=properties) + 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"] + 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 = "2019-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) + 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 self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - # Construct body + 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) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('IntegrationRuntimeResource', response) + deserialized = self._deserialize('IntegrationRuntimeResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} - - def delete( - self, resource_group_name, workspace_name, integration_runtime_name, custom_headers=None, raw=False, **operation_config): - """Delete integration runtime. + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} # type: ignore + + 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"] + """Create integration runtime. - Delete an integration runtime. + Create an integration runtime. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param integration_runtime_name: Integration runtime name + :param integration_runtime_name: Integration runtime name. :type integration_runtime_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param integration_runtime: Integration runtime resource definition. + :type integration_runtime: ~azure.mgmt.synapse.models.IntegrationRuntimeResource + :param if_match: ETag of the integration runtime entity. Should only be specified for update, + for which it should match existing entity or can be * for unconditional 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: True for ARMPolling, False for no polling, or a + polling object for 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.IntegrationRuntimeResource] + :raises ~azure.core.exceptions.HttpResponseError: """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + integration_runtime=integration_runtime, + if_match=if_match, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.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 + 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 = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + workspace_name, # type: str + integration_runtime_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Delete integration runtime. + + Delete an integration runtime. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), + } - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}'} # type: ignore def upgrade( - self, resource_group_name, workspace_name, integration_runtime_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + integration_runtime_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Upgrade integration runtime. Upgrade an integration runtime. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param integration_runtime_name: Integration runtime name + :param integration_runtime_name: Integration runtime name. :type integration_runtime_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.upgrade.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - upgrade.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/upgrade'} + upgrade.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/upgrade'} # type: ignore def list_by_workspace( - self, resource_group_name, workspace_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.IntegrationRuntimeListResponse"] """List integration runtimes. List all integration runtimes. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of IntegrationRuntimeResource - :rtype: - ~azure.mgmt.synapse.models.IntegrationRuntimeResourcePaged[~azure.mgmt.synapse.models.IntegrationRuntimeResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IntegrationRuntimeListResponse or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.IntegrationRuntimeListResponse] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeListResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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'] + 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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str') + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('IntegrationRuntimeListResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes'} # type: ignore + + 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"] + 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 = "2019-06-01-preview" + accept = "application/json" - return response + # 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, pattern=r'^[-\w\._\(\)]+$'), + '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) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.IntegrationRuntimeResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - return deserialized - list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes'} + # 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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('IntegrationRuntimeStatusResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) - def start( - self, resource_group_name, workspace_name, integration_runtime_name, custom_headers=None, raw=False, **operation_config): + return deserialized + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/start'} # type: ignore + + 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"] """Start integration runtime. Start an integration runtime. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param integration_runtime_name: Integration runtime name + :param integration_runtime_name: Integration runtime name. :type integration_runtime_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: IntegrationRuntimeStatusResponse or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeStatusResponse or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.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: """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IntegrationRuntimeStatusResponse"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._start_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.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 + 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 = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.start.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, 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 + + def begin_stop( + self, + resource_group_name, # type: str + workspace_name, # type: str + integration_runtime_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Stop integration runtime. - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IntegrationRuntimeStatusResponse', response) + Stop an integration runtime. - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - return deserialized - start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/start'} + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_name, 'str'), + } - def stop( - self, resource_group_name, workspace_name, integration_runtime_name, custom_headers=None, raw=False, **operation_config): - """Stop integration runtime. + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/stop'} # 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 + 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 = "2019-06-01-preview" + accept = "application/json" - Stop an integration runtime. + # 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, pattern=r'^[-\w\._\(\)]+$'), + '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) - :param resource_group_name: The name of the resource group. The name - is case insensitive. + # Construct parameters + query_parameters = {} # type: Dict[str, 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 = 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(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, 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 + + 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] + """Enable interactive query in integration runtime. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param integration_runtime_name: Integration runtime name + :param integration_runtime_name: Integration runtime name. :type integration_runtime_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._enable_interactive_query_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_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 + 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 = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.stop.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'integrationRuntimeName': self._serialize.url("integration_runtime_name", integration_runtime_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/stop'} + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.CloudErrorAutoGenerated, response) + raise HttpResponseError(response=response, model=error, 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 + + 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] + """Disable interactive query in integration runtime. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._disable_interactive_query_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_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 4a29b0e7bea0..83d296bc2e51 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 @@ -1,493 +1,581 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +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]] class IpFirewallRulesOperations(object): """IpFirewallRulesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def list_by_workspace( - self, resource_group_name, workspace_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.IpFirewallRuleInfoListResult"] """Returns a list of firewall rules. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of IpFirewallRuleInfo - :rtype: - ~azure.mgmt.synapse.models.IpFirewallRuleInfoPaged[~azure.mgmt.synapse.models.IpFirewallRuleInfo] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either IpFirewallRuleInfoListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.IpFirewallRuleInfoListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.IpFirewallRuleInfoListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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'] + 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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str') + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('IpFirewallRuleInfoListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.IpFirewallRuleInfoPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules'} + return pipeline_response + return ItemPaged( + get_next, extract_data + ) + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules'} # type: ignore def _create_or_update_initial( - self, resource_group_name, workspace_name, rule_name, end_ip_address=None, start_ip_address=None, custom_headers=None, raw=False, **operation_config): - ip_firewall_rule_info = models.IpFirewallRuleInfo(end_ip_address=end_ip_address, start_ip_address=start_ip_address) + 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" + 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 = "2019-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(ip_firewall_rule_info, 'IpFirewallRuleInfo') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ErrorContractException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('IpFirewallRuleInfo', response) + deserialized = self._deserialize('IpFirewallRuleInfo', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('IpFirewallRuleInfo', response) + deserialized = self._deserialize('IpFirewallRuleInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, workspace_name, rule_name, end_ip_address=None, start_ip_address=None, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}'} # type: ignore + + 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"] """Creates or updates a firewall rule. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param rule_name: The IP firewall rule name + :param rule_name: The IP firewall rule name. :type rule_name: 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 - :param start_ip_address: The start IP address of the firewall rule. - Must be IPv4 format - :type start_ip_address: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param ip_firewall_rule_info: IP firewall rule properties. + :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: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns IpFirewallRuleInfo or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.synapse.models.IpFirewallRuleInfo] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.synapse.models.IpFirewallRuleInfo]] - :raises: - :class:`ErrorContractException` + :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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.IpFirewallRuleInfo] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - rule_name=rule_name, - end_ip_address=end_ip_address, - start_ip_address=start_ip_address, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.IpFirewallRuleInfo"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('IpFirewallRuleInfo', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + ip_firewall_rule_info=ip_firewall_rule_info, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('IpFirewallRuleInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}'} # type: ignore def _delete_initial( - self, resource_group_name, workspace_name, rule_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[object] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[object]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('object', response) + deserialized = self._deserialize('object', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def delete( - self, resource_group_name, workspace_name, rule_name, custom_headers=None, raw=False, polling=True, **operation_config): + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + workspace_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[object] """Deletes a firewall rule. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param rule_name: The IP firewall rule name + :param rule_name: The IP firewall rule name. :type rule_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns object or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[object] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[object]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either object or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[object] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - rule_name=rule_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[object] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('object', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + rule_name=rule_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}'} # type: ignore def get( - self, resource_group_name, workspace_name, rule_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + rule_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.IpFirewallRuleInfo" """Get a firewall rule. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param rule_name: The IP firewall rule name + :param rule_name: The IP firewall rule name. :type rule_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: IpFirewallRuleInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.IpFirewallRuleInfo or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorContractException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IpFirewallRuleInfo, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.IpFirewallRuleInfo + :raises: ~azure.core.exceptions.HttpResponseError """ + 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 = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'ruleName': self._serialize.url("rule_name", rule_name, 'str') + 'ruleName': self._serialize.url("rule_name", rule_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ErrorContractException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IpFirewallRuleInfo', response) + deserialized = self._deserialize('IpFirewallRuleInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/firewallRules/{ruleName}'} # type: ignore def _replace_all_initial( - self, resource_group_name, workspace_name, ip_firewall_rules=None, custom_headers=None, raw=False, **operation_config): - request = models.ReplaceAllIpFirewallRulesRequest(ip_firewall_rules=ip_firewall_rules) + self, + resource_group_name, # type: str + workspace_name, # type: str + request, # type: "_models.ReplaceAllIpFirewallRulesRequest" + **kwargs # type: Any + ): + # type: (...) -> 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 = "2019-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.replace_all.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str') + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(request, 'ReplaceAllIpFirewallRulesRequest') + 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') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ErrorContractException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ReplaceAllFirewallRulesOperationResponse', response) + deserialized = self._deserialize('ReplaceAllFirewallRulesOperationResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def replace_all( - self, resource_group_name, workspace_name, ip_firewall_rules=None, custom_headers=None, raw=False, polling=True, **operation_config): + _replace_all_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/replaceAllIpFirewallRules'} # type: ignore + + 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"] """Replaces firewall rules. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param ip_firewall_rules: IP firewall rule properties - :type ip_firewall_rules: dict[str, - ~azure.mgmt.synapse.models.IpFirewallRuleProperties] - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param request: Replace all IP firewall rules request. + :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: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns - ReplaceAllFirewallRulesOperationResponse or - ClientRawResponse if - raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.synapse.models.ReplaceAllFirewallRulesOperationResponse] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.synapse.models.ReplaceAllFirewallRulesOperationResponse]] - :raises: - :class:`ErrorContractException` + :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: """ - raw_result = self._replace_all_initial( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - ip_firewall_rules=ip_firewall_rules, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplaceAllFirewallRulesOperationResponse"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('ReplaceAllFirewallRulesOperationResponse', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._replace_all_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ReplaceAllFirewallRulesOperationResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - replace_all.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/replaceAllIpFirewallRules'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_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 new file mode 100644 index 000000000000..240f5e2d8851 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_keys_operations.py @@ -0,0 +1,324 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +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.mgmt.core.exceptions import ARMErrorFormat + +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]] + +class KeysOperations(object): + """KeysOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_workspace( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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. + :type resource_group_name: str + :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 KeyInfoListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.KeyInfoListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyInfoListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('KeyInfoListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/keys'} # type: ignore + + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Key" + """Gets a workspace key. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param key_name: The name of the workspace key. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/keys/{keyName}'} # type: ignore + + 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" + """Creates or updates a workspace key. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param key_name: The name of the workspace key. + :type key_name: str + :param key_properties: Key put request properties. + :type key_properties: ~azure.mgmt.synapse.models.Key + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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['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(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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + 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 + + def delete( + self, + resource_group_name, # type: str + workspace_name, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.Key"] + """Deletes a workspace key. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param key_name: The name of the workspace key. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.Key or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Key"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = 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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + 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/_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_operations.py index 804df34ae7e4..053c4afb5693 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 @@ -1,285 +1,286 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class Operations(object): """Operations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def check_name_availability( - self, name=None, type=None, custom_headers=None, raw=False, **operation_config): + self, + request, # type: "_models.CheckNameAvailabilityRequest" + **kwargs # type: Any + ): + # type: (...) -> "_models.CheckNameAvailabilityResponse" """Check name availability. Check whether a workspace name is available. - :param name: Workspace name - :type name: str - :param type: Type: workspace - :type type: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CheckNameAvailabilityResponse or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.synapse.models.CheckNameAvailabilityResponse or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorContractException` + :param request: The check request. + :type request: ~azure.mgmt.synapse.models.CheckNameAvailabilityRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResponse, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.CheckNameAvailabilityResponse + :raises: ~azure.core.exceptions.HttpResponseError """ - request = models.CheckNameAvailabilityRequest(name=name, type=type) + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.check_name_availability.metadata['url'] + url = self.check_name_availability.metadata['url'] # type: ignore path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(request, 'CheckNameAvailabilityRequest') + 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') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ErrorContractException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CheckNameAvailabilityResponse', response) + deserialized = self._deserialize('CheckNameAvailabilityResponse', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/checkNameAvailability'} + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/checkNameAvailability'} # type: ignore def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> List["_models.AvailableRpOperation"] """All operations. Get all available operations. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: list or ClientRawResponse if raw=true - :rtype: list[~azure.mgmt.synapse.models.AvailableRpOperation] or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: list of AvailableRpOperation, or the result of cls(response) + :rtype: list[~azure.mgmt.synapse.models.AvailableRpOperation] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[List["_models.AvailableRpOperation"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + accept = "application/json" + # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('[AvailableRpOperation]', response) + deserialized = self._deserialize('[AvailableRpOperation]', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/providers/Microsoft.Synapse/operations'} + list.metadata = {'url': '/providers/Microsoft.Synapse/operations'} # type: ignore def get_location_header_result( - self, resource_group_name, workspace_name, operation_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Get operation result. Get the result of an operation. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param operation_id: Operation ID + :param operation_id: Operation ID. :type operation_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorContractException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + 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 = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get_location_header_result.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str') + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if response.status_code not in [200, 204]: - raise models.ErrorContractException(self._deserialize, response) + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - get_location_header_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/operationResults/{operationId}'} + get_location_header_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/operationResults/{operationId}'} # type: ignore def get_azure_async_header_result( - self, resource_group_name, workspace_name, operation_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.OperationResource"] """Get operation status. Get the status of an operation. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param operation_id: Operation ID + :param operation_id: Operation ID. :type operation_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: object or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationResource, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.OperationResource or None + :raises: ~azure.core.exceptions.HttpResponseError """ + 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 = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get_azure_async_header_result.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_id, 'str') + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response - if response.status_code not in [200, 404, 500]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + if response.status_code not in [200, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('OperationResource', response) - if response.status_code == 500: - deserialized = self._deserialize('ErrorContract', response) + deserialized = self._deserialize('OperationResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + 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}'} + 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 960ae5865870..1b547d5a4b0c 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 @@ -1,377 +1,452 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +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]] class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, workspace_name, private_endpoint_connection_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnection" """Gets a private endpoint connection. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param private_endpoint_connection_name: The name of the private - endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PrivateEndpointConnection or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.PrivateEndpointConnection or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorContractException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + 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 = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ErrorContractException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', response) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def _create_initial( - self, resource_group_name, workspace_name, private_endpoint_connection_name, custom_headers=None, raw=False, **operation_config): + 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" + 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 = "2019-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + 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') - if response.status_code not in [200, 201]: - raise models.ErrorContractException(self._deserialize, response) + 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 - deserialized = None + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', response) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('PrivateEndpointConnection', response) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create( - self, resource_group_name, workspace_name, private_endpoint_connection_name, custom_headers=None, raw=False, polling=True, **operation_config): + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + 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"] """Approve or reject a private endpoint connection. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param private_endpoint_connection_name: The name of the private - endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param request: Request body of private endpoint connection to 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: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns - PrivateEndpointConnection or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.synapse.models.PrivateEndpointConnection] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.synapse.models.PrivateEndpointConnection]] - :raises: - :class:`ErrorContractException` + :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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_initial( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - private_endpoint_connection_name=private_endpoint_connection_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('PrivateEndpointConnection', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + private_endpoint_connection_name=private_endpoint_connection_name, + request=request, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def _delete_initial( - self, resource_group_name, workspace_name, private_endpoint_connection_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response - if response.status_code not in [202, 204]: - raise models.ErrorContractException(self._deserialize, response) + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 202: - deserialized = self._deserialize('OperationResource', response) + deserialized = self._deserialize('OperationResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def delete( - self, resource_group_name, workspace_name, private_endpoint_connection_name, custom_headers=None, raw=False, polling=True, **operation_config): + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + 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"] """Delete a private endpoint connection. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param private_endpoint_connection_name: The name of the private - endpoint connection. + :param private_endpoint_connection_name: The name of the private endpoint connection. :type private_endpoint_connection_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns OperationResource or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.synapse.models.OperationResource] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.synapse.models.OperationResource]] - :raises: - :class:`ErrorContractException` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - private_endpoint_connection_name=private_endpoint_connection_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResource"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('OperationResource', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('OperationResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def list( - self, resource_group_name, workspace_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PrivateEndpointConnectionList"] """Lists private endpoint connection in workspace. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PrivateEndpointConnection - :rtype: - ~azure.mgmt.synapse.models.PrivateEndpointConnectionPaged[~azure.mgmt.synapse.models.PrivateEndpointConnection] - :raises: - :class:`ErrorContractException` + :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.paging.ItemPaged[~azure.mgmt.synapse.models.PrivateEndpointConnectionList] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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'] + 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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str') + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ErrorContractException(self._deserialize, response) + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PrivateEndpointConnectionPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateEndpointConnections'} # type: ignore 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 new file mode 100644 index 000000000000..82b26388c98e --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_endpoint_connections_private_link_hub_operations.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +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.mgmt.core.exceptions import ARMErrorFormat + +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]] + +class PrivateEndpointConnectionsPrivateLinkHubOperations(object): + """PrivateEndpointConnectionsPrivateLinkHubOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + private_link_hub_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse"] + """Get all PrivateEndpointConnections in the PrivateLinkHub. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionForPrivateLinkHubResourceCollectionResponse', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}/privateEndpointConnections'} # 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 new file mode 100644 index 000000000000..cdad93fe64ce --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_private_link_hubs_operations.py @@ -0,0 +1,503 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +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]] + +class PrivateLinkHubsOperations(object): + """PrivateLinkHubsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.PrivateLinkHubInfoListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkHubInfoListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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_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, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateLinkHubInfoListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs'} # type: ignore + + def get( + self, + resource_group_name, # type: str + private_link_hub_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateLinkHub" + """Gets a privateLinkHub. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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: PrivateLinkHub, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.PrivateLinkHub + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkHub"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkHub', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}'} # type: ignore + + 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" + """Updates a privateLinkHub. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_link_hub_name: Name of the privateLinkHub. + :type private_link_hub_name: str + :param private_link_hub_patch_info: PrivateLinkHub patch request properties. + :type private_link_hub_patch_info: ~azure.mgmt.synapse.models.PrivateLinkHubPatchInfo + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkHub, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.PrivateLinkHub + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkHub"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['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(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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateLinkHub', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateLinkHub', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}'} # type: ignore + + 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" + """Creates or updates a privateLinkHub. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param private_link_hub_name: Name of the privateLinkHub. + :type private_link_hub_name: str + :param private_link_hub_info: PrivateLinkHub create or update request properties. + :type private_link_hub_info: ~azure.mgmt.synapse.models.PrivateLinkHub + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkHub, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.PrivateLinkHub + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkHub"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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['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(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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('PrivateLinkHub', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('PrivateLinkHub', pipeline_response) + + if cls: + 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 + 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = 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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + private_link_hub_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a privateLinkHub. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + private_link_hub_name=private_link_hub_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/privateLinkHubs/{privateLinkHubName}'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> 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) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.PrivateLinkHubInfoListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkHubInfoListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateLinkHubInfoListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/privateLinkHubs'} # type: ignore 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 4635ad8474ca..95e3ec6343fd 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 @@ -1,183 +1,190 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def list( - self, resource_group_name, workspace_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PrivateLinkResourceListResult"] """Private Link Resources. Get all private link resources for a workspaces. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of PrivateLinkResource - :rtype: - ~azure.mgmt.synapse.models.PrivateLinkResourcePaged[~azure.mgmt.synapse.models.PrivateLinkResource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.PrivateLinkResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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'] + 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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str') + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.PrivateLinkResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateLinkResources'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateLinkResources'} # type: ignore def get( - self, resource_group_name, workspace_name, private_link_resource_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + private_link_resource_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateLinkResource" """Get Private Link Resource. Get private link resource in workspace. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param private_link_resource_name: The name of the private link - resource + :param private_link_resource_name: The name of the private link resource. :type private_link_resource_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PrivateLinkResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.PrivateLinkResource or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResource, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.PrivateLinkResource + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'privateLinkResourceName': self._serialize.url("private_link_resource_name", private_link_resource_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PrivateLinkResource', response) + deserialized = self._deserialize('PrivateLinkResource', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/privateLinkResources/{privateLinkResourceName}'} + 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 new file mode 100644 index 000000000000..093e9bbd8898 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_restorable_dropped_sql_pools_operations.py @@ -0,0 +1,187 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +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.mgmt.core.exceptions import ARMErrorFormat + +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]] + +class RestorableDroppedSqlPoolsOperations(object): + """RestorableDroppedSqlPoolsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + 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" + """Gets a deleted sql pool that can be restored. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param restorable_dropped_sql_pool_id: The id of the deleted Sql Pool in the form of + sqlPoolName,deletionTimeInFileTimeFormat. + :type restorable_dropped_sql_pool_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RestorableDroppedSqlPool, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.RestorableDroppedSqlPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableDroppedSqlPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RestorableDroppedSqlPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/restorableDroppedSqlPools/{restorableDroppedSqlPoolId}'} # type: ignore + + def list_by_workspace( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorableDroppedSqlPoolListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('RestorableDroppedSqlPoolListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/restorableDroppedSqlPools'} # type: ignore 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 47b9ce352c24..c6f4772b0022 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 @@ -1,186 +1,271 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class SqlPoolBlobAuditingPoliciesOperations(object): """SqlPoolBlobAuditingPoliciesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". - :ivar blob_auditing_policy_name: The name of the blob auditing policy. Constant value: "default". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - self.blob_auditing_policy_name = "default" - - self.config = config + self._config = config def get( - self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + sql_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SqlPoolBlobAuditingPolicy" """Get a SQL pool's blob auditing policy. Get a SQL pool's blob auditing policy. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SqlPoolBlobAuditingPolicy or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.SqlPoolBlobAuditingPolicy or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlPoolBlobAuditingPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SqlPoolBlobAuditingPolicy + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolBlobAuditingPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + blob_auditing_policy_name = "default" + accept = "application/json" + # Construct URL - url = self.get.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_policy_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SqlPoolBlobAuditingPolicy', response) + deserialized = self._deserialize('SqlPoolBlobAuditingPolicy', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/auditingSettings/{blobAuditingPolicyName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/auditingSettings/{blobAuditingPolicyName}'} # type: ignore def create_or_update( - self, resource_group_name, workspace_name, sql_pool_name, parameters, custom_headers=None, raw=False, **operation_config): + 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" """Creates or updates a SQL pool's blob auditing policy. Creates or updates a SQL pool's blob auditing policy. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param parameters: The database blob auditing policy. :type parameters: ~azure.mgmt.synapse.models.SqlPoolBlobAuditingPolicy - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SqlPoolBlobAuditingPolicy or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.SqlPoolBlobAuditingPolicy or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlPoolBlobAuditingPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SqlPoolBlobAuditingPolicy + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolBlobAuditingPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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'] + 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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'blobAuditingPolicyName': self._serialize.url("self.blob_auditing_policy_name", self.blob_auditing_policy_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'SqlPoolBlobAuditingPolicy') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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 if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SqlPoolBlobAuditingPolicy', response) + deserialized = self._deserialize('SqlPoolBlobAuditingPolicy', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SqlPoolBlobAuditingPolicy', response) + deserialized = self._deserialize('SqlPoolBlobAuditingPolicy', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/auditingSettings/{blobAuditingPolicyName}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/auditingSettings/{blobAuditingPolicyName}'} # type: ignore + + 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"] + """Lists auditing settings of a Sql pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolBlobAuditingPolicyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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_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, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SqlPoolBlobAuditingPolicyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_sql_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/auditingSettings'} # type: ignore 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 new file mode 100644 index 000000000000..fc91ea47e743 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_columns_operations.py @@ -0,0 +1,120 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +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.mgmt.core.exceptions import ARMErrorFormat + +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]] + +class SqlPoolColumnsOperations(object): + """SqlPoolColumnsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + 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" + """Get Sql pool column. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :param column_name: The name of the column. + :type column_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlPoolColumn, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SqlPoolColumn + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolColumn"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SqlPoolColumn', pipeline_response) + + if cls: + 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 25eab5422868..633d44352643 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 @@ -1,110 +1,115 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class SqlPoolConnectionPoliciesOperations(object): """SqlPoolConnectionPoliciesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". - :ivar connection_policy_name: The name of the connection policy. Constant value: "default". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - self.connection_policy_name = "default" - - self.config = config + self._config = config def get( - self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, **operation_config): + 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" """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. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SqlPoolConnectionPolicy or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.SqlPoolConnectionPolicy or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param connection_policy_name: The name of the connection policy. + :type connection_policy_name: str or ~azure.mgmt.synapse.models.ConnectionPolicyName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlPoolConnectionPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SqlPoolConnectionPolicy + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolConnectionPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'connectionPolicyName': self._serialize.url("self.connection_policy_name", self.connection_policy_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SqlPoolConnectionPolicy', response) + deserialized = self._deserialize('SqlPoolConnectionPolicy', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/connectionPolicies/{connectionPolicyName}'} + 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 390169b21fc1..ab96ae75c055 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 @@ -1,111 +1,114 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class SqlPoolDataWarehouseUserActivitiesOperations(object): """SqlPoolDataWarehouseUserActivitiesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". - :ivar data_warehouse_user_activity_name: The activity name of the Sql pool. . Constant value: "current". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - self.data_warehouse_user_activity_name = "current" - - self.config = config + self._config = config def get( - self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, **operation_config): + 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" """Get SQL pool user activities. - Gets the user activities of a SQL pool which includes running and - suspended queries. + Gets the user activities of a SQL pool which includes running and suspended queries. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DataWarehouseUserActivities or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.DataWarehouseUserActivities or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 + :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 + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataWarehouseUserActivities"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'dataWarehouseUserActivityName': self._serialize.url("self.data_warehouse_user_activity_name", self.data_warehouse_user_activity_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DataWarehouseUserActivities', response) + deserialized = self._deserialize('DataWarehouseUserActivities', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/dataWarehouseUserActivities/{dataWarehouseUserActivityName}'} + 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 9c45397f22fd..001cdfa6a0c6 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 @@ -1,110 +1,198 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class SqlPoolGeoBackupPoliciesOperations(object): """SqlPoolGeoBackupPoliciesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". - :ivar geo_backup_policy_name: The name of the geo backup policy. Constant value: "Default". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - self.geo_backup_policy_name = "Default" + self._config = config + + def list( + self, + resource_group_name, # type: str + workspace_name, # type: str + sql_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.GeoBackupPolicyListResult"] + """List SQL pool geo backup policies. - self.config = config + Get list of SQL pool geo backup policies. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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.paging.ItemPaged[~azure.mgmt.synapse.models.GeoBackupPolicyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GeoBackupPolicyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('GeoBackupPolicyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/geoBackupPolicies'} # type: ignore def get( - self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, **operation_config): + 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" """Get a SQL pool geo backup policy. Get the specified SQL pool geo backup policy. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: GeoBackupPolicy or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.GeoBackupPolicy or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param geo_backup_policy_name: The name of the geo backup policy. + :type geo_backup_policy_name: str or ~azure.mgmt.synapse.models.GeoBackupPolicyName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: GeoBackupPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.GeoBackupPolicy + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.GeoBackupPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'geoBackupPolicyName': self._serialize.url("self.geo_backup_policy_name", self.geo_backup_policy_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('GeoBackupPolicy', response) + deserialized = self._deserialize('GeoBackupPolicy', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/geoBackupPolicies/{geoBackupPolicyName}'} + 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_metadata_sync_configs_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_metadata_sync_configs_operations.py index 4567f45b5174..5a8f61b159ef 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 @@ -1,180 +1,189 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class SqlPoolMetadataSyncConfigsOperations(object): """SqlPoolMetadataSyncConfigsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + sql_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.MetadataSyncConfig"] """Get SQL pool metadata sync config. Get the metadata sync configuration for a SQL pool. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MetadataSyncConfig or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.MetadataSyncConfig or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorContractException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MetadataSyncConfig, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.MetadataSyncConfig or None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MetadataSyncConfig"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 404]: - raise models.ErrorContractException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MetadataSyncConfig', response) + deserialized = self._deserialize('MetadataSyncConfig', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/metadataSync/config'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/metadataSync/config'} # type: ignore def create( - self, resource_group_name, workspace_name, sql_pool_name, enabled=None, custom_headers=None, raw=False, **operation_config): + 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"] """Set SQL pool metadata sync config. Set the metadata sync configuration for a SQL pool. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param enabled: Indicates whether the metadata sync is enabled or - disabled - :type enabled: bool - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: MetadataSyncConfig or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.MetadataSyncConfig or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorContractException` + :param metadata_sync_configuration: Metadata sync configuration. + :type metadata_sync_configuration: ~azure.mgmt.synapse.models.MetadataSyncConfig + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MetadataSyncConfig, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.MetadataSyncConfig or None + :raises: ~azure.core.exceptions.HttpResponseError """ - metadata_sync_configuration = models.MetadataSyncConfig(enabled=enabled) + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MetadataSyncConfig"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(metadata_sync_configuration, 'MetadataSyncConfig') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ErrorContractException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('MetadataSyncConfig', response) + deserialized = self._deserialize('MetadataSyncConfig', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/metadataSync/config'} + 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 29ad42bd76f4..d9d54245cdc9 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 @@ -1,109 +1,119 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class SqlPoolOperationResultsOperations(object): """SqlPoolOperationResultsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def get_location_header_result( - self, resource_group_name, workspace_name, sql_pool_name, operation_id, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + sql_pool_name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> object """Get SQL pool operation status. Get the status of a SQL pool operation. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param operation_id: Operation ID + :param operation_id: Operation ID. :type operation_id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: object or ClientRawResponse if raw=true - :rtype: object or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: object, or the result of cls(response) + :rtype: object + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[object] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get_location_header_result.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), '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') + 'operationId': self._serialize.url("operation_id", operation_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('object', response) + deserialized = self._deserialize('object', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('object', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get_location_header_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/operationResults/{operationId}'} + 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.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_operations.py deleted file mode 100644 index d667d496759f..000000000000 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_operations.py +++ /dev/null @@ -1,118 +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. -# -------------------------------------------------------------------------- - -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError - -from .. import models - - -class SqlPoolOperations(object): - """SqlPoolOperations operations. - - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. - - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config - - def list( - self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, **operation_config): - """Gets a list of operations performed on the SQL pool. - - Gets a list of operations performed on the SQL pool. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param workspace_name: The name of the workspace - :type workspace_name: str - :param sql_pool_name: SQL pool name - :type sql_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SqlPoolOperation - :rtype: - ~azure.mgmt.synapse.models.SqlPoolOperationPaged[~azure.mgmt.synapse.models.SqlPoolOperation] - :raises: :class:`CloudError` - """ - def prepare_request(next_link=None): - if not next_link: - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - - else: - url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def internal_paging(next_link=None): - request = prepare_request(next_link) - - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SqlPoolOperationPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/operations'} 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 new file mode 100644 index 000000000000..9bdd06b4e17c --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_operations_operations.py @@ -0,0 +1,127 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +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.mgmt.core.exceptions import ARMErrorFormat + +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]] + +class SqlPoolOperationsOperations(object): + """SqlPoolOperationsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + workspace_name, # type: str + sql_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SqlPoolBlobAuditingPolicySqlPoolOperationListResult"] + """Gets a list of operations performed on the SQL pool. + + Gets a list of operations performed on the SQL pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolBlobAuditingPolicySqlPoolOperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SqlPoolBlobAuditingPolicySqlPoolOperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/operations'} # 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 9beb5a13ba00..239b5023f19f 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 @@ -1,118 +1,198 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class SqlPoolReplicationLinksOperations(object): """SqlPoolReplicationLinksOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def list( - self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + sql_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ReplicationLinkListResult"] """Get SQL pool replication links. Lists a Sql pool's replication links. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of ReplicationLink - :rtype: - ~azure.mgmt.synapse.models.ReplicationLinkPaged[~azure.mgmt.synapse.models.ReplicationLink] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ReplicationLinkListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.ReplicationLinkListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationLinkListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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'] + 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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ReplicationLinkListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ReplicationLinkPaged(internal_paging, self._deserialize.dependencies, header_dict) + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/replicationLinks'} # type: ignore + + 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" + """Get SQL pool replication link by name. + + Get SQL pool replication link by name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param link_id: The ID of the replication link. + :type link_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ReplicationLink, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.ReplicationLink + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationLink"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ReplicationLink', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/replicationLinks'} + 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 6968f5cf7a0a..30a13553a2b1 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 @@ -1,229 +1,397 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +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]] class SqlPoolRestorePointsOperations(object): """SqlPoolRestorePointsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def list( - self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + sql_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.RestorePointListResult"] """Get SQL pool backup. Get SQL pool backup information. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of RestorePoint - :rtype: - ~azure.mgmt.synapse.models.RestorePointPaged[~azure.mgmt.synapse.models.RestorePoint] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RestorePointListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.RestorePointListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePointListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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'] + 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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('RestorePointListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.RestorePointPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints'} + return pipeline_response + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints'} # type: ignore def _create_initial( - self, resource_group_name, workspace_name, sql_pool_name, restore_point_label, custom_headers=None, raw=False, **operation_config): - parameters = models.CreateSqlPoolRestorePointDefinition(restore_point_label=restore_point_label) + 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"] + 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 = "2019-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'CreateSqlPoolRestorePointDefinition') + 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') - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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 if response.status_code not in [200, 201, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('RestorePoint', response) + deserialized = self._deserialize('RestorePoint', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('RestorePoint', response) + deserialized = self._deserialize('RestorePoint', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create( - self, resource_group_name, workspace_name, sql_pool_name, restore_point_label, custom_headers=None, raw=False, polling=True, **operation_config): + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints'} # type: ignore + + 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"] """Creates a restore point for a data warehouse. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param restore_point_label: The restore point label to apply - :type restore_point_label: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param parameters: The definition for creating the restore point of this Sql pool. + :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: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns RestorePoint or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.synapse.models.RestorePoint] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.synapse.models.RestorePoint]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either RestorePoint or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.RestorePoint] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_initial( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - sql_pool_name=sql_pool_name, - restore_point_label=restore_point_label, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('RestorePoint', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('RestorePoint', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/restorePoints'} # type: ignore + + 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" + """Gets a restore point. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param restore_point_name: The name of the restore point. + :type restore_point_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RestorePoint, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.RestorePoint + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RestorePoint"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RestorePoint', pipeline_response) + + if cls: + 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 + + 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 + """Deletes a restore point. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param restore_point_name: The name of the restore point. + :type restore_point_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + + # 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 494a8374b914..6a5b521e6f95 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 @@ -1,123 +1,199 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class SqlPoolSchemasOperations(object): """SqlPoolSchemasOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def list( - self, resource_group_name, workspace_name, sql_pool_name, filter=None, custom_headers=None, raw=False, **operation_config): + 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"] """Gets schemas of a given SQL pool. Gets schemas of a given SQL pool. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param filter: An OData filter expression that filters elements in the - collection. + :param filter: An OData filter expression that filters elements in the collection. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SqlPoolSchema - :rtype: - ~azure.mgmt.synapse.models.SqlPoolSchemaPaged[~azure.mgmt.synapse.models.SqlPoolSchema] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SqlPoolSchemaListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.SqlPoolSchemaListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolSchemaListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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'] + 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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + 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) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SqlPoolSchemaListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SqlPoolSchemaPaged(internal_paging, self._deserialize.dependencies, header_dict) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas'} # type: ignore + + 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.Resource" + """Get Sql Pool schema. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Resource, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.Resource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Resource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Resource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas'} + 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 1dfb1ad5c3c6..5c175c386d9e 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 @@ -1,187 +1,277 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class SqlPoolSecurityAlertPoliciesOperations(object): """SqlPoolSecurityAlertPoliciesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". - :ivar security_alert_policy_name: The name of the security alert policy. Constant value: "default". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - self.security_alert_policy_name = "default" + self._config = config + + def list( + self, + resource_group_name, # type: str + workspace_name, # type: str + sql_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ListSqlPoolSecurityAlertPolicies"] + """List Sql pool's security alert policies. + + Get a list of Sql pool's security alert policies. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListSqlPoolSecurityAlertPolicies"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ListSqlPoolSecurityAlertPolicies', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) - self.config = config + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies'} # type: ignore def get( - self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, **operation_config): + 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" """Get a Sql pool's security alert policy. Get a Sql pool's security alert policy. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SqlPoolSecurityAlertPolicy or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.SqlPoolSecurityAlertPolicy or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param security_alert_policy_name: The name of the security alert policy. + :type security_alert_policy_name: str or ~azure.mgmt.synapse.models.SecurityAlertPolicyName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlPoolSecurityAlertPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SqlPoolSecurityAlertPolicy + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolSecurityAlertPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'securityAlertPolicyName': self._serialize.url("self.security_alert_policy_name", self.security_alert_policy_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SqlPoolSecurityAlertPolicy', response) + deserialized = self._deserialize('SqlPoolSecurityAlertPolicy', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies/{securityAlertPolicyName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies/{securityAlertPolicyName}'} # type: ignore def create_or_update( - self, resource_group_name, workspace_name, sql_pool_name, parameters, custom_headers=None, raw=False, **operation_config): + 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" """Create or update a Sql pool's security alert policy. Create or update a Sql pool's security alert policy. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_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.SecurityAlertPolicyName :param parameters: The Sql pool security alert policy. - :type parameters: - ~azure.mgmt.synapse.models.SqlPoolSecurityAlertPolicy - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SqlPoolSecurityAlertPolicy or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.SqlPoolSecurityAlertPolicy or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :type parameters: ~azure.mgmt.synapse.models.SqlPoolSecurityAlertPolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlPoolSecurityAlertPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SqlPoolSecurityAlertPolicy + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolSecurityAlertPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create_or_update.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'securityAlertPolicyName': self._serialize.url("self.security_alert_policy_name", self.security_alert_policy_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'SqlPoolSecurityAlertPolicy') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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 if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SqlPoolSecurityAlertPolicy', response) + deserialized = self._deserialize('SqlPoolSecurityAlertPolicy', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SqlPoolSecurityAlertPolicy', response) + deserialized = self._deserialize('SqlPoolSecurityAlertPolicy', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/securityAlertPolicies/{securityAlertPolicyName}'} + 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 22ac677faa4c..ebd71c2a87d9 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 @@ -1,174 +1,197 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class SqlPoolSensitivityLabelsOperations(object): """SqlPoolSensitivityLabelsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def list_current( - self, resource_group_name, workspace_name, sql_pool_name, filter=None, custom_headers=None, raw=False, **operation_config): + 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"] """Gets SQL pool sensitivity labels. Gets SQL pool sensitivity labels. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param filter: An OData filter expression that filters elements in the - collection. + :param filter: An OData filter expression that filters elements in the collection. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SensitivityLabel - :rtype: - ~azure.mgmt.synapse.models.SensitivityLabelPaged[~azure.mgmt.synapse.models.SensitivityLabel] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SensitivityLabelListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.SensitivityLabelListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SensitivityLabelListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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_current.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + 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) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SensitivityLabelListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SensitivityLabelPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_current.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/currentSensitivityLabels'} + return ItemPaged( + get_next, extract_data + ) + list_current.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/currentSensitivityLabels'} # type: ignore def list_recommended( - self, resource_group_name, workspace_name, sql_pool_name, include_disabled_recommendations=None, skip_token=None, filter=None, custom_headers=None, raw=False, **operation_config): + 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"] """Gets sensitivity labels of a given SQL pool. Gets sensitivity labels of a given SQL pool. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param include_disabled_recommendations: Specifies whether to include - disabled recommendations or not. + :param include_disabled_recommendations: Specifies whether to include disabled recommendations + or not. :type include_disabled_recommendations: bool - :param skip_token: An OData query option to indicate how many elements - to skip in the collection. - :type skip_token: str - :param filter: An OData filter expression that filters elements in the + :param skip_token: An OData query option to indicate how many elements to skip in the collection. + :type skip_token: str + :param filter: An OData filter expression that filters elements in the collection. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SensitivityLabel - :rtype: - ~azure.mgmt.synapse.models.SensitivityLabelPaged[~azure.mgmt.synapse.models.SensitivityLabel] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SensitivityLabelListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.SensitivityLabelListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SensitivityLabelListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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_recommended.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + 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: @@ -176,56 +199,56 @@ def prepare_request(next_link=None): if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SensitivityLabelListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SensitivityLabelPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_recommended.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/recommendedSensitivityLabels'} + return ItemPaged( + get_next, extract_data + ) + list_recommended.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/recommendedSensitivityLabels'} # type: ignore def create_or_update( - self, resource_group_name, workspace_name, sql_pool_name, schema_name, table_name, column_name, parameters, custom_headers=None, raw=False, **operation_config): - """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. + 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" + """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. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param schema_name: The name of the schema. :type schema_name: str @@ -235,82 +258,85 @@ def create_or_update( :type column_name: str :param parameters: The column sensitivity label resource. :type parameters: ~azure.mgmt.synapse.models.SensitivityLabel - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SensitivityLabel or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.SensitivityLabel or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SensitivityLabel, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SensitivityLabel + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SensitivityLabel"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" sensitivity_label_source = "current" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), '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') + 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'SensitivityLabel') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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 if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SensitivityLabel', response) + deserialized = self._deserialize('SensitivityLabel', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SensitivityLabel', response) + deserialized = self._deserialize('SensitivityLabel', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}'} + 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 def delete( - self, resource_group_name, workspace_name, sql_pool_name, schema_name, table_name, column_name, custom_headers=None, raw=False, **operation_config): + 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 """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. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param schema_name: The name of the schema. :type schema_name: str @@ -318,69 +344,151 @@ def delete( :type table_name: str :param column_name: The name of the column. :type column_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" sensitivity_label_source = "current" # Construct URL - url = self.delete.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), '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') + 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}'} # type: ignore + + 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" + """Gets the sensitivity label of a given column. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :param column_name: The name of the column. + :type column_name: str + :param sensitivity_label_source: The source of the sensitivity label. + :type sensitivity_label_source: str or ~azure.mgmt.synapse.models.SensitivityLabelSource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SensitivityLabel, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SensitivityLabel + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SensitivityLabel"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = 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]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}'} + deserialized = self._deserialize('SensitivityLabel', pipeline_response) - def enable_recommendation( - self, resource_group_name, workspace_name, sql_pool_name, schema_name, table_name, column_name, custom_headers=None, raw=False, **operation_config): - """Enables sensitivity recommendations on a given column (recommendations - are enabled by default on all columns). + if cls: + 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 - :param resource_group_name: The name of the resource group. The name - is case insensitive. + 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 + """Enables sensitivity recommendations on a given column (recommendations are enabled by default + on all columns). + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param schema_name: The name of the schema. :type schema_name: str @@ -388,68 +496,71 @@ def enable_recommendation( :type table_name: str :param column_name: The name of the column. :type column_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" sensitivity_label_source = "recommended" # Construct URL - url = self.enable_recommendation.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), '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') + 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - enable_recommendation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/enable'} + 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 def disable_recommendation( - self, resource_group_name, workspace_name, sql_pool_name, schema_name, table_name, column_name, custom_headers=None, raw=False, **operation_config): + 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 """Disables sensitivity recommendations on a given column. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param schema_name: The name of the schema. :type schema_name: str @@ -457,54 +568,49 @@ def disable_recommendation( :type table_name: str :param column_name: The name of the column. :type column_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" sensitivity_label_source = "recommended" # Construct URL - url = self.disable_recommendation.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), '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') + 'sensitivityLabelSource': self._serialize.url("sensitivity_label_source", sensitivity_label_source, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - disable_recommendation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns/{columnName}/sensitivityLabels/{sensitivityLabelSource}/disable'} + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + disable_recommendation.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 0a0d60cd6346..724ed47ad928 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 @@ -1,129 +1,140 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class SqlPoolTableColumnsOperations(object): """SqlPoolTableColumnsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def list_by_table_name( - self, resource_group_name, workspace_name, sql_pool_name, schema_name, table_name, filter=None, custom_headers=None, raw=False, **operation_config): + 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"] """Gets columns in a given table in a SQL pool. Gets columns in a given table in a SQL pool. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param schema_name: The name of the schema. :type schema_name: str :param table_name: The name of the table. :type table_name: str - :param filter: An OData filter expression that filters elements in the - collection. + :param filter: An OData filter expression that filters elements in the collection. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SqlPoolColumn - :rtype: - ~azure.mgmt.synapse.models.SqlPoolColumnPaged[~azure.mgmt.synapse.models.SqlPoolColumn] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SqlPoolColumnListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.SqlPoolColumnListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolColumnListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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_table_name.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), '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') + 'tableName': self._serialize.url("table_name", table_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + 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) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SqlPoolColumnListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SqlPoolColumnPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_table_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns'} + return ItemPaged( + get_next, extract_data + ) + list_by_table_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables/{tableName}/columns'} # type: ignore 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 b3c976f2f37e..c0259af9c6f4 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 @@ -1,126 +1,207 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class SqlPoolTablesOperations(object): """SqlPoolTablesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def list_by_schema( - self, resource_group_name, workspace_name, sql_pool_name, schema_name, filter=None, custom_headers=None, raw=False, **operation_config): + 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"] """Gets tables of a given schema in a SQL pool. Gets tables of a given schema in a SQL pool. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str :param schema_name: The name of the schema. :type schema_name: str - :param filter: An OData filter expression that filters elements in the - collection. + :param filter: An OData filter expression that filters elements in the collection. :type filter: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SqlPoolTable - :rtype: - ~azure.mgmt.synapse.models.SqlPoolTablePaged[~azure.mgmt.synapse.models.SqlPoolTable] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SqlPoolTableListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.SqlPoolTableListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolTableListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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_schema.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), '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') + 'schemaName': self._serialize.url("schema_name", schema_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + 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) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SqlPoolTableListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SqlPoolTablePaged(internal_paging, self._deserialize.dependencies, header_dict) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_schema.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables'} # type: ignore + + 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.Resource" + """Get Sql pool table. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param schema_name: The name of the schema. + :type schema_name: str + :param table_name: The name of the table. + :type table_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Resource, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.Resource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Resource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Resource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - list_by_schema.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/schemas/{schemaName}/tables'} + 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 2fec55949720..ba0178ac9e16 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 @@ -1,192 +1,282 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class SqlPoolTransparentDataEncryptionsOperations(object): """SqlPoolTransparentDataEncryptionsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". - :ivar transparent_data_encryption_name: The name of the transparent data encryption configuration. Constant value: "current". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - self.transparent_data_encryption_name = "current" - - self.config = config + self._config = config def get( - self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, **operation_config): + 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" """Get a SQL pool's transparent data encryption configuration. Get a SQL pool's transparent data encryption configuration. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TransparentDataEncryption or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.TransparentDataEncryption or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 + :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 + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TransparentDataEncryption"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'transparentDataEncryptionName': self._serialize.url("self.transparent_data_encryption_name", self.transparent_data_encryption_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('TransparentDataEncryption', response) + deserialized = self._deserialize('TransparentDataEncryption', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption/{transparentDataEncryptionName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption/{transparentDataEncryptionName}'} # type: ignore def create_or_update( - self, resource_group_name, workspace_name, sql_pool_name, status=None, custom_headers=None, raw=False, **operation_config): - """Creates or updates a Sql pool's transparent data encryption - configuration. - - Creates or updates a Sql pool's transparent data encryption - configuration. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. + 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" + """Creates or updates a Sql pool's transparent data encryption configuration. + + Creates or updates a Sql pool's transparent data encryption configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: 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 - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: TransparentDataEncryption or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.TransparentDataEncryption or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 + :param parameters: The required parameters for creating or updating transparent data + encryption. + :type parameters: ~azure.mgmt.synapse.models.TransparentDataEncryption + :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 + :raises: ~azure.core.exceptions.HttpResponseError """ - parameters = models.TransparentDataEncryption(status=status) + cls = kwargs.pop('cls', None) # type: ClsType["_models.TransparentDataEncryption"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'transparentDataEncryptionName': self._serialize.url("self.transparent_data_encryption_name", self.transparent_data_encryption_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'TransparentDataEncryption') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('TransparentDataEncryption', response) + deserialized = self._deserialize('TransparentDataEncryption', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('TransparentDataEncryption', response) + deserialized = self._deserialize('TransparentDataEncryption', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption/{transparentDataEncryptionName}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption/{transparentDataEncryptionName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + workspace_name, # type: str + sql_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.TransparentDataEncryptionListResult"] + """SQL pool's transparent data encryption configurations. + + Get list of SQL pool's transparent data encryption configurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.TransparentDataEncryptionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('TransparentDataEncryptionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/transparentDataEncryption'} # type: ignore 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 e817cb97c5e4..dfa6bb290b3a 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 @@ -1,118 +1,128 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class SqlPoolUsagesOperations(object): """SqlPoolUsagesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def list( - self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + sql_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SqlPoolUsageListResult"] """Gets SQL pool usages. Gets SQL pool usages. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SqlPoolUsage - :rtype: - ~azure.mgmt.synapse.models.SqlPoolUsagePaged[~azure.mgmt.synapse.models.SqlPoolUsage] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SqlPoolUsageListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.SqlPoolUsageListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolUsageListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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'] + 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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SqlPoolUsageListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SqlPoolUsagePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/usages'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/usages'} # type: ignore 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 d032c532c8d2..50afad6cc83d 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 @@ -1,197 +1,276 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class SqlPoolVulnerabilityAssessmentRuleBaselinesOperations(object): """SqlPoolVulnerabilityAssessmentRuleBaselinesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". - :ivar vulnerability_assessment_name: The name of the vulnerability assessment. Constant value: "default". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - self.vulnerability_assessment_name = "default" - - self.config = config + self._config = config def create_or_update( - self, resource_group_name, workspace_name, sql_pool_name, rule_id, baseline_name, baseline_results, custom_headers=None, raw=False, **operation_config): + 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" """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. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :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 :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). Possible values include: 'master', - 'default' - :type baseline_name: str or - ~azure.mgmt.synapse.models.VulnerabilityAssessmentPolicyBaselineName - :param baseline_results: The rule baseline result - :type baseline_results: - list[~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessmentRuleBaselineItem] - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SqlPoolVulnerabilityAssessmentRuleBaseline or - ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessmentRuleBaseline - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 + :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 + :return: SqlPoolVulnerabilityAssessmentRuleBaseline, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessmentRuleBaseline + :raises: ~azure.core.exceptions.HttpResponseError """ - parameters = models.SqlPoolVulnerabilityAssessmentRuleBaseline(baseline_results=baseline_results) + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolVulnerabilityAssessmentRuleBaseline"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_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, 'VulnerabilityAssessmentPolicyBaselineName') + 'baselineName': self._serialize.url("baseline_name", baseline_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'SqlPoolVulnerabilityAssessmentRuleBaseline') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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 if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SqlPoolVulnerabilityAssessmentRuleBaseline', response) + deserialized = self._deserialize('SqlPoolVulnerabilityAssessmentRuleBaseline', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}'} # type: ignore def delete( - self, resource_group_name, workspace_name, sql_pool_name, rule_id, baseline_name, custom_headers=None, raw=False, **operation_config): + 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 """Removes the database's vulnerability assessment rule baseline. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :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 :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). Possible values include: 'master', - 'default' - :type baseline_name: str or - ~azure.mgmt.synapse.models.VulnerabilityAssessmentPolicyBaselineName - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param 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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + 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 = "2019-06-01-preview" + # Construct URL - url = self.delete.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_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, 'VulnerabilityAssessmentPolicyBaselineName') + 'baselineName': self._serialize.url("baseline_name", baseline_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}'} # type: ignore + + 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" + """Gets a SqlPool's vulnerability assessment rule baseline. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :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 + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolVulnerabilityAssessmentRuleBaseline"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['Accept'] = self._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]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/rules/{ruleId}/baselines/{baselineName}'} + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SqlPoolVulnerabilityAssessmentRuleBaseline', pipeline_response) + + if cls: + 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 127f1b45b025..df338fa68217 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 @@ -1,289 +1,408 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +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]] class SqlPoolVulnerabilityAssessmentScansOperations(object): """SqlPoolVulnerabilityAssessmentScansOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". - :ivar vulnerability_assessment_name: The name of the vulnerability assessment. Constant value: "default". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - self.vulnerability_assessment_name = "default" - - self.config = config + self._config = config def list( - self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, **operation_config): + 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"] """Lists the vulnerability assessment scans of a SQL pool. Lists the vulnerability assessment scans of a SQL pool. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of - VulnerabilityAssessmentScanRecord - :rtype: - ~azure.mgmt.synapse.models.VulnerabilityAssessmentScanRecordPaged[~azure.mgmt.synapse.models.VulnerabilityAssessmentScanRecord] - :raises: :class:`CloudError` + :param vulnerability_assessment_name: The name of the vulnerability assessment. + :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] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VulnerabilityAssessmentScanRecordListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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'] + 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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('VulnerabilityAssessmentScanRecordListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response - - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.VulnerabilityAssessmentScanRecordPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans'} + return pipeline_response + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans'} # type: ignore def _initiate_scan_initial( - self, resource_group_name, workspace_name, sql_pool_name, scan_id, custom_headers=None, raw=False, **operation_config): + 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 + 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 = "2019-06-01-preview" + # Construct URL - url = self.initiate_scan.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'), - 'scanId': self._serialize.url("scan_id", scan_id, '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def initiate_scan( - self, resource_group_name, workspace_name, sql_pool_name, scan_id, custom_headers=None, raw=False, polling=True, **operation_config): + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _initiate_scan_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan'} # type: ignore + + 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] """Executes a Vulnerability Assessment database scan. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param scan_id: The vulnerability assessment scan Id of the scan to - retrieve. + :param vulnerability_assessment_name: The name of the vulnerability assessment. + :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 - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._initiate_scan_initial( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - sql_pool_name=sql_pool_name, - scan_id=scan_id, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._initiate_scan_initial( + 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, + 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, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - initiate_scan.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_initiate_scan.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}/scans/{scanId}/initiateScan'} # type: ignore def export( - self, resource_group_name, workspace_name, sql_pool_name, scan_id, custom_headers=None, raw=False, **operation_config): - """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. + 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" + """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. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param scan_id: The vulnerability assessment scan Id of the scan to - retrieve. + :param vulnerability_assessment_name: The name of the vulnerability assessment. + :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 - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SqlPoolVulnerabilityAssessmentScansExport or - ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessmentScansExport - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlPoolVulnerabilityAssessmentScansExport, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessmentScansExport + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolVulnerabilityAssessmentScansExport"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.export.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_name, 'str'), - 'scanId': self._serialize.url("scan_id", scan_id, '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SqlPoolVulnerabilityAssessmentScansExport', response) + deserialized = self._deserialize('SqlPoolVulnerabilityAssessmentScansExport', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SqlPoolVulnerabilityAssessmentScansExport', response) + deserialized = self._deserialize('SqlPoolVulnerabilityAssessmentScansExport', pipeline_response) + + if cls: + 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 + + 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" + """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. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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 + :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 + :return: VulnerabilityAssessmentScanRecord, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.VulnerabilityAssessmentScanRecord + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VulnerabilityAssessmentScanRecord"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VulnerabilityAssessmentScanRecord', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + 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'} + 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 8eae22c5cd15..3c525b1e0310 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 @@ -1,327 +1,341 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class SqlPoolVulnerabilityAssessmentsOperations(object): """SqlPoolVulnerabilityAssessmentsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". - :ivar vulnerability_assessment_name: The name of the vulnerability assessment. Constant value: "default". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - self.vulnerability_assessment_name = "default" - - self.config = config + self._config = config def list( - self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + sql_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SqlPoolVulnerabilityAssessmentListResult"] """Lists the vulnerability assessment policies associated with a SQL pool. Lists the vulnerability assessment policies associated with a SQL pool. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SqlPoolVulnerabilityAssessment - :rtype: - ~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessmentPaged[~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessment] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either 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"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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'] + 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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SqlPoolVulnerabilityAssessmentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SqlPoolVulnerabilityAssessmentPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments'} # type: ignore def get( - self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, **operation_config): + 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" """Gets the Sql pool's vulnerability assessment. Gets the Sql pool's vulnerability assessment. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SqlPoolVulnerabilityAssessment or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessment or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param vulnerability_assessment_name: The name of the vulnerability assessment. + :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 + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolVulnerabilityAssessment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SqlPoolVulnerabilityAssessment', response) + deserialized = self._deserialize('SqlPoolVulnerabilityAssessment', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} # type: ignore def create_or_update( - self, resource_group_name, workspace_name, sql_pool_name, parameters, custom_headers=None, raw=False, **operation_config): + 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" """Creates or updates the Sql pool vulnerability assessment. Creates or updates the Sql pool vulnerability assessment. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :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 :param parameters: The requested resource. - :type parameters: - ~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessment - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SqlPoolVulnerabilityAssessment or ClientRawResponse if - raw=true - :rtype: ~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessment or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :type parameters: ~azure.mgmt.synapse.models.SqlPoolVulnerabilityAssessment + :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 + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolVulnerabilityAssessment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create_or_update.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'SqlPoolVulnerabilityAssessment') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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 if response.status_code not in [200, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SqlPoolVulnerabilityAssessment', response) + deserialized = self._deserialize('SqlPoolVulnerabilityAssessment', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('SqlPoolVulnerabilityAssessment', response) + deserialized = self._deserialize('SqlPoolVulnerabilityAssessment', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} # type: ignore def delete( - self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, **operation_config): + 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 """Removes the database's vulnerability assessment. Removes the database's vulnerability assessment. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param vulnerability_assessment_name: The name of the vulnerability assessment. + :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 + :raises: ~azure.core.exceptions.HttpResponseError """ + 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 = "2019-06-01-preview" + # Construct URL - url = self.delete.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_name, 'str'), - 'vulnerabilityAssessmentName': self._serialize.url("self.vulnerability_assessment_name", self.vulnerability_assessment_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 new file mode 100644 index 000000000000..62c86daa0a58 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_workload_classifier_operations.py @@ -0,0 +1,491 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +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]] + +class SqlPoolWorkloadClassifierOperations(object): + """SqlPoolWorkloadClassifierOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + 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" + """Get workload classifier. + + Get a workload classifier of Sql pool's workload group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param workload_group_name: The name of the workload group. + :type workload_group_name: str + :param workload_classifier_name: The name of the workload classifier. + :type workload_classifier_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkloadClassifier, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.WorkloadClassifier + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadClassifier"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WorkloadClassifier', pipeline_response) + + if cls: + 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"] + 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['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, '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 + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WorkloadClassifier', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('WorkloadClassifier', pipeline_response) + + if cls: + 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 + + 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"] + """Create Or Update workload classifier. + + Create Or Update workload classifier for a Sql pool's workload group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param workload_group_name: The name of the workload group. + :type workload_group_name: str + :param workload_classifier_name: The name of the workload classifier. + :type workload_classifier_name: str + :param parameters: The properties of the workload classifier. + :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: True for ARMPolling, False for no polling, or a + polling object for 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.WorkloadClassifier] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadClassifier"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + 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, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 + 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 = "2019-06-01-preview" + + # 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = 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) + 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}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}'} # type: ignore + + 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] + """Remove workload classifier. + + Remove workload classifier of a Sql pool's workload group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param workload_group_name: The name of the workload group. + :type workload_group_name: str + :param workload_classifier_name: The name of the workload classifier. + :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: True for ARMPolling, False for no polling, or a + polling object for 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + workload_group_name=workload_group_name, + workload_classifier_name=workload_classifier_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers/{workloadClassifierName}'} # type: ignore + + 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"] + """Sql pool's workload classifier. + + Get list of Sql pool's workload classifier for workload groups. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :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.paging.ItemPaged[~azure.mgmt.synapse.models.WorkloadClassifierListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadClassifierListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('WorkloadClassifierListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}/workloadClassifiers'} # type: ignore 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 new file mode 100644 index 000000000000..e4686e7cc80d --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_sql_pool_workload_group_operations.py @@ -0,0 +1,469 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +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]] + +class SqlPoolWorkloadGroupOperations(object): + """SqlPoolWorkloadGroupOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + 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" + """Sql pool's workload group. + + Get a Sql pool's workload group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :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: WorkloadGroup, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.WorkloadGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WorkloadGroup', pipeline_response) + + if cls: + 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"] + 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['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, '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 + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('WorkloadGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('WorkloadGroup', pipeline_response) + + if cls: + 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 + + 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"] + """Create Or Update workload group. + + Create Or Update a Sql pool's workload group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :param workload_group_name: The name of the workload group. + :type workload_group_name: str + :param parameters: The requested workload group state. + :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: True for ARMPolling, False for no polling, or a + polling object for 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.WorkloadGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadGroup"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + workload_group_name=workload_group_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 + 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 = "2019-06-01-preview" + + # 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = 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) + 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}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}'} # type: ignore + + 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] + """Remove workload group. + + Remove Sql pool's workload group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_pool_name: SQL pool name. + :type sql_pool_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + workload_group_name=workload_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups/{workloadGroupName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + workspace_name, # type: str + sql_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.WorkloadGroupListResult"] + """Sql pool's workload groups. + + Get list of Sql pool's workload groups. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :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.paging.ItemPaged[~azure.mgmt.synapse.models.WorkloadGroupListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadGroupListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('WorkloadGroupListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/workloadGroups'} # type: ignore 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 f0516d64e79f..85e2234fd1f3 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 @@ -1,725 +1,793 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +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]] class SqlPoolsOperations(object): """SqlPoolsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + sql_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SqlPool" """Get SQL pool. Get SQL pool properties. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SqlPool or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.SqlPool or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlPool, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SqlPool + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SqlPool', response) + deserialized = self._deserialize('SqlPool', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} # type: ignore def update( - self, resource_group_name, workspace_name, sql_pool_name, sql_pool_info, custom_headers=None, raw=False, **operation_config): + 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"] """Update SQL pool. Apply a partial update to a SQL pool. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param sql_pool_info: The updated SQL pool properties + :param sql_pool_info: The updated SQL pool properties. :type sql_pool_info: ~azure.mgmt.synapse.models.SqlPoolPatchInfo - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SqlPool or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.SqlPool or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SqlPool, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.SqlPool or None + :raises: ~azure.core.exceptions.HttpResponseError """ + 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 = "2019-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.update.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(sql_pool_info, 'SqlPoolPatchInfo') + 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') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SqlPool', response) + deserialized = self._deserialize('SqlPool', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} - + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} # type: ignore def _create_initial( - self, resource_group_name, workspace_name, sql_pool_name, sql_pool_info, custom_headers=None, raw=False, **operation_config): + 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"] + 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 = "2019-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(sql_pool_info, 'SqlPool') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ErrorContractException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SqlPool', response) + deserialized = self._deserialize('SqlPool', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create( - self, resource_group_name, workspace_name, sql_pool_name, sql_pool_info, custom_headers=None, raw=False, polling=True, **operation_config): + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} # type: ignore + + 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"] """Create SQL pool. Create a SQL pool. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param sql_pool_info: The SQL pool to create + :param sql_pool_info: The SQL pool to create. :type sql_pool_info: ~azure.mgmt.synapse.models.SqlPool - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns SqlPool or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.synapse.models.SqlPool] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.synapse.models.SqlPool]] - :raises: - :class:`ErrorContractException` + :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 SqlPool or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.SqlPool] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_initial( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - sql_pool_name=sql_pool_name, - sql_pool_info=sql_pool_info, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPool"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('SqlPool', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + sql_pool_info=sql_pool_info, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('SqlPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} # type: ignore def _delete_initial( - self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + sql_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[object] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[object]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - raise models.ErrorContractException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('object', response) + deserialized = self._deserialize('object', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('object', response) + deserialized = self._deserialize('object', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def delete( - self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, polling=True, **operation_config): + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + workspace_name, # type: str + sql_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[object] """Delete SQL pool. Delete a SQL pool. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns object or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[object] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[object]] - :raises: - :class:`ErrorContractException` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either object or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[object] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - sql_pool_name=sql_pool_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[object] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('object', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}'} # type: ignore def list_by_workspace( - self, resource_group_name, workspace_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SqlPoolInfoListResult"] """List SQL pools. List all SQL pools. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of SqlPool - :rtype: - ~azure.mgmt.synapse.models.SqlPoolPaged[~azure.mgmt.synapse.models.SqlPool] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SqlPoolInfoListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.SqlPoolInfoListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SqlPoolInfoListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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'] + 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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str') + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('SqlPoolInfoListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.SqlPoolPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized - list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools'} + return pipeline_response + return ItemPaged( + get_next, extract_data + ) + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools'} # type: ignore def _pause_initial( - self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + sql_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[object] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[object]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.pause.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('object', response) + deserialized = self._deserialize('object', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def pause( - self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, polling=True, **operation_config): + _pause_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/pause'} # type: ignore + + def begin_pause( + self, + resource_group_name, # type: str + workspace_name, # type: str + sql_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[object] """Pause SQL pool. Pause a SQL pool. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns object or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[object] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[object]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either object or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[object] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._pause_initial( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - sql_pool_name=sql_pool_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[object] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('object', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._pause_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - pause.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/pause'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_pause.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/pause'} # type: ignore def _resume_initial( - self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + sql_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[object] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[object]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.resume.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('object', response) + deserialized = self._deserialize('object', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def resume( - self, resource_group_name, workspace_name, sql_pool_name, custom_headers=None, raw=False, polling=True, **operation_config): + _resume_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/resume'} # type: ignore + + def begin_resume( + self, + resource_group_name, # type: str + workspace_name, # type: str + sql_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[object] """Resume SQL pool. Resume a SQL pool. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param sql_pool_name: SQL pool name + :param sql_pool_name: SQL pool name. :type sql_pool_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns object or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[object] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[object]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either object or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[object] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._resume_initial( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - sql_pool_name=sql_pool_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[object] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('object', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._resume_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + sql_pool_name=sql_pool_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - resume.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/resume'} - - def rename( - self, resource_group_name, workspace_name, sql_pool_name, id, custom_headers=None, raw=False, **operation_config): - """Rename a SQL pool. - - Rename a SQL pool. - - :param resource_group_name: The name of the resource group. The name - is case insensitive. - :type resource_group_name: str - :param workspace_name: The name of the workspace - :type workspace_name: str - :param sql_pool_name: SQL pool name - :type sql_pool_name: str - :param id: The target ID for the resource - :type id: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ - parameters = models.ResourceMoveDefinition(id=id) - - # Construct URL - url = self.rename.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), - 'sqlPoolName': self._serialize.url("sql_pool_name", sql_pool_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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) - # Construct headers - header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'ResourceMoveDefinition') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - rename.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/move'} + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_resume.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlPools/{sqlPoolName}/resume'} # 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 5d7a534ec839..be9966c5cdc7 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 @@ -1,286 +1,349 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +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]] class WorkspaceAadAdminsOperations(object): """WorkspaceAadAdminsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, workspace_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.WorkspaceAadAdminInfo" """Gets a workspace active directory admin. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: WorkspaceAadAdminInfo or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.WorkspaceAadAdminInfo or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceAadAdminInfo, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.WorkspaceAadAdminInfo + :raises: ~azure.core.exceptions.HttpResponseError """ + 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 = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str') + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('WorkspaceAadAdminInfo', response) + deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory'} - + 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, workspace_name, aad_admin_info, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + aad_admin_info, # type: "_models.WorkspaceAadAdminInfo" + **kwargs # type: Any + ): + # type: (...) -> "_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 = "2019-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create_or_update.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str') + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(aad_admin_info, 'WorkspaceAadAdminInfo') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ErrorContractException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('WorkspaceAadAdminInfo', response) + deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('WorkspaceAadAdminInfo', response) + deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, workspace_name, aad_admin_info, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory'} # type: ignore + + 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"] """Creates or updates a workspace active directory admin. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param aad_admin_info: Workspace active directory administrator - properties + :param aad_admin_info: Workspace active directory administrator properties. :type aad_admin_info: ~azure.mgmt.synapse.models.WorkspaceAadAdminInfo - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns WorkspaceAadAdminInfo - or ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.synapse.models.WorkspaceAadAdminInfo] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.synapse.models.WorkspaceAadAdminInfo]] - :raises: - :class:`ErrorContractException` + :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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.WorkspaceAadAdminInfo] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - aad_admin_info=aad_admin_info, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceAadAdminInfo"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('WorkspaceAadAdminInfo', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + aad_admin_info=aad_admin_info, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory'} # type: ignore def _delete_initial( - self, resource_group_name, workspace_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str') + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) - - if response.status_code not in [200, 202]: - raise models.ErrorContractException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - def delete( - self, resource_group_name, workspace_name, custom_headers=None, raw=False, polling=True, **operation_config): + 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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] """Deletes a workspace active directory admin. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`ErrorContractException` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + } - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/administrators/activeDirectory'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 3bbafefe441d..214c40759bb1 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 @@ -1,175 +1,179 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +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]] class WorkspaceManagedIdentitySqlControlSettingsOperations(object): """WorkspaceManagedIdentitySqlControlSettingsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def get( - self, resource_group_name, workspace_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ManagedIdentitySqlControlSettingsModel" """Get Managed Identity Sql Control Settings. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + Get Managed Identity Sql Control Settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ManagedIdentitySqlControlSettingsModel or ClientRawResponse - if raw=true - :rtype: - ~azure.mgmt.synapse.models.ManagedIdentitySqlControlSettingsModel or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorContractException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedIdentitySqlControlSettingsModel, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.ManagedIdentitySqlControlSettingsModel + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedIdentitySqlControlSettingsModel"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str') + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ErrorContractException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('ManagedIdentitySqlControlSettingsModel', response) + deserialized = self._deserialize('ManagedIdentitySqlControlSettingsModel', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/managedIdentitySqlControlSettings/default'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/managedIdentitySqlControlSettings/default'} # type: ignore def create_or_update( - self, resource_group_name, workspace_name, grant_sql_control_to_managed_identity=None, custom_headers=None, raw=False, **operation_config): + 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"] """Create or update Managed Identity Sql Control Settings. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + Create or update Managed Identity Sql Control Settings. + + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: 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 - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: ManagedIdentitySqlControlSettingsModel or ClientRawResponse - if raw=true - :rtype: - ~azure.mgmt.synapse.models.ManagedIdentitySqlControlSettingsModel or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorContractException` + :param managed_identity_sql_control_settings: Managed Identity Sql Control Settings. + :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 + :return: ManagedIdentitySqlControlSettingsModel, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.ManagedIdentitySqlControlSettingsModel or None + :raises: ~azure.core.exceptions.HttpResponseError """ - managed_identity_sql_control_settings = models.ManagedIdentitySqlControlSettingsModel(grant_sql_control_to_managed_identity=grant_sql_control_to_managed_identity) + 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 = "2019-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" # Construct URL - url = self.create_or_update.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str') + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(managed_identity_sql_control_settings, 'ManagedIdentitySqlControlSettingsModel') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ErrorContractException(self._deserialize, response) + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('ManagedIdentitySqlControlSettingsModel', response) + deserialized = self._deserialize('ManagedIdentitySqlControlSettingsModel', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/managedIdentitySqlControlSettings/default'} + 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 new file mode 100644 index 000000000000..45bc456b33c6 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_blob_auditing_policies_operations.py @@ -0,0 +1,327 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +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]] + +class WorkspaceManagedSqlServerBlobAuditingPoliciesOperations(object): + """WorkspaceManagedSqlServerBlobAuditingPoliciesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + 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" + """Get server's blob auditing policy. + + Get a workspace managed sql server's blob auditing policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param blob_auditing_policy_name: The name of the blob auditing policy. + :type blob_auditing_policy_name: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServerBlobAuditingPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.ServerBlobAuditingPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerBlobAuditingPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ServerBlobAuditingPolicy', pipeline_response) + + if cls: + 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"] + 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['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, '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 + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ServerBlobAuditingPolicy', pipeline_response) + + if cls: + 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 + + 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"] + """Create or Update server's blob auditing policy. + + Create or Update a workspace managed sql server's blob auditing policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param blob_auditing_policy_name: The name of the blob auditing policy. + :type blob_auditing_policy_name: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyName + :param parameters: Properties of extended blob auditing policy. + :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: True for ARMPolling, False for no polling, or a + polling object for 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.ServerBlobAuditingPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerBlobAuditingPolicy"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + blob_auditing_policy_name=blob_auditing_policy_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/auditingSettings/{blobAuditingPolicyName}'} # type: ignore + + def list_by_workspace( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServerBlobAuditingPolicyListResult"] + """List workspace server's blob auditing policies. + + List workspace managed sql server's blob auditing policies. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerBlobAuditingPolicyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ServerBlobAuditingPolicyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/auditingSettings'} # 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 new file mode 100644 index 000000000000..58703def4f4a --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_extended_blob_auditing_policies_operations.py @@ -0,0 +1,327 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +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]] + +class WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations(object): + """WorkspaceManagedSqlServerExtendedBlobAuditingPoliciesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + 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" + """Get server's extended blob auditing policy. + + Get a workspace SQL server's extended blob auditing policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param blob_auditing_policy_name: The name of the blob auditing policy. + :type blob_auditing_policy_name: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ExtendedServerBlobAuditingPolicy, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.ExtendedServerBlobAuditingPolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtendedServerBlobAuditingPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ExtendedServerBlobAuditingPolicy', pipeline_response) + + if cls: + 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"] + 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['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, '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 + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ExtendedServerBlobAuditingPolicy', pipeline_response) + + if cls: + 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 + + 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"] + """Create or Update server's extended blob auditing policy. + + Create or Update a workspace managed sql server's extended blob auditing policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param blob_auditing_policy_name: The name of the blob auditing policy. + :type blob_auditing_policy_name: str or ~azure.mgmt.synapse.models.BlobAuditingPolicyName + :param parameters: Properties of extended blob auditing policy. + :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: True for ARMPolling, False for no polling, or a + polling object for 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: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtendedServerBlobAuditingPolicy"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + blob_auditing_policy_name=blob_auditing_policy_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/extendedAuditingSettings/{blobAuditingPolicyName}'} # type: ignore + + def list_by_workspace( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ExtendedServerBlobAuditingPolicyListResult"] + """List server's extended blob auditing policies. + + List workspace managed sql server's extended blob auditing policies. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtendedServerBlobAuditingPolicyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ExtendedServerBlobAuditingPolicyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/extendedAuditingSettings'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_recoverable_sqlpools_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_recoverable_sqlpools_operations.py new file mode 100644 index 000000000000..71d1dc875b5f --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_recoverable_sqlpools_operations.py @@ -0,0 +1,188 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +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.mgmt.core.exceptions import ARMErrorFormat + +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]] + +class WorkspaceManagedSqlServerRecoverableSqlpoolsOperations(object): + """WorkspaceManagedSqlServerRecoverableSqlpoolsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.RecoverableSqlPoolListResult"] + """Get list of recoverable sql pools for the server. + + Get list of recoverable sql pools for workspace managed sql server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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.paging.ItemPaged[~azure.mgmt.synapse.models.RecoverableSqlPoolListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoverableSqlPoolListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('RecoverableSqlPoolListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/recoverableSqlpools'} # type: ignore + + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + sql_compute_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RecoverableSqlPool" + """Get recoverable sql pools for the server. + + Get recoverable sql pools for workspace managed sql server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param sql_compute_name: The name of the sql compute. + :type sql_compute_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RecoverableSqlPool, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.RecoverableSqlPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoverableSqlPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'sqlComputeName': self._serialize.url("sql_compute_name", sql_compute_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, 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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('RecoverableSqlPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/recoverableSqlPools/{sqlComputeName}'} # 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 new file mode 100644 index 000000000000..b944317d41e9 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_security_alert_policy_operations.py @@ -0,0 +1,327 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +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]] + +class WorkspaceManagedSqlServerSecurityAlertPolicyOperations(object): + """WorkspaceManagedSqlServerSecurityAlertPolicyOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + 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" + """Get server's security alert policy. + + Get a workspace managed sql server's security alert policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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 + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerSecurityAlertPolicy"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ServerSecurityAlertPolicy', pipeline_response) + + if cls: + 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"] + 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['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, '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 + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ServerSecurityAlertPolicy', pipeline_response) + + if cls: + 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 + + 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"] + """Create or Update server's threat detection policy. + + Create or Update a workspace managed sql server's threat detection policy. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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 + :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: True for ARMPolling, False for no polling, or a + polling object for 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.ServerSecurityAlertPolicy] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerSecurityAlertPolicy"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + security_alert_policy_name=security_alert_policy_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/securityAlertPolicies/{securityAlertPolicyName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServerSecurityAlertPolicyListResult"] + """Get server's threat detection policies. + + Get workspace managed sql server's threat detection policies. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerSecurityAlertPolicyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ServerSecurityAlertPolicyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/securityAlertPolicies'} # type: ignore 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 new file mode 100644 index 000000000000..02cdfdc8bcf3 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_usages_operations.py @@ -0,0 +1,123 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +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.mgmt.core.exceptions import ARMErrorFormat + +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]] + +class WorkspaceManagedSqlServerUsagesOperations(object): + """WorkspaceManagedSqlServerUsagesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServerUsageListResult"] + """Get list of usages metric for the server. + + Get list of server usages metric for workspace managed sql server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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.paging.ItemPaged[~azure.mgmt.synapse.models.ServerUsageListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerUsageListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ServerUsageListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlUsages'} # type: ignore 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 new file mode 100644 index 000000000000..c3e33c0626bf --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_managed_sql_server_vulnerability_assessments_operations.py @@ -0,0 +1,325 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +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.mgmt.core.exceptions import ARMErrorFormat + +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]] + +class WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations(object): + """WorkspaceManagedSqlServerVulnerabilityAssessmentsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + 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" + """Get server's vulnerability assessment. + + Get workspace managed sql server's vulnerability assessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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 + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerVulnerabilityAssessment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ServerVulnerabilityAssessment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} # type: ignore + + 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" + """Create or Update server's vulnerability assessment. + + Create or Update workspace managed sql server's vulnerability assessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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 + :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 + :return: ServerVulnerabilityAssessment, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.ServerVulnerabilityAssessment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerVulnerabilityAssessment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + 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, pattern=r'^[-\w\._\(\)]+$'), + '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['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, '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 + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServerVulnerabilityAssessment', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ServerVulnerabilityAssessment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} # type: ignore + + 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 + """Remove server's vulnerability assessment. + + Remove workspace managed sql server's vulnerability assessment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = "2019-06-01-preview" + + # 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, pattern=r'^[-\w\._\(\)]+$'), + '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 = 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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments/{vulnerabilityAssessmentName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServerVulnerabilityAssessmentListResult"] + """Lists the vulnerability assessment policies associated with a server. + + Lists the vulnerability assessment policies associated with a workspace managed sql server. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServerVulnerabilityAssessmentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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 = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ServerVulnerabilityAssessmentListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/vulnerabilityAssessments'} # type: ignore 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 new file mode 100644 index 000000000000..00d4e20ccdba --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_workspace_sql_aad_admins_operations.py @@ -0,0 +1,349 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +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]] + +class WorkspaceSqlAadAdminsOperations(object): + """WorkspaceSqlAadAdminsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.WorkspaceAadAdminInfo" + """Gets a workspace SQL active directory admin. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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: WorkspaceAadAdminInfo, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.WorkspaceAadAdminInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) + + if cls: + 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" + 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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['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(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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('WorkspaceAadAdminInfo', pipeline_response) + + if cls: + 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 + + 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"] + """Creates or updates a workspace SQL active directory admin. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param aad_admin_info: Workspace active directory administrator properties. + :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: True for ARMPolling, False for no polling, or a + polling object for 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) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.WorkspaceAadAdminInfo] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceAadAdminInfo"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + aad_admin_info=aad_admin_info, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 + 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 = "2019-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, pattern=r'^[-\w\._\(\)]+$'), + '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 = 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(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/sqlAdministrators/activeDirectory'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a workspace SQL active directory admin. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + 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, pattern=r'^[-\w\._\(\)]+$'), + '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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 54c4310548e0..7760c627a215 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 @@ -1,537 +1,632 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +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]] class WorkspacesOperations(object): """WorkspacesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.synapse.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01-preview". """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-06-01-preview" - - self.config = config + self._config = config def list_by_resource_group( - self, resource_group_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.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. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Workspace - :rtype: - ~azure.mgmt.synapse.models.WorkspacePaged[~azure.mgmt.synapse.models.Workspace] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkspaceInfoListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.WorkspaceInfoListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceInfoListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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_resource_group.metadata['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, pattern=r'^[-\w\._\(\)]+$') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), } url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WorkspaceInfoListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.WorkspacePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces'} + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces'} # type: ignore def get( - self, resource_group_name, workspace_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Workspace" """Gets a workspace. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Workspace or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.synapse.models.Workspace or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorContractException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Workspace, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.Workspace + :raises: ~azure.core.exceptions.HttpResponseError """ + 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 = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.get.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str') + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - raise models.ErrorContractException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Workspace', response) + deserialized = self._deserialize('Workspace', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} - + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore def _update_initial( - self, resource_group_name, workspace_name, workspace_patch_info, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + workspace_patch_info, # type: "_models.WorkspacePatchInfo" + **kwargs # type: Any + ): + # type: (...) -> "_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 = "2019-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.update.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str') + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(workspace_patch_info, 'WorkspacePatchInfo') + 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') - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ErrorContractException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Workspace', response) + deserialized = self._deserialize('Workspace', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('Workspace', response) + deserialized = self._deserialize('Workspace', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def update( - self, resource_group_name, workspace_name, workspace_patch_info, custom_headers=None, raw=False, polling=True, **operation_config): + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore + + 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"] """Updates a workspace. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param workspace_patch_info: Workspace patch request properties - :type workspace_patch_info: - ~azure.mgmt.synapse.models.WorkspacePatchInfo - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param workspace_patch_info: Workspace patch request properties. + :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: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns Workspace or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.synapse.models.Workspace] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.synapse.models.Workspace]] - :raises: - :class:`ErrorContractException` + :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 Workspace or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.Workspace] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._update_initial( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - workspace_patch_info=workspace_patch_info, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('Workspace', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_patch_info=workspace_patch_info, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Workspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore def _create_or_update_initial( - self, resource_group_name, workspace_name, workspace_info, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + workspace_info, # type: "_models.Workspace" + **kwargs # type: Any + ): + # type: (...) -> "_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 = "2019-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + # Construct URL - url = self.create_or_update.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str') + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(workspace_info, 'Workspace') + 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') - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + 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]: - raise models.ErrorContractException(self._deserialize, response) - - deserialized = None + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: - deserialized = self._deserialize('Workspace', response) + deserialized = self._deserialize('Workspace', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('Workspace', response) + deserialized = self._deserialize('Workspace', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, workspace_name, workspace_info, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore + + 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"] """Creates or updates a workspace. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param workspace_info: Workspace create or update request properties + :param workspace_info: Workspace create or update request properties. :type workspace_info: ~azure.mgmt.synapse.models.Workspace - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns Workspace or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.synapse.models.Workspace] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.synapse.models.Workspace]] - :raises: - :class:`ErrorContractException` + :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 Workspace or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.Workspace] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - workspace_info=workspace_info, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('Workspace', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + workspace_info=workspace_info, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Workspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} - + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore def _delete_initial( - self, resource_group_name, workspace_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional[object] + cls = kwargs.pop('cls', None) # type: ClsType[Optional[object]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-06-01-preview" + accept = "application/json" + # Construct URL - url = self.delete.metadata['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), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str') + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - raise models.ErrorContractException(self._deserialize, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorContract, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('object', response) + deserialized = self._deserialize('object', pipeline_response) + if response.status_code == 202: - deserialized = self._deserialize('object', response) + deserialized = self._deserialize('object', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def delete( - self, resource_group_name, workspace_name, custom_headers=None, raw=False, polling=True, **operation_config): + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[object] """Deletes a workspace. - :param resource_group_name: The name of the resource group. The name - is case insensitive. + :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param workspace_name: The name of the workspace + :param workspace_name: The name of the workspace. :type workspace_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns object or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[object] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[object]] - :raises: - :class:`ErrorContractException` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either object or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[object] + :raises ~azure.core.exceptions.HttpResponseError: """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - workspace_name=workspace_name, - custom_headers=custom_headers, - raw=True, - **operation_config + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[object] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval ) - - def get_long_running_output(response): - deserialized = self._deserialize('object', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('object', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}'} # type: ignore def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.WorkspaceInfoListResult"] """Returns a list of workspaces in a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Workspace - :rtype: - ~azure.mgmt.synapse.models.WorkspacePaged[~azure.mgmt.synapse.models.Workspace] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkspaceInfoListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.WorkspaceInfoListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceInfoListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-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'] + 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) + '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 = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - query_parameters = {} - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('WorkspaceInfoListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): request = prepare_request(next_link) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + error = self._deserialize(_models.ErrorContract, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.WorkspacePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/workspaces'} + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/workspaces'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/py.typed b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/synapse/azure-mgmt-synapse/setup.py b/sdk/synapse/azure-mgmt-synapse/setup.py index 14795563da77..a3da63d340ce 100644 --- a/sdk/synapse/azure-mgmt-synapse/setup.py +++ b/sdk/synapse/azure-mgmt-synapse/setup.py @@ -36,7 +36,7 @@ pass # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: +with open(os.path.join(package_folder_path, '_version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) @@ -79,8 +79,8 @@ ]), install_requires=[ 'msrest>=0.5.0', - 'msrestazure>=0.4.32,<2.0.0', 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', ], extras_require={ ":python_version<'3.0'": ['azure-mgmt-nspkg'],