From 8f5276cf9c5baf5b0e37e573ccf6be7328dbff98 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 7 Oct 2021 20:13:58 +0000 Subject: [PATCH] CodeGen from PR 16199 in Azure/azure-rest-api-specs Merge 2f338561be19487dcfae71c4f2b664748ee31f31 into 2ebe584103a362fa87f2f60c9bab89ab410c7571 --- sdk/synapse/azure-mgmt-synapse/_meta.json | 2 +- .../azure/mgmt/synapse/_metadata.json | 11 +- .../synapse/_synapse_management_client.py | 45 + .../azure/mgmt/synapse/_version.py | 2 +- .../synapse/aio/_synapse_management_client.py | 45 + .../mgmt/synapse/aio/operations/__init__.py | 18 + .../_kusto_operations_operations.py | 105 + ...ched_database_configurations_operations.py | 459 ++++ .../_kusto_pool_child_resource_operations.py | 112 + ..._kusto_pool_data_connections_operations.py | 844 ++++++ ...tabase_principal_assignments_operations.py | 553 ++++ .../_kusto_pool_databases_operations.py | 599 ++++ .../aio/operations/_kusto_pool_operations.py | 109 + ...o_pool_principal_assignments_operations.py | 527 ++++ .../aio/operations/_kusto_pools_operations.py | 1494 ++++++++++ .../azure/mgmt/synapse/models/__init__.py | 174 ++ .../azure/mgmt/synapse/models/_models.py | 2312 ++++++++++++++-- .../azure/mgmt/synapse/models/_models_py3.py | 2408 +++++++++++++++-- .../_synapse_management_client_enums.py | 228 ++ .../azure/mgmt/synapse/operations/__init__.py | 18 + .../_kusto_operations_operations.py | 110 + ...ched_database_configurations_operations.py | 469 ++++ .../_kusto_pool_child_resource_operations.py | 117 + ..._kusto_pool_data_connections_operations.py | 859 ++++++ ...tabase_principal_assignments_operations.py | 564 ++++ .../_kusto_pool_databases_operations.py | 611 +++++ .../operations/_kusto_pool_operations.py | 114 + ...o_pool_principal_assignments_operations.py | 538 ++++ .../operations/_kusto_pools_operations.py | 1520 +++++++++++ 29 files changed, 14545 insertions(+), 422 deletions(-) create mode 100644 sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_operations_operations.py create mode 100644 sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_attached_database_configurations_operations.py create mode 100644 sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_child_resource_operations.py create mode 100644 sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_data_connections_operations.py create mode 100644 sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_database_principal_assignments_operations.py create mode 100644 sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_databases_operations.py create mode 100644 sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_operations.py create mode 100644 sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_principal_assignments_operations.py create mode 100644 sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pools_operations.py create mode 100644 sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_operations_operations.py create mode 100644 sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_attached_database_configurations_operations.py create mode 100644 sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_child_resource_operations.py create mode 100644 sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_data_connections_operations.py create mode 100644 sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_database_principal_assignments_operations.py create mode 100644 sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_databases_operations.py create mode 100644 sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_operations.py create mode 100644 sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_principal_assignments_operations.py create mode 100644 sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pools_operations.py diff --git a/sdk/synapse/azure-mgmt-synapse/_meta.json b/sdk/synapse/azure-mgmt-synapse/_meta.json index 5a885580683ed..93ad12ee151ef 100644 --- a/sdk/synapse/azure-mgmt-synapse/_meta.json +++ b/sdk/synapse/azure-mgmt-synapse/_meta.json @@ -4,7 +4,7 @@ "@autorest/python@5.8.4", "@autorest/modelerfour@4.19.2" ], - "commit": "31a7b110ad291f6780f9457dde4966b2df3a18c7", + "commit": "050b1240bed5a843c1485ed95cad6269874ecbfd", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest_command": "autorest specification/synapse/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", "readme": "specification/synapse/resource-manager/readme.md" diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_metadata.json b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_metadata.json index b950994fc454a..ad699fc1ace12 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_metadata.json +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_metadata.json @@ -161,6 +161,15 @@ "integration_runtime_monitoring_data": "IntegrationRuntimeMonitoringDataOperations", "integration_runtime_status": "IntegrationRuntimeStatusOperations", "spark_configuration": "SparkConfigurationOperations", - "spark_configurations": "SparkConfigurationsOperations" + "spark_configurations": "SparkConfigurationsOperations", + "kusto_operations": "KustoOperationsOperations", + "kusto_pool": "KustoPoolOperations", + "kusto_pools": "KustoPoolsOperations", + "kusto_pool_child_resource": "KustoPoolChildResourceOperations", + "kusto_pool_attached_database_configurations": "KustoPoolAttachedDatabaseConfigurationsOperations", + "kusto_pool_databases": "KustoPoolDatabasesOperations", + "kusto_pool_data_connections": "KustoPoolDataConnectionsOperations", + "kusto_pool_principal_assignments": "KustoPoolPrincipalAssignmentsOperations", + "kusto_pool_database_principal_assignments": "KustoPoolDatabasePrincipalAssignmentsOperations" } } \ No newline at end of file diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_synapse_management_client.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_synapse_management_client.py index a9e7c48810f68..efe1591e66ae5 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 @@ -83,6 +83,15 @@ from .operations import IntegrationRuntimeStatusOperations from .operations import SparkConfigurationOperations from .operations import SparkConfigurationsOperations +from .operations import KustoOperationsOperations +from .operations import KustoPoolOperations +from .operations import KustoPoolsOperations +from .operations import KustoPoolChildResourceOperations +from .operations import KustoPoolAttachedDatabaseConfigurationsOperations +from .operations import KustoPoolDatabasesOperations +from .operations import KustoPoolDataConnectionsOperations +from .operations import KustoPoolPrincipalAssignmentsOperations +from .operations import KustoPoolDatabasePrincipalAssignmentsOperations from . import models @@ -217,6 +226,24 @@ class SynapseManagementClient(object): :vartype spark_configuration: azure.mgmt.synapse.operations.SparkConfigurationOperations :ivar spark_configurations: SparkConfigurationsOperations operations :vartype spark_configurations: azure.mgmt.synapse.operations.SparkConfigurationsOperations + :ivar kusto_operations: KustoOperationsOperations operations + :vartype kusto_operations: azure.mgmt.synapse.operations.KustoOperationsOperations + :ivar kusto_pool: KustoPoolOperations operations + :vartype kusto_pool: azure.mgmt.synapse.operations.KustoPoolOperations + :ivar kusto_pools: KustoPoolsOperations operations + :vartype kusto_pools: azure.mgmt.synapse.operations.KustoPoolsOperations + :ivar kusto_pool_child_resource: KustoPoolChildResourceOperations operations + :vartype kusto_pool_child_resource: azure.mgmt.synapse.operations.KustoPoolChildResourceOperations + :ivar kusto_pool_attached_database_configurations: KustoPoolAttachedDatabaseConfigurationsOperations operations + :vartype kusto_pool_attached_database_configurations: azure.mgmt.synapse.operations.KustoPoolAttachedDatabaseConfigurationsOperations + :ivar kusto_pool_databases: KustoPoolDatabasesOperations operations + :vartype kusto_pool_databases: azure.mgmt.synapse.operations.KustoPoolDatabasesOperations + :ivar kusto_pool_data_connections: KustoPoolDataConnectionsOperations operations + :vartype kusto_pool_data_connections: azure.mgmt.synapse.operations.KustoPoolDataConnectionsOperations + :ivar kusto_pool_principal_assignments: KustoPoolPrincipalAssignmentsOperations operations + :vartype kusto_pool_principal_assignments: azure.mgmt.synapse.operations.KustoPoolPrincipalAssignmentsOperations + :ivar kusto_pool_database_principal_assignments: KustoPoolDatabasePrincipalAssignmentsOperations operations + :vartype kusto_pool_database_principal_assignments: azure.mgmt.synapse.operations.KustoPoolDatabasePrincipalAssignmentsOperations :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. @@ -371,6 +398,24 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.spark_configurations = SparkConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize) + self.kusto_operations = KustoOperationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool = KustoPoolOperations( + self._client, self._config, self._serialize, self._deserialize) + self.kusto_pools = KustoPoolsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_child_resource = KustoPoolChildResourceOperations( + self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_attached_database_configurations = KustoPoolAttachedDatabaseConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_databases = KustoPoolDatabasesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_data_connections = KustoPoolDataConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_principal_assignments = KustoPoolPrincipalAssignmentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_database_principal_assignments = KustoPoolDatabasePrincipalAssignmentsOperations( + self._client, self._config, self._serialize, self._deserialize) def _send_request(self, http_request, **kwargs): # type: (HttpRequest, Any) -> HttpResponse diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_version.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_version.py index b82e03a368ffe..e5754a47ce68f 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_version.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.1.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/_synapse_management_client.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/_synapse_management_client.py index 6d110b3a562e3..30cf57d4f486c 100644 --- a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/_synapse_management_client.py +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/_synapse_management_client.py @@ -81,6 +81,15 @@ from .operations import IntegrationRuntimeStatusOperations from .operations import SparkConfigurationOperations from .operations import SparkConfigurationsOperations +from .operations import KustoOperationsOperations +from .operations import KustoPoolOperations +from .operations import KustoPoolsOperations +from .operations import KustoPoolChildResourceOperations +from .operations import KustoPoolAttachedDatabaseConfigurationsOperations +from .operations import KustoPoolDatabasesOperations +from .operations import KustoPoolDataConnectionsOperations +from .operations import KustoPoolPrincipalAssignmentsOperations +from .operations import KustoPoolDatabasePrincipalAssignmentsOperations from .. import models @@ -215,6 +224,24 @@ class SynapseManagementClient(object): :vartype spark_configuration: azure.mgmt.synapse.aio.operations.SparkConfigurationOperations :ivar spark_configurations: SparkConfigurationsOperations operations :vartype spark_configurations: azure.mgmt.synapse.aio.operations.SparkConfigurationsOperations + :ivar kusto_operations: KustoOperationsOperations operations + :vartype kusto_operations: azure.mgmt.synapse.aio.operations.KustoOperationsOperations + :ivar kusto_pool: KustoPoolOperations operations + :vartype kusto_pool: azure.mgmt.synapse.aio.operations.KustoPoolOperations + :ivar kusto_pools: KustoPoolsOperations operations + :vartype kusto_pools: azure.mgmt.synapse.aio.operations.KustoPoolsOperations + :ivar kusto_pool_child_resource: KustoPoolChildResourceOperations operations + :vartype kusto_pool_child_resource: azure.mgmt.synapse.aio.operations.KustoPoolChildResourceOperations + :ivar kusto_pool_attached_database_configurations: KustoPoolAttachedDatabaseConfigurationsOperations operations + :vartype kusto_pool_attached_database_configurations: azure.mgmt.synapse.aio.operations.KustoPoolAttachedDatabaseConfigurationsOperations + :ivar kusto_pool_databases: KustoPoolDatabasesOperations operations + :vartype kusto_pool_databases: azure.mgmt.synapse.aio.operations.KustoPoolDatabasesOperations + :ivar kusto_pool_data_connections: KustoPoolDataConnectionsOperations operations + :vartype kusto_pool_data_connections: azure.mgmt.synapse.aio.operations.KustoPoolDataConnectionsOperations + :ivar kusto_pool_principal_assignments: KustoPoolPrincipalAssignmentsOperations operations + :vartype kusto_pool_principal_assignments: azure.mgmt.synapse.aio.operations.KustoPoolPrincipalAssignmentsOperations + :ivar kusto_pool_database_principal_assignments: KustoPoolDatabasePrincipalAssignmentsOperations operations + :vartype kusto_pool_database_principal_assignments: azure.mgmt.synapse.aio.operations.KustoPoolDatabasePrincipalAssignmentsOperations :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. @@ -368,6 +395,24 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.spark_configurations = SparkConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize) + self.kusto_operations = KustoOperationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool = KustoPoolOperations( + self._client, self._config, self._serialize, self._deserialize) + self.kusto_pools = KustoPoolsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_child_resource = KustoPoolChildResourceOperations( + self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_attached_database_configurations = KustoPoolAttachedDatabaseConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_databases = KustoPoolDatabasesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_data_connections = KustoPoolDataConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_principal_assignments = KustoPoolPrincipalAssignmentsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.kusto_pool_database_principal_assignments = KustoPoolDatabasePrincipalAssignmentsOperations( + self._client, self._config, self._serialize, self._deserialize) async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: """Runs the network request through the client's chained policies. 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 index 8dbf81dbc73cc..44b8ebef2ef3a 100644 --- 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 @@ -70,6 +70,15 @@ from ._integration_runtime_status_operations import IntegrationRuntimeStatusOperations from ._spark_configuration_operations import SparkConfigurationOperations from ._spark_configurations_operations import SparkConfigurationsOperations +from ._kusto_operations_operations import KustoOperationsOperations +from ._kusto_pool_operations import KustoPoolOperations +from ._kusto_pools_operations import KustoPoolsOperations +from ._kusto_pool_child_resource_operations import KustoPoolChildResourceOperations +from ._kusto_pool_attached_database_configurations_operations import KustoPoolAttachedDatabaseConfigurationsOperations +from ._kusto_pool_databases_operations import KustoPoolDatabasesOperations +from ._kusto_pool_data_connections_operations import KustoPoolDataConnectionsOperations +from ._kusto_pool_principal_assignments_operations import KustoPoolPrincipalAssignmentsOperations +from ._kusto_pool_database_principal_assignments_operations import KustoPoolDatabasePrincipalAssignmentsOperations __all__ = [ 'AzureADOnlyAuthenticationsOperations', @@ -136,4 +145,13 @@ 'IntegrationRuntimeStatusOperations', 'SparkConfigurationOperations', 'SparkConfigurationsOperations', + 'KustoOperationsOperations', + 'KustoPoolOperations', + 'KustoPoolsOperations', + 'KustoPoolChildResourceOperations', + 'KustoPoolAttachedDatabaseConfigurationsOperations', + 'KustoPoolDatabasesOperations', + 'KustoPoolDataConnectionsOperations', + 'KustoPoolPrincipalAssignmentsOperations', + 'KustoPoolDatabasePrincipalAssignmentsOperations', ] diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_operations_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_operations_operations.py new file mode 100644 index 0000000000000..a1ee25ef58164 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_operations_operations.py @@ -0,0 +1,105 @@ +# 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 KustoOperationsOperations: + """KustoOperationsOperations 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, + **kwargs: Any + ) -> AsyncIterable["_models.OperationListResult"]: + """Lists available operations for the Kusto sub-resources inside Microsoft.Synapse provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = 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('OperationListResult', 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.failsafe_deserialize(_models.ErrorResponse, 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': '/providers/Microsoft.Synapse/kustooperations'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_attached_database_configurations_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_attached_database_configurations_operations.py new file mode 100644 index 0000000000000..a3eef6564ef30 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_attached_database_configurations_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 KustoPoolAttachedDatabaseConfigurationsOperations: + """KustoPoolAttachedDatabaseConfigurationsOperations 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_kusto_pool( + self, + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.AttachedDatabaseConfigurationListResult"]: + """Returns the list of attached database configurations of the given Kusto Pool. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AttachedDatabaseConfigurationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.AttachedDatabaseConfigurationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AttachedDatabaseConfigurationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_kusto_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + 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('AttachedDatabaseConfigurationListResult', 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.failsafe_deserialize(_models.ErrorResponse, 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_kusto_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations'} # type: ignore + + async def get( + self, + workspace_name: str, + kusto_pool_name: str, + attached_database_configuration_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.AttachedDatabaseConfiguration": + """Returns an attached database configuration. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param attached_database_configuration_name: The name of the attached database configuration. + :type attached_database_configuration_name: str + :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: AttachedDatabaseConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.AttachedDatabaseConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AttachedDatabaseConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore + + async def _create_or_update_initial( + self, + workspace_name: str, + kusto_pool_name: str, + attached_database_configuration_name: str, + resource_group_name: str, + parameters: "_models.AttachedDatabaseConfiguration", + **kwargs: Any + ) -> "_models.AttachedDatabaseConfiguration": + cls = kwargs.pop('cls', None) # type: ClsType["_models.AttachedDatabaseConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'AttachedDatabaseConfiguration') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AttachedDatabaseConfiguration', 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}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore + + async def begin_create_or_update( + self, + workspace_name: str, + kusto_pool_name: str, + attached_database_configuration_name: str, + resource_group_name: str, + parameters: "_models.AttachedDatabaseConfiguration", + **kwargs: Any + ) -> AsyncLROPoller["_models.AttachedDatabaseConfiguration"]: + """Creates or updates an attached database configuration. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param attached_database_configuration_name: The name of the attached database configuration. + :type attached_database_configuration_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param parameters: The database parameters supplied to the CreateOrUpdate operation. + :type parameters: ~azure.mgmt.synapse.models.AttachedDatabaseConfiguration + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either AttachedDatabaseConfiguration or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.AttachedDatabaseConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AttachedDatabaseConfiguration"] + 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( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + attached_database_configuration_name=attached_database_configuration_name, + resource_group_name=resource_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('AttachedDatabaseConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore + + async def _delete_initial( + self, + workspace_name: str, + kusto_pool_name: str, + attached_database_configuration_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore + + async def begin_delete( + self, + workspace_name: str, + kusto_pool_name: str, + attached_database_configuration_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the attached database configuration with the given name. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param attached_database_configuration_name: The name of the attached database configuration. + :type attached_database_configuration_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + attached_database_configuration_name=attached_database_configuration_name, + resource_group_name=resource_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 = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_child_resource_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_child_resource_operations.py new file mode 100644 index 0000000000000..aa1bc34c2db78 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_child_resource_operations.py @@ -0,0 +1,112 @@ +# 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 KustoPoolChildResourceOperations: + """KustoPoolChildResourceOperations 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, + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + resource_name: "_models.DatabaseCheckNameRequest", + **kwargs: Any + ) -> "_models.CheckNameResult": + """Checks that the Kusto Pool child resource name is valid and is not already in use. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the Kusto Pool child resource. + :type resource_name: ~azure.mgmt.synapse.models.DatabaseCheckNameRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameResult, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.CheckNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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(resource_name, 'DatabaseCheckNameRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/checkNameAvailability'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_data_connections_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_data_connections_operations.py new file mode 100644 index 0000000000000..ed010d1e1aedd --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_data_connections_operations.py @@ -0,0 +1,844 @@ +# 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 KustoPoolDataConnectionsOperations: + """KustoPoolDataConnectionsOperations 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, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + data_connection_name: "_models.DataConnectionCheckNameRequest", + **kwargs: Any + ) -> "_models.CheckNameResult": + """Checks that the data connection name is valid and is not already in use. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param data_connection_name: The name of the data connection. + :type data_connection_name: ~azure.mgmt.synapse.models.DataConnectionCheckNameRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameResult, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.CheckNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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(data_connection_name, 'DataConnectionCheckNameRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/checkNameAvailability'} # type: ignore + + async def _data_connection_validation_initial( + self, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + parameters: "_models.DataConnectionValidation", + **kwargs: Any + ) -> Optional["_models.DataConnectionValidationListResult"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DataConnectionValidationListResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._data_connection_validation_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'DataConnectionValidation') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DataConnectionValidationListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _data_connection_validation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnectionValidation'} # type: ignore + + async def begin_data_connection_validation( + self, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + parameters: "_models.DataConnectionValidation", + **kwargs: Any + ) -> AsyncLROPoller["_models.DataConnectionValidationListResult"]: + """Checks that the data connection parameters are valid. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param parameters: The data connection parameters supplied to the CreateOrUpdate operation. + :type parameters: ~azure.mgmt.synapse.models.DataConnectionValidation + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataConnectionValidationListResult or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.DataConnectionValidationListResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnectionValidationListResult"] + 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._data_connection_validation_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_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('DataConnectionValidationListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + 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_data_connection_validation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnectionValidation'} # type: ignore + + def list_by_database( + self, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.DataConnectionListResult"]: + """Returns the list of data connections of the given Kusto pool database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataConnectionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.DataConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_database.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + 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('DataConnectionListResult', 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.failsafe_deserialize(_models.ErrorResponse, 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_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections'} # type: ignore + + async def get( + self, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + data_connection_name: str, + **kwargs: Any + ) -> "_models.DataConnection": + """Returns a data connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param data_connection_name: The name of the data connection. + :type data_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataConnection, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.DataConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + data_connection_name: str, + parameters: "_models.DataConnection", + **kwargs: Any + ) -> "_models.DataConnection": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'DataConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataConnection', 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}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + data_connection_name: str, + parameters: "_models.DataConnection", + **kwargs: Any + ) -> AsyncLROPoller["_models.DataConnection"]: + """Creates or updates a data 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 kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param data_connection_name: The name of the data connection. + :type data_connection_name: str + :param parameters: The data connection parameters supplied to the CreateOrUpdate operation. + :type parameters: ~azure.mgmt.synapse.models.DataConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataConnection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.DataConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnection"] + 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, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + data_connection_name=data_connection_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('DataConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + data_connection_name: str, + parameters: "_models.DataConnection", + **kwargs: Any + ) -> "_models.DataConnection": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'DataConnection') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataConnection', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DataConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + data_connection_name: str, + parameters: "_models.DataConnection", + **kwargs: Any + ) -> AsyncLROPoller["_models.DataConnection"]: + """Updates a data 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 kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param data_connection_name: The name of the data connection. + :type data_connection_name: str + :param parameters: The data connection parameters supplied to the Update operation. + :type parameters: ~azure.mgmt.synapse.models.DataConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataConnection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.DataConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnection"] + 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, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + data_connection_name=data_connection_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('DataConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + data_connection_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + data_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the data connection with the given 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 kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param data_connection_name: The name of the data connection. + :type data_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + data_connection_name=data_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): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_database_principal_assignments_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_database_principal_assignments_operations.py new file mode 100644 index 0000000000000..618513efa2591 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_database_principal_assignments_operations.py @@ -0,0 +1,553 @@ +# 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 KustoPoolDatabasePrincipalAssignmentsOperations: + """KustoPoolDatabasePrincipalAssignmentsOperations 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, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + resource_group_name: str, + principal_assignment_name: "_models.DatabasePrincipalAssignmentCheckNameRequest", + **kwargs: Any + ) -> "_models.CheckNameResult": + """Checks that the database principal assignment is valid and is not already in use. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param principal_assignment_name: The name of the resource. + :type principal_assignment_name: ~azure.mgmt.synapse.models.DatabasePrincipalAssignmentCheckNameRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameResult, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.CheckNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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(principal_assignment_name, 'DatabasePrincipalAssignmentCheckNameRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/checkPrincipalAssignmentNameAvailability'} # type: ignore + + def list( + self, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.DatabasePrincipalAssignmentListResult"]: + """Lists all Kusto pool database principalAssignments. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatabasePrincipalAssignmentListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.DatabasePrincipalAssignmentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabasePrincipalAssignmentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + 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('DatabasePrincipalAssignmentListResult', 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.failsafe_deserialize(_models.ErrorResponse, 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}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments'} # type: ignore + + async def get( + self, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + principal_assignment_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.DatabasePrincipalAssignment": + """Gets a Kusto pool database principalAssignment. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param principal_assignment_name: The name of the Kusto principalAssignment. + :type principal_assignment_name: str + :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: DatabasePrincipalAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.DatabasePrincipalAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabasePrincipalAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatabasePrincipalAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + async def _create_or_update_initial( + self, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + principal_assignment_name: str, + resource_group_name: str, + parameters: "_models.DatabasePrincipalAssignment", + **kwargs: Any + ) -> "_models.DatabasePrincipalAssignment": + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabasePrincipalAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'DatabasePrincipalAssignment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DatabasePrincipalAssignment', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DatabasePrincipalAssignment', 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}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + async def begin_create_or_update( + self, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + principal_assignment_name: str, + resource_group_name: str, + parameters: "_models.DatabasePrincipalAssignment", + **kwargs: Any + ) -> AsyncLROPoller["_models.DatabasePrincipalAssignment"]: + """Creates a Kusto pool database principalAssignment. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param principal_assignment_name: The name of the Kusto principalAssignment. + :type principal_assignment_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param parameters: The Kusto principalAssignments parameters supplied for the operation. + :type parameters: ~azure.mgmt.synapse.models.DatabasePrincipalAssignment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DatabasePrincipalAssignment or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.DatabasePrincipalAssignment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabasePrincipalAssignment"] + 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( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + principal_assignment_name=principal_assignment_name, + resource_group_name=resource_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('DatabasePrincipalAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + async def _delete_initial( + self, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + principal_assignment_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + async def begin_delete( + self, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + principal_assignment_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a Kusto pool principalAssignment. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param principal_assignment_name: The name of the Kusto principalAssignment. + :type principal_assignment_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + principal_assignment_name=principal_assignment_name, + resource_group_name=resource_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 = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_databases_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_databases_operations.py new file mode 100644 index 0000000000000..6e2ca7ff36993 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_databases_operations.py @@ -0,0 +1,599 @@ +# 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 KustoPoolDatabasesOperations: + """KustoPoolDatabasesOperations 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_kusto_pool( + self, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.DatabaseListResult"]: + """Returns the list of databases of the given Kusto pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_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 DatabaseListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.DatabaseListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_kusto_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + 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('DatabaseListResult', 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.failsafe_deserialize(_models.ErrorResponse, 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_kusto_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases'} # type: ignore + + async def get( + self, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + **kwargs: Any + ) -> "_models.Database": + """Returns a database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Database, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.Database + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Database"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Database', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + parameters: "_models.Database", + **kwargs: Any + ) -> "_models.Database": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Database"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'Database') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Database', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Database', 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}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + parameters: "_models.Database", + **kwargs: Any + ) -> AsyncLROPoller["_models.Database"]: + """Creates or updates a database. + + :param resource_group_name: 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 kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param parameters: The database parameters supplied to the CreateOrUpdate operation. + :type parameters: ~azure.mgmt.synapse.models.Database + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Database or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.Database] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Database"] + 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, + kusto_pool_name=kusto_pool_name, + database_name=database_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('Database', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + parameters: "_models.Database", + **kwargs: Any + ) -> "_models.Database": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Database"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'Database') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Database', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Database', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + parameters: "_models.Database", + **kwargs: Any + ) -> AsyncLROPoller["_models.Database"]: + """Updates a database. + + :param resource_group_name: 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 kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param parameters: The database parameters supplied to the Update operation. + :type parameters: ~azure.mgmt.synapse.models.Database + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Database or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.Database] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Database"] + 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, + kusto_pool_name=kusto_pool_name, + database_name=database_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('Database', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + workspace_name: str, + kusto_pool_name: str, + database_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the database with the given 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 kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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, + kusto_pool_name=kusto_pool_name, + database_name=database_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), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_operations.py new file mode 100644 index 0000000000000..6c266289bf1af --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_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, 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 KustoPoolOperations: + """KustoPoolOperations 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_skus( + self, + **kwargs: Any + ) -> AsyncIterable["_models.SkuDescriptionList"]: + """Lists eligible SKUs for Kusto Pool resource. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuDescriptionList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.SkuDescriptionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SkuDescriptionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + 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('SkuDescriptionList', 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.failsafe_deserialize(_models.ErrorResponse, 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_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/skus'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_principal_assignments_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_principal_assignments_operations.py new file mode 100644 index 0000000000000..4c67c7fa00e65 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pool_principal_assignments_operations.py @@ -0,0 +1,527 @@ +# 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 KustoPoolPrincipalAssignmentsOperations: + """KustoPoolPrincipalAssignmentsOperations 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, + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + principal_assignment_name: "_models.ClusterPrincipalAssignmentCheckNameRequest", + **kwargs: Any + ) -> "_models.CheckNameResult": + """Checks that the principal assignment name is valid and is not already in use. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param principal_assignment_name: The name of the principal assignment. + :type principal_assignment_name: ~azure.mgmt.synapse.models.ClusterPrincipalAssignmentCheckNameRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameResult, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.CheckNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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(principal_assignment_name, 'ClusterPrincipalAssignmentCheckNameRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/checkPrincipalAssignmentNameAvailability'} # type: ignore + + def list( + self, + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ClusterPrincipalAssignmentListResult"]: + """Lists all Kusto pool principalAssignments. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ClusterPrincipalAssignmentListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.ClusterPrincipalAssignmentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterPrincipalAssignmentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + 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('ClusterPrincipalAssignmentListResult', 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.failsafe_deserialize(_models.ErrorResponse, 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}/kustoPools/{kustoPoolName}/principalAssignments'} # type: ignore + + async def get( + self, + workspace_name: str, + kusto_pool_name: str, + principal_assignment_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.ClusterPrincipalAssignment": + """Gets a Kusto pool principalAssignment. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param principal_assignment_name: The name of the Kusto principalAssignment. + :type principal_assignment_name: str + :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: ClusterPrincipalAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.ClusterPrincipalAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterPrincipalAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ClusterPrincipalAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + async def _create_or_update_initial( + self, + workspace_name: str, + kusto_pool_name: str, + principal_assignment_name: str, + resource_group_name: str, + parameters: "_models.ClusterPrincipalAssignment", + **kwargs: Any + ) -> "_models.ClusterPrincipalAssignment": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterPrincipalAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'ClusterPrincipalAssignment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ClusterPrincipalAssignment', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ClusterPrincipalAssignment', 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}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + async def begin_create_or_update( + self, + workspace_name: str, + kusto_pool_name: str, + principal_assignment_name: str, + resource_group_name: str, + parameters: "_models.ClusterPrincipalAssignment", + **kwargs: Any + ) -> AsyncLROPoller["_models.ClusterPrincipalAssignment"]: + """Create a Kusto pool principalAssignment. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param principal_assignment_name: The name of the Kusto principalAssignment. + :type principal_assignment_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param parameters: The Kusto pool principalAssignment's parameters supplied for the operation. + :type parameters: ~azure.mgmt.synapse.models.ClusterPrincipalAssignment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ClusterPrincipalAssignment or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.ClusterPrincipalAssignment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterPrincipalAssignment"] + 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( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + principal_assignment_name=principal_assignment_name, + resource_group_name=resource_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('ClusterPrincipalAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + async def _delete_initial( + self, + workspace_name: str, + kusto_pool_name: str, + principal_assignment_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + async def begin_delete( + self, + workspace_name: str, + kusto_pool_name: str, + principal_assignment_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a Kusto pool principalAssignment. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param principal_assignment_name: The name of the Kusto principalAssignment. + :type principal_assignment_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + principal_assignment_name=principal_assignment_name, + resource_group_name=resource_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 = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pools_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pools_operations.py new file mode 100644 index 0000000000000..cf1f5245cb230 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_kusto_pools_operations.py @@ -0,0 +1,1494 @@ +# 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 KustoPoolsOperations: + """KustoPoolsOperations 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, + location: str, + kusto_pool_name: "_models.KustoPoolCheckNameRequest", + **kwargs: Any + ) -> "_models.CheckNameResult": + """Checks that the kusto pool name is valid and is not already in use. + + :param location: The name of Azure region. + :type location: str + :param kusto_pool_name: The name of the cluster. + :type kusto_pool_name: ~azure.mgmt.synapse.models.KustoPoolCheckNameRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameResult, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.CheckNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'location': self._serialize.url("location", location, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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(kusto_pool_name, 'KustoPoolCheckNameRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/locations/{location}/kustoPoolCheckNameAvailability'} # type: ignore + + async def list_by_workspace( + self, + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> "_models.KustoPoolListResult": + """List Kusto pools. + + List all Kusto 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: KustoPoolListResult, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.KustoPoolListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.KustoPoolListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_by_workspace.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('KustoPoolListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools'} # type: ignore + + async def get( + self, + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + **kwargs: Any + ) -> "_models.KustoPool": + """Gets a Kusto pool. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :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: KustoPool, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.KustoPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.KustoPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('KustoPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}'} # type: ignore + + async def _create_or_update_initial( + self, + workspace_name: str, + resource_group_name: str, + kusto_pool_name: str, + parameters: "_models.KustoPool", + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.KustoPool": + cls = kwargs.pop('cls', None) # type: ClsType["_models.KustoPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + if if_none_match is not None: + header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'KustoPool') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('KustoPool', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('KustoPool', 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}/kustoPools/{kustoPoolName}'} # type: ignore + + async def begin_create_or_update( + self, + workspace_name: str, + resource_group_name: str, + kusto_pool_name: str, + parameters: "_models.KustoPool", + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.KustoPool"]: + """Create or update a Kusto pool. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param parameters: The Kusto pool parameters supplied to the CreateOrUpdate operation. + :type parameters: ~azure.mgmt.synapse.models.KustoPool + :param if_match: The ETag of the Kusto Pool. Omit this value to always overwrite the current + Kusto Pool. Specify the last-seen ETag value to prevent accidentally overwriting concurrent + changes. + :type if_match: str + :param if_none_match: Set to '*' to allow a new Kusto Pool to be created, but to prevent + updating an existing Kusto Pool. Other values will result in a 412 Pre-condition Failed + response. + :type if_none_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either KustoPool or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.KustoPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.KustoPool"] + 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( + workspace_name=workspace_name, + resource_group_name=resource_group_name, + kusto_pool_name=kusto_pool_name, + parameters=parameters, + if_match=if_match, + if_none_match=if_none_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('KustoPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}'} # type: ignore + + async def _update_initial( + self, + workspace_name: str, + resource_group_name: str, + kusto_pool_name: str, + parameters: "_models.KustoPoolUpdate", + if_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.KustoPool": + cls = kwargs.pop('cls', None) # type: ClsType["_models.KustoPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'KustoPoolUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('KustoPool', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('KustoPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}'} # type: ignore + + async def begin_update( + self, + workspace_name: str, + resource_group_name: str, + kusto_pool_name: str, + parameters: "_models.KustoPoolUpdate", + if_match: Optional[str] = None, + **kwargs: Any + ) -> AsyncLROPoller["_models.KustoPool"]: + """Update a Kusto Kusto Pool. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param parameters: The Kusto pool parameters supplied to the Update operation. + :type parameters: ~azure.mgmt.synapse.models.KustoPoolUpdate + :param if_match: The ETag of the Kusto Pool. Omit this value to always overwrite the current + Kusto Pool. Specify the last-seen ETag value to prevent accidentally overwriting concurrent + changes. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either KustoPool or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.synapse.models.KustoPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.KustoPool"] + 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( + workspace_name=workspace_name, + resource_group_name=resource_group_name, + kusto_pool_name=kusto_pool_name, + parameters=parameters, + 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('KustoPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}'} # type: ignore + + async def _delete_initial( + self, + workspace_name: str, + resource_group_name: str, + kusto_pool_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}'} # type: ignore + + async def begin_delete( + self, + workspace_name: str, + resource_group_name: str, + kusto_pool_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a Kusto pool. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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( + workspace_name=workspace_name, + resource_group_name=resource_group_name, + kusto_pool_name=kusto_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): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}'} # type: ignore + + async def _stop_initial( + self, + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/stop'} # type: ignore + + async def begin_stop( + self, + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Stops a Kusto pool. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + resource_group_name=resource_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 = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/stop'} # type: ignore + + async def _start_initial( + self, + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/start'} # type: ignore + + async def begin_start( + self, + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Starts a Kusto pool. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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._start_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + resource_group_name=resource_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 = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/start'} # type: ignore + + def list_skus_by_resource( + self, + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ListResourceSkusResult"]: + """Returns the SKUs available for the provided resource. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ListResourceSkusResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.ListResourceSkusResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListResourceSkusResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_skus_by_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + 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('ListResourceSkusResult', 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.failsafe_deserialize(_models.ErrorResponse, 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_skus_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/skus'} # type: ignore + + def list_language_extensions( + self, + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.LanguageExtensionsList"]: + """Returns a list of language extensions that can run within KQL queries. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LanguageExtensionsList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.LanguageExtensionsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LanguageExtensionsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_language_extensions.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + 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('LanguageExtensionsList', 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.failsafe_deserialize(_models.ErrorResponse, 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_language_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/listLanguageExtensions'} # type: ignore + + async def _add_language_extensions_initial( + self, + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + language_extensions_to_add: "_models.LanguageExtensionsList", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._add_language_extensions_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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(language_extensions_to_add, 'LanguageExtensionsList') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _add_language_extensions_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/addLanguageExtensions'} # type: ignore + + async def begin_add_language_extensions( + self, + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + language_extensions_to_add: "_models.LanguageExtensionsList", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Add a list of language extensions that can run within KQL queries. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param language_extensions_to_add: The language extensions to add. + :type language_extensions_to_add: ~azure.mgmt.synapse.models.LanguageExtensionsList + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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._add_language_extensions_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + resource_group_name=resource_group_name, + language_extensions_to_add=language_extensions_to_add, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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_add_language_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/addLanguageExtensions'} # type: ignore + + async def _remove_language_extensions_initial( + self, + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + language_extensions_to_remove: "_models.LanguageExtensionsList", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._remove_language_extensions_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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(language_extensions_to_remove, 'LanguageExtensionsList') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _remove_language_extensions_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/removeLanguageExtensions'} # type: ignore + + async def begin_remove_language_extensions( + self, + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + language_extensions_to_remove: "_models.LanguageExtensionsList", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Remove a list of language extensions that can run within KQL queries. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param language_extensions_to_remove: The language extensions to remove. + :type language_extensions_to_remove: ~azure.mgmt.synapse.models.LanguageExtensionsList + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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._remove_language_extensions_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + resource_group_name=resource_group_name, + language_extensions_to_remove=language_extensions_to_remove, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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_remove_language_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/removeLanguageExtensions'} # type: ignore + + def list_follower_databases( + self, + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.FollowerDatabaseListResult"]: + """Returns a list of databases that are owned by this Kusto Pool and were followed by another + Kusto Pool. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FollowerDatabaseListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.synapse.models.FollowerDatabaseListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FollowerDatabaseListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_follower_databases.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + 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('FollowerDatabaseListResult', 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.failsafe_deserialize(_models.ErrorResponse, 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_follower_databases.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/listFollowerDatabases'} # type: ignore + + async def _detach_follower_databases_initial( + self, + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + follower_database_to_remove: "_models.FollowerDatabaseDefinition", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._detach_follower_databases_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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(follower_database_to_remove, 'FollowerDatabaseDefinition') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _detach_follower_databases_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/detachFollowerDatabases'} # type: ignore + + async def begin_detach_follower_databases( + self, + workspace_name: str, + kusto_pool_name: str, + resource_group_name: str, + follower_database_to_remove: "_models.FollowerDatabaseDefinition", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Detaches all followers of a database owned by this Kusto Pool. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param follower_database_to_remove: The follower databases properties to remove. + :type follower_database_to_remove: ~azure.mgmt.synapse.models.FollowerDatabaseDefinition + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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._detach_follower_databases_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + resource_group_name=resource_group_name, + follower_database_to_remove=follower_database_to_remove, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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_detach_follower_databases.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/detachFollowerDatabases'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/__init__.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/models/__init__.py index 1bb97d9c2e56e..5587a9fb3620b 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 @@ -7,29 +7,51 @@ # -------------------------------------------------------------------------- try: + from ._models_py3 import AttachedDatabaseConfiguration + from ._models_py3 import AttachedDatabaseConfigurationListResult from ._models_py3 import AutoPauseProperties from ._models_py3 import AutoScaleProperties from ._models_py3 import AvailableRpOperation from ._models_py3 import AvailableRpOperationDisplayInfo from ._models_py3 import AzureADOnlyAuthentication from ._models_py3 import AzureADOnlyAuthenticationListResult + from ._models_py3 import AzureCapacity from ._models_py3 import AzureEntityResource + from ._models_py3 import AzureResourceSku + from ._models_py3 import AzureSku from ._models_py3 import BigDataPoolPatchInfo from ._models_py3 import BigDataPoolResourceInfo from ._models_py3 import BigDataPoolResourceInfoListResult from ._models_py3 import CheckNameAvailabilityRequest from ._models_py3 import CheckNameAvailabilityResponse + from ._models_py3 import CheckNameResult + from ._models_py3 import ClusterPrincipalAssignment + from ._models_py3 import ClusterPrincipalAssignmentCheckNameRequest + from ._models_py3 import ClusterPrincipalAssignmentListResult from ._models_py3 import CmdkeySetup from ._models_py3 import ComponentSetup from ._models_py3 import CreateSqlPoolRestorePointDefinition from ._models_py3 import CspWorkspaceAdminProperties from ._models_py3 import CustomSetupBase from ._models_py3 import CustomerManagedKeyDetails + from ._models_py3 import DataConnection + from ._models_py3 import DataConnectionCheckNameRequest + from ._models_py3 import DataConnectionListResult + from ._models_py3 import DataConnectionValidation + from ._models_py3 import DataConnectionValidationListResult + from ._models_py3 import DataConnectionValidationResult from ._models_py3 import DataLakeStorageAccountDetails from ._models_py3 import DataMaskingPolicy from ._models_py3 import DataMaskingRule from ._models_py3 import DataMaskingRuleListResult from ._models_py3 import DataWarehouseUserActivities + from ._models_py3 import Database + from ._models_py3 import DatabaseCheckNameRequest + from ._models_py3 import DatabaseListResult + from ._models_py3 import DatabasePrincipalAssignment + from ._models_py3 import DatabasePrincipalAssignmentCheckNameRequest + from ._models_py3 import DatabasePrincipalAssignmentListResult + from ._models_py3 import DatabaseStatistics from ._models_py3 import DynamicExecutorAllocation from ._models_py3 import EncryptionDetails from ._models_py3 import EncryptionProtector @@ -39,10 +61,14 @@ from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse + from ._models_py3 import EventGridDataConnection + from ._models_py3 import EventHubDataConnection from ._models_py3 import ExtendedServerBlobAuditingPolicy from ._models_py3 import ExtendedServerBlobAuditingPolicyListResult from ._models_py3 import ExtendedSqlPoolBlobAuditingPolicy from ._models_py3 import ExtendedSqlPoolBlobAuditingPolicyListResult + from ._models_py3 import FollowerDatabaseDefinition + from ._models_py3 import FollowerDatabaseListResult from ._models_py3 import GeoBackupPolicy from ._models_py3 import GeoBackupPolicyListResult from ._models_py3 import GetSsisObjectMetadataRequest @@ -68,12 +94,19 @@ from ._models_py3 import IntegrationRuntimeStatus from ._models_py3 import IntegrationRuntimeStatusResponse from ._models_py3 import IntegrationRuntimeVNetProperties + from ._models_py3 import IotHubDataConnection from ._models_py3 import IpFirewallRuleInfo from ._models_py3 import IpFirewallRuleInfoListResult from ._models_py3 import IpFirewallRuleProperties from ._models_py3 import KekIdentityProperties from ._models_py3 import Key from ._models_py3 import KeyInfoListResult + from ._models_py3 import KustoPool + from ._models_py3 import KustoPoolCheckNameRequest + from ._models_py3 import KustoPoolListResult + from ._models_py3 import KustoPoolUpdate + from ._models_py3 import LanguageExtension + from ._models_py3 import LanguageExtensionsList from ._models_py3 import LibraryInfo from ._models_py3 import LibraryListResponse from ._models_py3 import LibraryRequirements @@ -82,6 +115,7 @@ from ._models_py3 import LinkedIntegrationRuntimeKeyAuthorization from ._models_py3 import LinkedIntegrationRuntimeRbacAuthorization from ._models_py3 import LinkedIntegrationRuntimeType + from ._models_py3 import ListResourceSkusResult from ._models_py3 import ListSqlPoolSecurityAlertPolicies from ._models_py3 import MaintenanceWindowOptions from ._models_py3 import MaintenanceWindowTimeRange @@ -96,11 +130,15 @@ from ._models_py3 import ManagedIntegrationRuntimeStatus from ._models_py3 import ManagedVirtualNetworkSettings from ._models_py3 import MetadataSyncConfig + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult from ._models_py3 import OperationMetaLogSpecification from ._models_py3 import OperationMetaMetricDimensionSpecification from ._models_py3 import OperationMetaMetricSpecification from ._models_py3 import OperationMetaServiceSpecification from ._models_py3 import OperationResource + from ._models_py3 import OptimizedAutoscale from ._models_py3 import PrivateEndpoint from ._models_py3 import PrivateEndpointConnection from ._models_py3 import PrivateEndpointConnectionForPrivateLinkHub @@ -121,6 +159,7 @@ from ._models_py3 import QueryInterval from ._models_py3 import QueryMetric from ._models_py3 import QueryStatistic + from ._models_py3 import ReadWriteDatabase from ._models_py3 import RecommendedSensitivityLabelUpdate from ._models_py3 import RecommendedSensitivityLabelUpdateList from ._models_py3 import RecoverableSqlPool @@ -153,6 +192,9 @@ from ._models_py3 import ServerVulnerabilityAssessment from ._models_py3 import ServerVulnerabilityAssessmentListResult from ._models_py3 import Sku + from ._models_py3 import SkuDescription + from ._models_py3 import SkuDescriptionList + from ._models_py3 import SkuLocationInfoItem from ._models_py3 import SparkConfigProperties from ._models_py3 import SparkConfigurationListResponse from ._models_py3 import SparkConfigurationResource @@ -189,6 +231,8 @@ from ._models_py3 import SsisProject from ._models_py3 import SsisVariable from ._models_py3 import SubResource + from ._models_py3 import SystemData + from ._models_py3 import TableLevelSharingProperties from ._models_py3 import TopQueries from ._models_py3 import TopQueriesListResult from ._models_py3 import TrackedResource @@ -213,29 +257,51 @@ from ._models_py3 import WorkspacePatchInfo from ._models_py3 import WorkspaceRepositoryConfiguration except (SyntaxError, ImportError): + from ._models import AttachedDatabaseConfiguration # type: ignore + from ._models import AttachedDatabaseConfigurationListResult # type: ignore from ._models import AutoPauseProperties # type: ignore from ._models import AutoScaleProperties # type: ignore from ._models import AvailableRpOperation # type: ignore from ._models import AvailableRpOperationDisplayInfo # type: ignore from ._models import AzureADOnlyAuthentication # type: ignore from ._models import AzureADOnlyAuthenticationListResult # type: ignore + from ._models import AzureCapacity # type: ignore from ._models import AzureEntityResource # type: ignore + from ._models import AzureResourceSku # type: ignore + from ._models import AzureSku # type: ignore from ._models import BigDataPoolPatchInfo # type: ignore from ._models import BigDataPoolResourceInfo # type: ignore from ._models import BigDataPoolResourceInfoListResult # type: ignore from ._models import CheckNameAvailabilityRequest # type: ignore from ._models import CheckNameAvailabilityResponse # type: ignore + from ._models import CheckNameResult # type: ignore + from ._models import ClusterPrincipalAssignment # type: ignore + from ._models import ClusterPrincipalAssignmentCheckNameRequest # type: ignore + from ._models import ClusterPrincipalAssignmentListResult # type: ignore from ._models import CmdkeySetup # type: ignore from ._models import ComponentSetup # type: ignore from ._models import CreateSqlPoolRestorePointDefinition # type: ignore from ._models import CspWorkspaceAdminProperties # type: ignore from ._models import CustomSetupBase # type: ignore from ._models import CustomerManagedKeyDetails # type: ignore + from ._models import DataConnection # type: ignore + from ._models import DataConnectionCheckNameRequest # type: ignore + from ._models import DataConnectionListResult # type: ignore + from ._models import DataConnectionValidation # type: ignore + from ._models import DataConnectionValidationListResult # type: ignore + from ._models import DataConnectionValidationResult # type: ignore from ._models import DataLakeStorageAccountDetails # type: ignore from ._models import DataMaskingPolicy # type: ignore from ._models import DataMaskingRule # type: ignore from ._models import DataMaskingRuleListResult # type: ignore from ._models import DataWarehouseUserActivities # type: ignore + from ._models import Database # type: ignore + from ._models import DatabaseCheckNameRequest # type: ignore + from ._models import DatabaseListResult # type: ignore + from ._models import DatabasePrincipalAssignment # type: ignore + from ._models import DatabasePrincipalAssignmentCheckNameRequest # type: ignore + from ._models import DatabasePrincipalAssignmentListResult # type: ignore + from ._models import DatabaseStatistics # type: ignore from ._models import DynamicExecutorAllocation # type: ignore from ._models import EncryptionDetails # type: ignore from ._models import EncryptionProtector # type: ignore @@ -245,10 +311,14 @@ from ._models import ErrorAdditionalInfo # type: ignore from ._models import ErrorDetail # type: ignore from ._models import ErrorResponse # type: ignore + from ._models import EventGridDataConnection # type: ignore + from ._models import EventHubDataConnection # type: ignore from ._models import ExtendedServerBlobAuditingPolicy # type: ignore from ._models import ExtendedServerBlobAuditingPolicyListResult # type: ignore from ._models import ExtendedSqlPoolBlobAuditingPolicy # type: ignore from ._models import ExtendedSqlPoolBlobAuditingPolicyListResult # type: ignore + from ._models import FollowerDatabaseDefinition # type: ignore + from ._models import FollowerDatabaseListResult # type: ignore from ._models import GeoBackupPolicy # type: ignore from ._models import GeoBackupPolicyListResult # type: ignore from ._models import GetSsisObjectMetadataRequest # type: ignore @@ -274,12 +344,19 @@ from ._models import IntegrationRuntimeStatus # type: ignore from ._models import IntegrationRuntimeStatusResponse # type: ignore from ._models import IntegrationRuntimeVNetProperties # type: ignore + from ._models import IotHubDataConnection # type: ignore from ._models import IpFirewallRuleInfo # type: ignore from ._models import IpFirewallRuleInfoListResult # type: ignore from ._models import IpFirewallRuleProperties # type: ignore from ._models import KekIdentityProperties # type: ignore from ._models import Key # type: ignore from ._models import KeyInfoListResult # type: ignore + from ._models import KustoPool # type: ignore + from ._models import KustoPoolCheckNameRequest # type: ignore + from ._models import KustoPoolListResult # type: ignore + from ._models import KustoPoolUpdate # type: ignore + from ._models import LanguageExtension # type: ignore + from ._models import LanguageExtensionsList # type: ignore from ._models import LibraryInfo # type: ignore from ._models import LibraryListResponse # type: ignore from ._models import LibraryRequirements # type: ignore @@ -288,6 +365,7 @@ from ._models import LinkedIntegrationRuntimeKeyAuthorization # type: ignore from ._models import LinkedIntegrationRuntimeRbacAuthorization # type: ignore from ._models import LinkedIntegrationRuntimeType # type: ignore + from ._models import ListResourceSkusResult # type: ignore from ._models import ListSqlPoolSecurityAlertPolicies # type: ignore from ._models import MaintenanceWindowOptions # type: ignore from ._models import MaintenanceWindowTimeRange # type: ignore @@ -302,11 +380,15 @@ from ._models import ManagedIntegrationRuntimeStatus # type: ignore from ._models import ManagedVirtualNetworkSettings # type: ignore from ._models import MetadataSyncConfig # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore from ._models import OperationMetaLogSpecification # type: ignore from ._models import OperationMetaMetricDimensionSpecification # type: ignore from ._models import OperationMetaMetricSpecification # type: ignore from ._models import OperationMetaServiceSpecification # type: ignore from ._models import OperationResource # type: ignore + from ._models import OptimizedAutoscale # type: ignore from ._models import PrivateEndpoint # type: ignore from ._models import PrivateEndpointConnection # type: ignore from ._models import PrivateEndpointConnectionForPrivateLinkHub # type: ignore @@ -327,6 +409,7 @@ from ._models import QueryInterval # type: ignore from ._models import QueryMetric # type: ignore from ._models import QueryStatistic # type: ignore + from ._models import ReadWriteDatabase # type: ignore from ._models import RecommendedSensitivityLabelUpdate # type: ignore from ._models import RecommendedSensitivityLabelUpdateList # type: ignore from ._models import RecoverableSqlPool # type: ignore @@ -359,6 +442,9 @@ from ._models import ServerVulnerabilityAssessment # type: ignore from ._models import ServerVulnerabilityAssessmentListResult # type: ignore from ._models import Sku # type: ignore + from ._models import SkuDescription # type: ignore + from ._models import SkuDescriptionList # type: ignore + from ._models import SkuLocationInfoItem # type: ignore from ._models import SparkConfigProperties # type: ignore from ._models import SparkConfigurationListResponse # type: ignore from ._models import SparkConfigurationResource # type: ignore @@ -395,6 +481,8 @@ from ._models import SsisProject # type: ignore from ._models import SsisVariable # type: ignore from ._models import SubResource # type: ignore + from ._models import SystemData # type: ignore + from ._models import TableLevelSharingProperties # type: ignore from ._models import TopQueries # type: ignore from ._models import TopQueriesListResult # type: ignore from ._models import TrackedResource # type: ignore @@ -421,18 +509,29 @@ from ._synapse_management_client_enums import ( AzureADOnlyAuthenticationName, + AzureScaleType, BlobAuditingPolicyName, BlobAuditingPolicyState, + BlobStorageEventType, + ClusterPrincipalRole, ColumnDataType, + Compression, ConfigurationType, ConnectionPolicyName, + CreateMode, + CreatedByType, + DataConnectionKind, DataFlowComputeType, DataMaskingFunction, DataMaskingRuleState, DataMaskingState, DataWarehouseUserActivityName, + DatabasePrincipalRole, DayOfWeek, + DefaultPrincipalsModificationKind, EncryptionProtectorName, + EventGridDataFormat, + EventHubDataFormat, GeoBackupPolicyName, GeoBackupPolicyState, IntegrationRuntimeAuthKeyName, @@ -445,6 +544,9 @@ IntegrationRuntimeState, IntegrationRuntimeType, IntegrationRuntimeUpdateResult, + IotHubDataFormat, + Kind, + LanguageExtensionName, ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentityActualState, ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentityDesiredState, ManagedIntegrationRuntimeNodeStatus, @@ -452,15 +554,18 @@ NodeSize, NodeSizeFamily, OperationStatus, + PrincipalType, ProvisioningState, QueryAggregationFunction, QueryExecutionType, QueryMetricUnit, QueryObservedMetricType, + Reason, RecommendedSensitivityLabelUpdateKind, ReplicationRole, ReplicationState, ResourceIdentityType, + ResourceProvisioningState, RestorePointType, SecurityAlertPolicyName, SecurityAlertPolicyNameAutoGenerated, @@ -470,11 +575,15 @@ SensitivityLabelSource, SensitivityLabelUpdateKind, ServerKeyType, + SkuName, + SkuSize, SsisObjectMetadataType, + State, StateValue, StorageAccountType, TransparentDataEncryptionName, TransparentDataEncryptionStatus, + Type, VulnerabilityAssessmentName, VulnerabilityAssessmentPolicyBaselineName, VulnerabilityAssessmentScanState, @@ -483,29 +592,51 @@ ) __all__ = [ + 'AttachedDatabaseConfiguration', + 'AttachedDatabaseConfigurationListResult', 'AutoPauseProperties', 'AutoScaleProperties', 'AvailableRpOperation', 'AvailableRpOperationDisplayInfo', 'AzureADOnlyAuthentication', 'AzureADOnlyAuthenticationListResult', + 'AzureCapacity', 'AzureEntityResource', + 'AzureResourceSku', + 'AzureSku', 'BigDataPoolPatchInfo', 'BigDataPoolResourceInfo', 'BigDataPoolResourceInfoListResult', 'CheckNameAvailabilityRequest', 'CheckNameAvailabilityResponse', + 'CheckNameResult', + 'ClusterPrincipalAssignment', + 'ClusterPrincipalAssignmentCheckNameRequest', + 'ClusterPrincipalAssignmentListResult', 'CmdkeySetup', 'ComponentSetup', 'CreateSqlPoolRestorePointDefinition', 'CspWorkspaceAdminProperties', 'CustomSetupBase', 'CustomerManagedKeyDetails', + 'DataConnection', + 'DataConnectionCheckNameRequest', + 'DataConnectionListResult', + 'DataConnectionValidation', + 'DataConnectionValidationListResult', + 'DataConnectionValidationResult', 'DataLakeStorageAccountDetails', 'DataMaskingPolicy', 'DataMaskingRule', 'DataMaskingRuleListResult', 'DataWarehouseUserActivities', + 'Database', + 'DatabaseCheckNameRequest', + 'DatabaseListResult', + 'DatabasePrincipalAssignment', + 'DatabasePrincipalAssignmentCheckNameRequest', + 'DatabasePrincipalAssignmentListResult', + 'DatabaseStatistics', 'DynamicExecutorAllocation', 'EncryptionDetails', 'EncryptionProtector', @@ -515,10 +646,14 @@ 'ErrorAdditionalInfo', 'ErrorDetail', 'ErrorResponse', + 'EventGridDataConnection', + 'EventHubDataConnection', 'ExtendedServerBlobAuditingPolicy', 'ExtendedServerBlobAuditingPolicyListResult', 'ExtendedSqlPoolBlobAuditingPolicy', 'ExtendedSqlPoolBlobAuditingPolicyListResult', + 'FollowerDatabaseDefinition', + 'FollowerDatabaseListResult', 'GeoBackupPolicy', 'GeoBackupPolicyListResult', 'GetSsisObjectMetadataRequest', @@ -544,12 +679,19 @@ 'IntegrationRuntimeStatus', 'IntegrationRuntimeStatusResponse', 'IntegrationRuntimeVNetProperties', + 'IotHubDataConnection', 'IpFirewallRuleInfo', 'IpFirewallRuleInfoListResult', 'IpFirewallRuleProperties', 'KekIdentityProperties', 'Key', 'KeyInfoListResult', + 'KustoPool', + 'KustoPoolCheckNameRequest', + 'KustoPoolListResult', + 'KustoPoolUpdate', + 'LanguageExtension', + 'LanguageExtensionsList', 'LibraryInfo', 'LibraryListResponse', 'LibraryRequirements', @@ -558,6 +700,7 @@ 'LinkedIntegrationRuntimeKeyAuthorization', 'LinkedIntegrationRuntimeRbacAuthorization', 'LinkedIntegrationRuntimeType', + 'ListResourceSkusResult', 'ListSqlPoolSecurityAlertPolicies', 'MaintenanceWindowOptions', 'MaintenanceWindowTimeRange', @@ -572,11 +715,15 @@ 'ManagedIntegrationRuntimeStatus', 'ManagedVirtualNetworkSettings', 'MetadataSyncConfig', + 'Operation', + 'OperationDisplay', + 'OperationListResult', 'OperationMetaLogSpecification', 'OperationMetaMetricDimensionSpecification', 'OperationMetaMetricSpecification', 'OperationMetaServiceSpecification', 'OperationResource', + 'OptimizedAutoscale', 'PrivateEndpoint', 'PrivateEndpointConnection', 'PrivateEndpointConnectionForPrivateLinkHub', @@ -597,6 +744,7 @@ 'QueryInterval', 'QueryMetric', 'QueryStatistic', + 'ReadWriteDatabase', 'RecommendedSensitivityLabelUpdate', 'RecommendedSensitivityLabelUpdateList', 'RecoverableSqlPool', @@ -629,6 +777,9 @@ 'ServerVulnerabilityAssessment', 'ServerVulnerabilityAssessmentListResult', 'Sku', + 'SkuDescription', + 'SkuDescriptionList', + 'SkuLocationInfoItem', 'SparkConfigProperties', 'SparkConfigurationListResponse', 'SparkConfigurationResource', @@ -665,6 +816,8 @@ 'SsisProject', 'SsisVariable', 'SubResource', + 'SystemData', + 'TableLevelSharingProperties', 'TopQueries', 'TopQueriesListResult', 'TrackedResource', @@ -689,18 +842,29 @@ 'WorkspacePatchInfo', 'WorkspaceRepositoryConfiguration', 'AzureADOnlyAuthenticationName', + 'AzureScaleType', 'BlobAuditingPolicyName', 'BlobAuditingPolicyState', + 'BlobStorageEventType', + 'ClusterPrincipalRole', 'ColumnDataType', + 'Compression', 'ConfigurationType', 'ConnectionPolicyName', + 'CreateMode', + 'CreatedByType', + 'DataConnectionKind', 'DataFlowComputeType', 'DataMaskingFunction', 'DataMaskingRuleState', 'DataMaskingState', 'DataWarehouseUserActivityName', + 'DatabasePrincipalRole', 'DayOfWeek', + 'DefaultPrincipalsModificationKind', 'EncryptionProtectorName', + 'EventGridDataFormat', + 'EventHubDataFormat', 'GeoBackupPolicyName', 'GeoBackupPolicyState', 'IntegrationRuntimeAuthKeyName', @@ -713,6 +877,9 @@ 'IntegrationRuntimeState', 'IntegrationRuntimeType', 'IntegrationRuntimeUpdateResult', + 'IotHubDataFormat', + 'Kind', + 'LanguageExtensionName', 'ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentityActualState', 'ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentityDesiredState', 'ManagedIntegrationRuntimeNodeStatus', @@ -720,15 +887,18 @@ 'NodeSize', 'NodeSizeFamily', 'OperationStatus', + 'PrincipalType', 'ProvisioningState', 'QueryAggregationFunction', 'QueryExecutionType', 'QueryMetricUnit', 'QueryObservedMetricType', + 'Reason', 'RecommendedSensitivityLabelUpdateKind', 'ReplicationRole', 'ReplicationState', 'ResourceIdentityType', + 'ResourceProvisioningState', 'RestorePointType', 'SecurityAlertPolicyName', 'SecurityAlertPolicyNameAutoGenerated', @@ -738,11 +908,15 @@ 'SensitivityLabelSource', 'SensitivityLabelUpdateKind', 'ServerKeyType', + 'SkuName', + 'SkuSize', 'SsisObjectMetadataType', + 'State', 'StateValue', 'StorageAccountType', 'TransparentDataEncryptionName', 'TransparentDataEncryptionStatus', + 'Type', 'VulnerabilityAssessmentName', 'VulnerabilityAssessmentPolicyBaselineName', 'VulnerabilityAssessmentScanState', 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 fb3cfc3548839..4d2ba3db1eb25 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 @@ -10,6 +10,172 @@ import msrest.serialization +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + + +class AttachedDatabaseConfiguration(ProxyResource): + """Class representing an attached database configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param location: Resource location. + :type location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.synapse.models.SystemData + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState + :param database_name: The name of the database which you would like to attach, use * if you + want to follow all current and future databases. + :type database_name: str + :param kusto_pool_resource_id: The resource id of the kusto pool where the databases you would + like to attach reside. + :type kusto_pool_resource_id: str + :ivar attached_database_names: The list of databases from the clusterResourceId which are + currently attached to the kusto pool. + :vartype attached_database_names: list[str] + :param default_principals_modification_kind: The default principals modification kind. Possible + values include: "Union", "Replace", "None". + :type default_principals_modification_kind: str or + ~azure.mgmt.synapse.models.DefaultPrincipalsModificationKind + :param table_level_sharing_properties: Table level sharing specifications. + :type table_level_sharing_properties: ~azure.mgmt.synapse.models.TableLevelSharingProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'attached_database_names': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'database_name': {'key': 'properties.databaseName', 'type': 'str'}, + 'kusto_pool_resource_id': {'key': 'properties.clusterResourceId', 'type': 'str'}, + 'attached_database_names': {'key': 'properties.attachedDatabaseNames', 'type': '[str]'}, + 'default_principals_modification_kind': {'key': 'properties.defaultPrincipalsModificationKind', 'type': 'str'}, + 'table_level_sharing_properties': {'key': 'properties.tableLevelSharingProperties', 'type': 'TableLevelSharingProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(AttachedDatabaseConfiguration, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.system_data = None + self.provisioning_state = None + self.database_name = kwargs.get('database_name', None) + self.kusto_pool_resource_id = kwargs.get('kusto_pool_resource_id', None) + self.attached_database_names = None + self.default_principals_modification_kind = kwargs.get('default_principals_modification_kind', None) + self.table_level_sharing_properties = kwargs.get('table_level_sharing_properties', None) + + +class AttachedDatabaseConfigurationListResult(msrest.serialization.Model): + """The list attached database configurations operation response. + + :param value: The list of attached database configurations. + :type value: list[~azure.mgmt.synapse.models.AttachedDatabaseConfiguration] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AttachedDatabaseConfiguration]'}, + } + + def __init__( + self, + **kwargs + ): + super(AttachedDatabaseConfigurationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + class AutoPauseProperties(msrest.serialization.Model): """Auto-pausing properties of a Big Data pool powered by Apache Spark. @@ -127,77 +293,6 @@ def __init__( self.operation = kwargs.get('operation', None) -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - class AzureADOnlyAuthentication(ProxyResource): """Azure Active Directory Only Authentication Info. @@ -277,6 +372,47 @@ def __init__( self.next_link = None +class AzureCapacity(msrest.serialization.Model): + """Azure capacity definition. + + All required parameters must be populated in order to send to Azure. + + :param scale_type: Required. Scale type. Possible values include: "automatic", "manual", + "none". + :type scale_type: str or ~azure.mgmt.synapse.models.AzureScaleType + :param minimum: Required. Minimum allowed capacity. + :type minimum: int + :param maximum: Required. Maximum allowed capacity. + :type maximum: int + :param default: Required. The default capacity that would be used. + :type default: int + """ + + _validation = { + 'scale_type': {'required': True}, + 'minimum': {'required': True}, + 'maximum': {'required': True}, + 'default': {'required': True}, + } + + _attribute_map = { + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + 'minimum': {'key': 'minimum', 'type': 'int'}, + 'maximum': {'key': 'maximum', 'type': 'int'}, + 'default': {'key': 'default', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(AzureCapacity, self).__init__(**kwargs) + self.scale_type = kwargs['scale_type'] + self.minimum = kwargs['minimum'] + self.maximum = kwargs['maximum'] + self.default = kwargs['default'] + + class AzureEntityResource(Resource): """The resource model definition for an Azure Resource Manager resource with an etag. @@ -316,6 +452,69 @@ def __init__( self.etag = None +class AzureResourceSku(msrest.serialization.Model): + """Azure resource SKU definition. + + :param resource_type: Resource Namespace and Type. + :type resource_type: str + :param sku: The SKU details. + :type sku: ~azure.mgmt.synapse.models.AzureSku + :param capacity: The number of instances of the cluster. + :type capacity: ~azure.mgmt.synapse.models.AzureCapacity + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'AzureSku'}, + 'capacity': {'key': 'capacity', 'type': 'AzureCapacity'}, + } + + def __init__( + self, + **kwargs + ): + super(AzureResourceSku, self).__init__(**kwargs) + self.resource_type = kwargs.get('resource_type', None) + self.sku = kwargs.get('sku', None) + self.capacity = kwargs.get('capacity', None) + + +class AzureSku(msrest.serialization.Model): + """Azure SKU definition. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. SKU name. Possible values include: "Compute optimized", "Storage + optimized". + :type name: str or ~azure.mgmt.synapse.models.SkuName + :param capacity: The number of instances of the cluster. + :type capacity: int + :param size: Required. SKU size. Possible values include: "Extra small", "Small", "Medium", + "Large". + :type size: str or ~azure.mgmt.synapse.models.SkuSize + """ + + _validation = { + 'name': {'required': True}, + 'size': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + 'size': {'key': 'size', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AzureSku, self).__init__(**kwargs) + self.name = kwargs['name'] + self.capacity = kwargs.get('capacity', None) + self.size = kwargs['size'] + + class BigDataPoolPatchInfo(msrest.serialization.Model): """Properties patch for a Big Data pool. @@ -501,261 +700,853 @@ def __init__( class BigDataPoolResourceInfoListResult(msrest.serialization.Model): """Collection of Big Data pool information. - :param next_link: Link to the next page of results. - :type next_link: str - :param value: List of Big Data pools. - :type value: list[~azure.mgmt.synapse.models.BigDataPoolResourceInfo] + :param next_link: Link to the next page of results. + :type next_link: str + :param value: List of Big Data pools. + :type value: list[~azure.mgmt.synapse.models.BigDataPoolResourceInfo] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[BigDataPoolResourceInfo]'}, + } + + def __init__( + self, + **kwargs + ): + super(BigDataPoolResourceInfoListResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) + + +class CheckNameAvailabilityRequest(msrest.serialization.Model): + """A request about whether a workspace name is available. + + :param name: Workspace name. + :type name: str + :param type: Type: workspace. + :type type: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailabilityRequest, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.type = kwargs.get('type', None) + + +class CheckNameAvailabilityResponse(msrest.serialization.Model): + """A response saying whether the workspace name is available. + + :param message: Validation message. + :type message: str + :param available: Whether the workspace name is available. + :type available: bool + :param reason: Reason the workspace name is or is not available. + :type reason: str + :param name: Workspace name. + :type name: str + """ + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'available': {'key': 'available', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailabilityResponse, self).__init__(**kwargs) + self.message = kwargs.get('message', None) + self.available = kwargs.get('available', None) + self.reason = kwargs.get('reason', None) + self.name = kwargs.get('name', None) + + +class CheckNameResult(msrest.serialization.Model): + """The result returned from a check name availability request. + + :param name_available: Specifies a Boolean value that indicates if the name is available. + :type name_available: bool + :param name: The name that was checked. + :type name: str + :param message: Message indicating an unavailable name due to a conflict, or a description of + the naming rules that are violated. + :type message: str + :param reason: Message providing the reason why the given name is invalid. Possible values + include: "Invalid", "AlreadyExists". + :type reason: str or ~azure.mgmt.synapse.models.Reason + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameResult, self).__init__(**kwargs) + self.name_available = kwargs.get('name_available', None) + self.name = kwargs.get('name', None) + self.message = kwargs.get('message', None) + self.reason = kwargs.get('reason', None) + + +class ClusterPrincipalAssignment(ProxyResource): + """Class representing a cluster principal assignment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.synapse.models.SystemData + :param principal_id: The principal ID assigned to the cluster principal. It can be a user + email, application ID, or security group name. + :type principal_id: str + :param role: Cluster principal role. Possible values include: "AllDatabasesAdmin", + "AllDatabasesViewer". + :type role: str or ~azure.mgmt.synapse.models.ClusterPrincipalRole + :param tenant_id: The tenant id of the principal. + :type tenant_id: str + :param principal_type: Principal type. Possible values include: "App", "Group", "User". + :type principal_type: str or ~azure.mgmt.synapse.models.PrincipalType + :ivar tenant_name: The tenant name of the principal. + :vartype tenant_name: str + :ivar principal_name: The principal name. + :vartype principal_name: str + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'tenant_name': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'role': {'key': 'properties.role', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'principal_type': {'key': 'properties.principalType', 'type': 'str'}, + 'tenant_name': {'key': 'properties.tenantName', 'type': 'str'}, + 'principal_name': {'key': 'properties.principalName', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ClusterPrincipalAssignment, self).__init__(**kwargs) + self.system_data = None + self.principal_id = kwargs.get('principal_id', None) + self.role = kwargs.get('role', None) + self.tenant_id = kwargs.get('tenant_id', None) + self.principal_type = kwargs.get('principal_type', None) + self.tenant_name = None + self.principal_name = None + self.provisioning_state = None + + +class ClusterPrincipalAssignmentCheckNameRequest(msrest.serialization.Model): + """A principal assignment check name availability request. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Principal Assignment resource name. + :type name: str + :ivar type: The type of resource, Microsoft.Synapse/workspaces/kustoPools/principalAssignments. + Has constant value: "Microsoft.Synapse/workspaces/kustoPools/principalAssignments". + :vartype type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + type = "Microsoft.Synapse/workspaces/kustoPools/principalAssignments" + + def __init__( + self, + **kwargs + ): + super(ClusterPrincipalAssignmentCheckNameRequest, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class ClusterPrincipalAssignmentListResult(msrest.serialization.Model): + """The list Kusto cluster principal assignments operation response. + + :param value: The list of Kusto cluster principal assignments. + :type value: list[~azure.mgmt.synapse.models.ClusterPrincipalAssignment] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ClusterPrincipalAssignment]'}, + } + + def __init__( + self, + **kwargs + ): + super(ClusterPrincipalAssignmentListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class CustomSetupBase(msrest.serialization.Model): + """The base definition of the custom setup. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: CmdkeySetup, ComponentSetup, EnvironmentVariableSetup. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of custom setup.Constant filled by server. + :type type: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'CmdkeySetup': 'CmdkeySetup', 'ComponentSetup': 'ComponentSetup', 'EnvironmentVariableSetup': 'EnvironmentVariableSetup'} + } + + def __init__( + self, + **kwargs + ): + super(CustomSetupBase, self).__init__(**kwargs) + self.type = None # type: Optional[str] + + +class CmdkeySetup(CustomSetupBase): + """The custom setup of running cmdkey commands. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of custom setup.Constant filled by server. + :type type: str + :param target_name: Required. The server name of data source access. + :type target_name: any + :param user_name: Required. The user name of data source access. + :type user_name: any + :param password: Required. The password of data source access. + :type password: ~azure.mgmt.synapse.models.SecretBase + """ + + _validation = { + 'type': {'required': True}, + 'target_name': {'required': True}, + 'user_name': {'required': True}, + 'password': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'target_name': {'key': 'typeProperties.targetName', 'type': 'object'}, + 'user_name': {'key': 'typeProperties.userName', 'type': 'object'}, + 'password': {'key': 'typeProperties.password', 'type': 'SecretBase'}, + } + + def __init__( + self, + **kwargs + ): + super(CmdkeySetup, self).__init__(**kwargs) + self.type = 'CmdkeySetup' # type: str + self.target_name = kwargs['target_name'] + self.user_name = kwargs['user_name'] + self.password = kwargs['password'] + + +class ComponentSetup(CustomSetupBase): + """The custom setup of installing 3rd party components. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of custom setup.Constant filled by server. + :type type: str + :param component_name: Required. The name of the 3rd party component. + :type component_name: str + :param license_key: The license key to activate the component. + :type license_key: ~azure.mgmt.synapse.models.SecretBase + """ + + _validation = { + 'type': {'required': True}, + 'component_name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'component_name': {'key': 'typeProperties.componentName', 'type': 'str'}, + 'license_key': {'key': 'typeProperties.licenseKey', 'type': 'SecretBase'}, + } + + def __init__( + self, + **kwargs + ): + super(ComponentSetup, self).__init__(**kwargs) + self.type = 'ComponentSetup' # type: str + self.component_name = kwargs['component_name'] + self.license_key = kwargs.get('license_key', None) + + +class CreateSqlPoolRestorePointDefinition(msrest.serialization.Model): + """Contains the information necessary to perform a create Sql pool restore point operation. + + All required parameters must be populated in order to send to Azure. + + :param restore_point_label: Required. The restore point label to apply. + :type restore_point_label: str + """ + + _validation = { + 'restore_point_label': {'required': True}, + } + + _attribute_map = { + 'restore_point_label': {'key': 'restorePointLabel', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CreateSqlPoolRestorePointDefinition, self).__init__(**kwargs) + self.restore_point_label = kwargs['restore_point_label'] + + +class CspWorkspaceAdminProperties(msrest.serialization.Model): + """Initial workspace AAD admin properties for a CSP subscription. + + :param initial_workspace_admin_object_id: AAD object ID of initial workspace admin. + :type initial_workspace_admin_object_id: str + """ + + _attribute_map = { + 'initial_workspace_admin_object_id': {'key': 'initialWorkspaceAdminObjectId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CspWorkspaceAdminProperties, self).__init__(**kwargs) + self.initial_workspace_admin_object_id = kwargs.get('initial_workspace_admin_object_id', None) + + +class CustomerManagedKeyDetails(msrest.serialization.Model): + """Details of the customer managed key associated with the workspace. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The customer managed key status on the workspace. + :vartype status: str + :param key: The key object of the workspace. + :type key: ~azure.mgmt.synapse.models.WorkspaceKeyDetails + :param kek_identity: Key encryption key. + :type kek_identity: ~azure.mgmt.synapse.models.KekIdentityProperties + """ + + _validation = { + 'status': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'WorkspaceKeyDetails'}, + 'kek_identity': {'key': 'kekIdentity', 'type': 'KekIdentityProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(CustomerManagedKeyDetails, self).__init__(**kwargs) + self.status = None + self.key = kwargs.get('key', None) + self.kek_identity = kwargs.get('kek_identity', None) + + +class Database(ProxyResource): + """Class representing a Kusto database. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ReadWriteDatabase. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the database.Constant filled by server. Possible values + include: "ReadWrite", "ReadOnlyFollowing". + :type kind: str or ~azure.mgmt.synapse.models.Kind + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.synapse.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + _subtype_map = { + 'kind': {'ReadWrite': 'ReadWriteDatabase'} + } + + def __init__( + self, + **kwargs + ): + super(Database, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.kind = 'Database' # type: str + self.system_data = None + + +class DatabaseCheckNameRequest(msrest.serialization.Model): + """The result returned from a database check name availability request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Resource name. + :type name: str + :param type: Required. The type of resource, for instance + Microsoft.Synapse/workspaces/kustoPools/databases. Possible values include: + "Microsoft.Synapse/workspaces/kustoPools/databases", + "Microsoft.Synapse/workspaces/kustoPools/attachedDatabaseConfigurations". + :type type: str or ~azure.mgmt.synapse.models.Type + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DatabaseCheckNameRequest, self).__init__(**kwargs) + self.name = kwargs['name'] + self.type = kwargs['type'] + + +class DatabaseListResult(msrest.serialization.Model): + """The list Kusto databases operation response. + + :param value: The list of Kusto databases. + :type value: list[~azure.mgmt.synapse.models.Database] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Database]'}, + } + + def __init__( + self, + **kwargs + ): + super(DatabaseListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class DatabasePrincipalAssignment(ProxyResource): + """Class representing a database principal assignment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.synapse.models.SystemData + :param principal_id: The principal ID assigned to the database principal. It can be a user + email, application ID, or security group name. + :type principal_id: str + :param role: Database principal role. Possible values include: "Admin", "Ingestor", "Monitor", + "User", "UnrestrictedViewer", "Viewer". + :type role: str or ~azure.mgmt.synapse.models.DatabasePrincipalRole + :param tenant_id: The tenant id of the principal. + :type tenant_id: str + :param principal_type: Principal type. Possible values include: "App", "Group", "User". + :type principal_type: str or ~azure.mgmt.synapse.models.PrincipalType + :ivar tenant_name: The tenant name of the principal. + :vartype tenant_name: str + :ivar principal_name: The principal name. + :vartype principal_name: str + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'tenant_name': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'role': {'key': 'properties.role', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'principal_type': {'key': 'properties.principalType', 'type': 'str'}, + 'tenant_name': {'key': 'properties.tenantName', 'type': 'str'}, + 'principal_name': {'key': 'properties.principalName', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DatabasePrincipalAssignment, self).__init__(**kwargs) + self.system_data = None + self.principal_id = kwargs.get('principal_id', None) + self.role = kwargs.get('role', None) + self.tenant_id = kwargs.get('tenant_id', None) + self.principal_type = kwargs.get('principal_type', None) + self.tenant_name = None + self.principal_name = None + self.provisioning_state = None + + +class DatabasePrincipalAssignmentCheckNameRequest(msrest.serialization.Model): + """A principal assignment check name availability request. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Principal Assignment resource name. + :type name: str + :ivar type: The type of resource, + Microsoft.Synapse/workspaces/kustoPools/databases/principalAssignments. Has constant value: + "Microsoft.Synapse/workspaces/kustoPools/databases/principalAssignments". + :vartype type: str """ + _validation = { + 'name': {'required': True}, + 'type': {'required': True, 'constant': True}, + } + _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[BigDataPoolResourceInfo]'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, } + type = "Microsoft.Synapse/workspaces/kustoPools/databases/principalAssignments" + def __init__( self, **kwargs ): - super(BigDataPoolResourceInfoListResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) - self.value = kwargs.get('value', None) + super(DatabasePrincipalAssignmentCheckNameRequest, self).__init__(**kwargs) + self.name = kwargs['name'] -class CheckNameAvailabilityRequest(msrest.serialization.Model): - """A request about whether a workspace name is available. +class DatabasePrincipalAssignmentListResult(msrest.serialization.Model): + """The list Kusto database principal assignments operation response. - :param name: Workspace name. - :type name: str - :param type: Type: workspace. - :type type: str + :param value: The list of Kusto database principal assignments. + :type value: list[~azure.mgmt.synapse.models.DatabasePrincipalAssignment] """ _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[DatabasePrincipalAssignment]'}, } def __init__( self, **kwargs ): - super(CheckNameAvailabilityRequest, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) + super(DatabasePrincipalAssignmentListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) -class CheckNameAvailabilityResponse(msrest.serialization.Model): - """A response saying whether the workspace name is available. +class DatabaseStatistics(msrest.serialization.Model): + """A class that contains database statistics information. - :param message: Validation message. - :type message: str - :param available: Whether the workspace name is available. - :type available: bool - :param reason: Reason the workspace name is or is not available. - :type reason: str - :param name: Workspace name. - :type name: str + :param size: The database size - the total size of compressed data and index in bytes. + :type size: float """ _attribute_map = { - 'message': {'key': 'message', 'type': 'str'}, - 'available': {'key': 'available', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'float'}, } def __init__( self, **kwargs ): - super(CheckNameAvailabilityResponse, self).__init__(**kwargs) - self.message = kwargs.get('message', None) - self.available = kwargs.get('available', None) - self.reason = kwargs.get('reason', None) - self.name = kwargs.get('name', None) + super(DatabaseStatistics, self).__init__(**kwargs) + self.size = kwargs.get('size', None) -class CustomSetupBase(msrest.serialization.Model): - """The base definition of the custom setup. +class DataConnection(ProxyResource): + """Class representing a data connection. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: CmdkeySetup, ComponentSetup, EnvironmentVariableSetup. + sub-classes are: EventGridDataConnection, EventHubDataConnection, IotHubDataConnection. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :param type: Required. The type of custom setup.Constant filled by server. - :type type: 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 + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + Possible values include: "EventHub", "EventGrid", "IotHub". + :type kind: str or ~azure.mgmt.synapse.models.DataConnectionKind + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.synapse.models.SystemData """ _validation = { - 'type': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + 'system_data': {'readonly': True}, } _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } _subtype_map = { - 'type': {'CmdkeySetup': 'CmdkeySetup', 'ComponentSetup': 'ComponentSetup', 'EnvironmentVariableSetup': 'EnvironmentVariableSetup'} + 'kind': {'EventGrid': 'EventGridDataConnection', 'EventHub': 'EventHubDataConnection', 'IotHub': 'IotHubDataConnection'} } def __init__( self, **kwargs ): - super(CustomSetupBase, self).__init__(**kwargs) - self.type = None # type: Optional[str] + super(DataConnection, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.kind = 'DataConnection' # type: str + self.system_data = None -class CmdkeySetup(CustomSetupBase): - """The custom setup of running cmdkey commands. +class DataConnectionCheckNameRequest(msrest.serialization.Model): + """A data connection check name availability request. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :param type: Required. The type of custom setup.Constant filled by server. - :type type: str - :param target_name: Required. The server name of data source access. - :type target_name: any - :param user_name: Required. The user name of data source access. - :type user_name: any - :param password: Required. The password of data source access. - :type password: ~azure.mgmt.synapse.models.SecretBase + :param name: Required. Data Connection name. + :type name: str + :ivar type: The type of resource, + Microsoft.Synapse/workspaces/kustoPools/databases/dataConnections. Has constant value: + "Microsoft.Synapse/workspaces/kustoPools/databases/dataConnections". + :vartype type: str """ _validation = { - 'type': {'required': True}, - 'target_name': {'required': True}, - 'user_name': {'required': True}, - 'password': {'required': True}, + 'name': {'required': True}, + 'type': {'required': True, 'constant': True}, } _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'target_name': {'key': 'typeProperties.targetName', 'type': 'object'}, - 'user_name': {'key': 'typeProperties.userName', 'type': 'object'}, - 'password': {'key': 'typeProperties.password', 'type': 'SecretBase'}, } + type = "Microsoft.Synapse/workspaces/kustoPools/databases/dataConnections" + def __init__( self, **kwargs ): - super(CmdkeySetup, self).__init__(**kwargs) - self.type = 'CmdkeySetup' # type: str - self.target_name = kwargs['target_name'] - self.user_name = kwargs['user_name'] - self.password = kwargs['password'] - + super(DataConnectionCheckNameRequest, self).__init__(**kwargs) + self.name = kwargs['name'] -class ComponentSetup(CustomSetupBase): - """The custom setup of installing 3rd party components. - All required parameters must be populated in order to send to Azure. +class DataConnectionListResult(msrest.serialization.Model): + """The list Kusto data connections operation response. - :param type: Required. The type of custom setup.Constant filled by server. - :type type: str - :param component_name: Required. The name of the 3rd party component. - :type component_name: str - :param license_key: The license key to activate the component. - :type license_key: ~azure.mgmt.synapse.models.SecretBase + :param value: The list of Kusto data connections. + :type value: list[~azure.mgmt.synapse.models.DataConnection] """ - _validation = { - 'type': {'required': True}, - 'component_name': {'required': True}, - } - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'component_name': {'key': 'typeProperties.componentName', 'type': 'str'}, - 'license_key': {'key': 'typeProperties.licenseKey', 'type': 'SecretBase'}, + 'value': {'key': 'value', 'type': '[DataConnection]'}, } def __init__( self, **kwargs ): - super(ComponentSetup, self).__init__(**kwargs) - self.type = 'ComponentSetup' # type: str - self.component_name = kwargs['component_name'] - self.license_key = kwargs.get('license_key', None) - + super(DataConnectionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) -class CreateSqlPoolRestorePointDefinition(msrest.serialization.Model): - """Contains the information necessary to perform a create Sql pool restore point operation. - All required parameters must be populated in order to send to Azure. +class DataConnectionValidation(msrest.serialization.Model): + """Class representing an data connection validation. - :param restore_point_label: Required. The restore point label to apply. - :type restore_point_label: str + :param data_connection_name: The name of the data connection. + :type data_connection_name: str + :param properties: The data connection properties to validate. + :type properties: ~azure.mgmt.synapse.models.DataConnection """ - _validation = { - 'restore_point_label': {'required': True}, - } - _attribute_map = { - 'restore_point_label': {'key': 'restorePointLabel', 'type': 'str'}, + 'data_connection_name': {'key': 'dataConnectionName', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DataConnection'}, } def __init__( self, **kwargs ): - super(CreateSqlPoolRestorePointDefinition, self).__init__(**kwargs) - self.restore_point_label = kwargs['restore_point_label'] + super(DataConnectionValidation, self).__init__(**kwargs) + self.data_connection_name = kwargs.get('data_connection_name', None) + self.properties = kwargs.get('properties', None) -class CspWorkspaceAdminProperties(msrest.serialization.Model): - """Initial workspace AAD admin properties for a CSP subscription. +class DataConnectionValidationListResult(msrest.serialization.Model): + """The list Kusto data connection validation result. - :param initial_workspace_admin_object_id: AAD object ID of initial workspace admin. - :type initial_workspace_admin_object_id: str + :param value: The list of Kusto data connection validation errors. + :type value: list[~azure.mgmt.synapse.models.DataConnectionValidationResult] """ _attribute_map = { - 'initial_workspace_admin_object_id': {'key': 'initialWorkspaceAdminObjectId', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[DataConnectionValidationResult]'}, } def __init__( self, **kwargs ): - super(CspWorkspaceAdminProperties, self).__init__(**kwargs) - self.initial_workspace_admin_object_id = kwargs.get('initial_workspace_admin_object_id', None) - + super(DataConnectionValidationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) -class CustomerManagedKeyDetails(msrest.serialization.Model): - """Details of the customer managed key associated with the workspace. - Variables are only populated by the server, and will be ignored when sending a request. +class DataConnectionValidationResult(msrest.serialization.Model): + """The result returned from a data connection validation request. - :ivar status: The customer managed key status on the workspace. - :vartype status: str - :param key: The key object of the workspace. - :type key: ~azure.mgmt.synapse.models.WorkspaceKeyDetails - :param kek_identity: Key encryption key. - :type kek_identity: ~azure.mgmt.synapse.models.KekIdentityProperties + :param error_message: A message which indicates a problem in data connection validation. + :type error_message: str """ - _validation = { - 'status': {'readonly': True}, - } - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'WorkspaceKeyDetails'}, - 'kek_identity': {'key': 'kekIdentity', 'type': 'KekIdentityProperties'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, } def __init__( self, **kwargs ): - super(CustomerManagedKeyDetails, self).__init__(**kwargs) - self.status = None - self.key = kwargs.get('key', None) - self.kek_identity = kwargs.get('kek_identity', None) + super(DataConnectionValidationResult, self).__init__(**kwargs) + self.error_message = kwargs.get('error_message', None) class DataLakeStorageAccountDetails(msrest.serialization.Model): @@ -1322,6 +2113,194 @@ def __init__( self.error = kwargs.get('error', None) +class EventGridDataConnection(DataConnection): + """Class representing an Event Grid data connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + Possible values include: "EventHub", "EventGrid", "IotHub". + :type kind: str or ~azure.mgmt.synapse.models.DataConnectionKind + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.synapse.models.SystemData + :param storage_account_resource_id: The resource ID of the storage account where the data + resides. + :type storage_account_resource_id: str + :param event_hub_resource_id: The resource ID where the event grid is configured to send + events. + :type event_hub_resource_id: str + :param consumer_group: The event hub consumer group. + :type consumer_group: str + :param table_name: The table where the data should be ingested. Optionally the table + information can be added to each message. + :type table_name: str + :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the + mapping information can be added to each message. + :type mapping_rule_name: str + :param data_format: The data format of the message. Optionally the data format can be added to + each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", + "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", + "W3CLOGFILE". + :type data_format: str or ~azure.mgmt.synapse.models.EventGridDataFormat + :param ignore_first_record: A Boolean value that, if set to true, indicates that ingestion + should ignore the first record of every file. + :type ignore_first_record: bool + :param blob_storage_event_type: The name of blob storage event type to process. Possible values + include: "Microsoft.Storage.BlobCreated", "Microsoft.Storage.BlobRenamed". + :type blob_storage_event_type: str or ~azure.mgmt.synapse.models.BlobStorageEventType + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'storage_account_resource_id': {'key': 'properties.storageAccountResourceId', 'type': 'str'}, + 'event_hub_resource_id': {'key': 'properties.eventHubResourceId', 'type': 'str'}, + 'consumer_group': {'key': 'properties.consumerGroup', 'type': 'str'}, + 'table_name': {'key': 'properties.tableName', 'type': 'str'}, + 'mapping_rule_name': {'key': 'properties.mappingRuleName', 'type': 'str'}, + 'data_format': {'key': 'properties.dataFormat', 'type': 'str'}, + 'ignore_first_record': {'key': 'properties.ignoreFirstRecord', 'type': 'bool'}, + 'blob_storage_event_type': {'key': 'properties.blobStorageEventType', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventGridDataConnection, self).__init__(**kwargs) + self.kind = 'EventGrid' # type: str + self.storage_account_resource_id = kwargs.get('storage_account_resource_id', None) + self.event_hub_resource_id = kwargs.get('event_hub_resource_id', None) + self.consumer_group = kwargs.get('consumer_group', None) + self.table_name = kwargs.get('table_name', None) + self.mapping_rule_name = kwargs.get('mapping_rule_name', None) + self.data_format = kwargs.get('data_format', None) + self.ignore_first_record = kwargs.get('ignore_first_record', None) + self.blob_storage_event_type = kwargs.get('blob_storage_event_type', None) + self.provisioning_state = None + + +class EventHubDataConnection(DataConnection): + """Class representing an event hub data connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + Possible values include: "EventHub", "EventGrid", "IotHub". + :type kind: str or ~azure.mgmt.synapse.models.DataConnectionKind + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.synapse.models.SystemData + :param event_hub_resource_id: The resource ID of the event hub to be used to create a data + connection. + :type event_hub_resource_id: str + :param consumer_group: The event hub consumer group. + :type consumer_group: str + :param table_name: The table where the data should be ingested. Optionally the table + information can be added to each message. + :type table_name: str + :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the + mapping information can be added to each message. + :type mapping_rule_name: str + :param data_format: The data format of the message. Optionally the data format can be added to + each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", + "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", + "W3CLOGFILE". + :type data_format: str or ~azure.mgmt.synapse.models.EventHubDataFormat + :param event_system_properties: System properties of the event hub. + :type event_system_properties: list[str] + :param compression: The event hub messages compression type. Possible values include: "None", + "GZip". + :type compression: str or ~azure.mgmt.synapse.models.Compression + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'event_hub_resource_id': {'key': 'properties.eventHubResourceId', 'type': 'str'}, + 'consumer_group': {'key': 'properties.consumerGroup', 'type': 'str'}, + 'table_name': {'key': 'properties.tableName', 'type': 'str'}, + 'mapping_rule_name': {'key': 'properties.mappingRuleName', 'type': 'str'}, + 'data_format': {'key': 'properties.dataFormat', 'type': 'str'}, + 'event_system_properties': {'key': 'properties.eventSystemProperties', 'type': '[str]'}, + 'compression': {'key': 'properties.compression', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventHubDataConnection, self).__init__(**kwargs) + self.kind = 'EventHub' # type: str + self.event_hub_resource_id = kwargs.get('event_hub_resource_id', None) + self.consumer_group = kwargs.get('consumer_group', None) + self.table_name = kwargs.get('table_name', None) + self.mapping_rule_name = kwargs.get('mapping_rule_name', None) + self.data_format = kwargs.get('data_format', None) + self.event_system_properties = kwargs.get('event_system_properties', None) + self.compression = kwargs.get('compression', None) + self.provisioning_state = None + + class ExtendedServerBlobAuditingPolicy(ProxyResource): """An extended server blob auditing policy. @@ -1732,6 +2711,65 @@ def __init__( self.next_link = None +class FollowerDatabaseDefinition(msrest.serialization.Model): + """A class representing follower database request. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param kusto_pool_resource_id: Required. Resource id of the cluster that follows a database + owned by this cluster. + :type kusto_pool_resource_id: str + :param attached_database_configuration_name: Required. Resource name of the attached database + configuration in the follower cluster. + :type attached_database_configuration_name: str + :ivar database_name: The database name owned by this cluster that was followed. * in case + following all databases. + :vartype database_name: str + """ + + _validation = { + 'kusto_pool_resource_id': {'required': True}, + 'attached_database_configuration_name': {'required': True}, + 'database_name': {'readonly': True}, + } + + _attribute_map = { + 'kusto_pool_resource_id': {'key': 'clusterResourceId', 'type': 'str'}, + 'attached_database_configuration_name': {'key': 'attachedDatabaseConfigurationName', 'type': 'str'}, + 'database_name': {'key': 'databaseName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(FollowerDatabaseDefinition, self).__init__(**kwargs) + self.kusto_pool_resource_id = kwargs['kusto_pool_resource_id'] + self.attached_database_configuration_name = kwargs['attached_database_configuration_name'] + self.database_name = None + + +class FollowerDatabaseListResult(msrest.serialization.Model): + """The list Kusto database principals operation response. + + :param value: The list of follower database result. + :type value: list[~azure.mgmt.synapse.models.FollowerDatabaseDefinition] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[FollowerDatabaseDefinition]'}, + } + + def __init__( + self, + **kwargs + ): + super(FollowerDatabaseListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + class GeoBackupPolicy(ProxyResource): """A database geo backup policy. @@ -2646,6 +3684,96 @@ def __init__( self.subnet_id = kwargs.get('subnet_id', None) +class IotHubDataConnection(DataConnection): + """Class representing an iot hub data connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + Possible values include: "EventHub", "EventGrid", "IotHub". + :type kind: str or ~azure.mgmt.synapse.models.DataConnectionKind + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.synapse.models.SystemData + :param iot_hub_resource_id: The resource ID of the Iot hub to be used to create a data + connection. + :type iot_hub_resource_id: str + :param consumer_group: The iot hub consumer group. + :type consumer_group: str + :param table_name: The table where the data should be ingested. Optionally the table + information can be added to each message. + :type table_name: str + :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the + mapping information can be added to each message. + :type mapping_rule_name: str + :param data_format: The data format of the message. Optionally the data format can be added to + each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", + "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", + "W3CLOGFILE". + :type data_format: str or ~azure.mgmt.synapse.models.IotHubDataFormat + :param event_system_properties: System properties of the iot hub. + :type event_system_properties: list[str] + :param shared_access_policy_name: The name of the share access policy. + :type shared_access_policy_name: str + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'iot_hub_resource_id': {'key': 'properties.iotHubResourceId', 'type': 'str'}, + 'consumer_group': {'key': 'properties.consumerGroup', 'type': 'str'}, + 'table_name': {'key': 'properties.tableName', 'type': 'str'}, + 'mapping_rule_name': {'key': 'properties.mappingRuleName', 'type': 'str'}, + 'data_format': {'key': 'properties.dataFormat', 'type': 'str'}, + 'event_system_properties': {'key': 'properties.eventSystemProperties', 'type': '[str]'}, + 'shared_access_policy_name': {'key': 'properties.sharedAccessPolicyName', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubDataConnection, self).__init__(**kwargs) + self.kind = 'IotHub' # type: str + self.iot_hub_resource_id = kwargs.get('iot_hub_resource_id', None) + self.consumer_group = kwargs.get('consumer_group', None) + self.table_name = kwargs.get('table_name', None) + self.mapping_rule_name = kwargs.get('mapping_rule_name', None) + self.data_format = kwargs.get('data_format', None) + self.event_system_properties = kwargs.get('event_system_properties', None) + self.shared_access_policy_name = kwargs.get('shared_access_policy_name', None) + self.provisioning_state = None + + class IpFirewallRuleInfo(ProxyResource): """IP firewall rule. @@ -2803,42 +3931,333 @@ class Key(ProxyResource): } _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'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'is_active_cmk': {'key': 'properties.isActiveCMK', 'type': 'bool'}, + 'key_vault_url': {'key': 'properties.keyVaultUrl', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Key, self).__init__(**kwargs) + self.is_active_cmk = kwargs.get('is_active_cmk', None) + self.key_vault_url = kwargs.get('key_vault_url', None) + + +class KeyInfoListResult(msrest.serialization.Model): + """List of keys. + + :param next_link: Link to the next page of results. + :type next_link: str + :param value: List of keys. + :type value: list[~azure.mgmt.synapse.models.Key] + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[Key]'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyInfoListResult, self).__init__(**kwargs) + self.next_link = kwargs.get('next_link', None) + self.value = kwargs.get('value', None) + + +class KustoPool(TrackedResource): + """Class representing a Kusto kusto pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :param sku: Required. The SKU of the kusto pool. + :type sku: ~azure.mgmt.synapse.models.AzureSku + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.synapse.models.SystemData + :ivar state: The state of the resource. Possible values include: "Creating", "Unavailable", + "Running", "Deleting", "Deleted", "Stopping", "Stopped", "Starting", "Updating". + :vartype state: str or ~azure.mgmt.synapse.models.State + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState + :ivar uri: The Kusto Pool URI. + :vartype uri: str + :ivar data_ingestion_uri: The Kusto Pool data ingestion URI. + :vartype data_ingestion_uri: str + :ivar state_reason: The reason for the Kusto Pool's current state. + :vartype state_reason: str + :param optimized_autoscale: Optimized auto scale definition. + :type optimized_autoscale: ~azure.mgmt.synapse.models.OptimizedAutoscale + :param enable_streaming_ingest: A boolean value that indicates if the streaming ingest is + enabled. + :type enable_streaming_ingest: bool + :param enable_purge: A boolean value that indicates if the purge operations are enabled. + :type enable_purge: bool + :ivar language_extensions: List of the Kusto Pool's language extensions. + :vartype language_extensions: ~azure.mgmt.synapse.models.LanguageExtensionsList + :param workspace_uid: The workspace unique identifier. + :type workspace_uid: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'sku': {'required': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'state': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'uri': {'readonly': True}, + 'data_ingestion_uri': {'readonly': True}, + 'state_reason': {'readonly': True}, + 'language_extensions': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'AzureSku'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'uri': {'key': 'properties.uri', 'type': 'str'}, + 'data_ingestion_uri': {'key': 'properties.dataIngestionUri', 'type': 'str'}, + 'state_reason': {'key': 'properties.stateReason', 'type': 'str'}, + 'optimized_autoscale': {'key': 'properties.optimizedAutoscale', 'type': 'OptimizedAutoscale'}, + 'enable_streaming_ingest': {'key': 'properties.enableStreamingIngest', 'type': 'bool'}, + 'enable_purge': {'key': 'properties.enablePurge', 'type': 'bool'}, + 'language_extensions': {'key': 'properties.languageExtensions', 'type': 'LanguageExtensionsList'}, + 'workspace_uid': {'key': 'properties.workspaceUID', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(KustoPool, self).__init__(**kwargs) + self.sku = kwargs['sku'] + self.etag = None + self.system_data = None + self.state = None + self.provisioning_state = None + self.uri = None + self.data_ingestion_uri = None + self.state_reason = None + self.optimized_autoscale = kwargs.get('optimized_autoscale', None) + self.enable_streaming_ingest = kwargs.get('enable_streaming_ingest', False) + self.enable_purge = kwargs.get('enable_purge', False) + self.language_extensions = None + self.workspace_uid = kwargs.get('workspace_uid', None) + + +class KustoPoolCheckNameRequest(msrest.serialization.Model): + """The object sent for a kusto pool check name availability request. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Kusto Pool name. + :type name: str + :ivar type: The type of resource, Microsoft.Synapse/workspaces/kustoPools. Has constant value: + "Microsoft.Synapse/workspaces/kustoPools". + :vartype type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + type = "Microsoft.Synapse/workspaces/kustoPools" + + def __init__( + self, + **kwargs + ): + super(KustoPoolCheckNameRequest, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class KustoPoolListResult(msrest.serialization.Model): + """The list Kusto pools operation response. + + :param value: The list of Kusto pools. + :type value: list[~azure.mgmt.synapse.models.KustoPool] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[KustoPool]'}, + } + + def __init__( + self, + **kwargs + ): + super(KustoPoolListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class KustoPoolUpdate(Resource): + """Class representing an update to a Kusto kusto pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: The SKU of the kusto pool. + :type sku: ~azure.mgmt.synapse.models.AzureSku + :ivar state: The state of the resource. Possible values include: "Creating", "Unavailable", + "Running", "Deleting", "Deleted", "Stopping", "Stopped", "Starting", "Updating". + :vartype state: str or ~azure.mgmt.synapse.models.State + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState + :ivar uri: The Kusto Pool URI. + :vartype uri: str + :ivar data_ingestion_uri: The Kusto Pool data ingestion URI. + :vartype data_ingestion_uri: str + :ivar state_reason: The reason for the Kusto Pool's current state. + :vartype state_reason: str + :param optimized_autoscale: Optimized auto scale definition. + :type optimized_autoscale: ~azure.mgmt.synapse.models.OptimizedAutoscale + :param enable_streaming_ingest: A boolean value that indicates if the streaming ingest is + enabled. + :type enable_streaming_ingest: bool + :param enable_purge: A boolean value that indicates if the purge operations are enabled. + :type enable_purge: bool + :ivar language_extensions: List of the Kusto Pool's language extensions. + :vartype language_extensions: ~azure.mgmt.synapse.models.LanguageExtensionsList + :param workspace_uid: The workspace unique identifier. + :type workspace_uid: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'state': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'uri': {'readonly': True}, + 'data_ingestion_uri': {'readonly': True}, + 'state_reason': {'readonly': True}, + 'language_extensions': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'AzureSku'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'uri': {'key': 'properties.uri', 'type': 'str'}, + 'data_ingestion_uri': {'key': 'properties.dataIngestionUri', 'type': 'str'}, + 'state_reason': {'key': 'properties.stateReason', 'type': 'str'}, + 'optimized_autoscale': {'key': 'properties.optimizedAutoscale', 'type': 'OptimizedAutoscale'}, + 'enable_streaming_ingest': {'key': 'properties.enableStreamingIngest', 'type': 'bool'}, + 'enable_purge': {'key': 'properties.enablePurge', 'type': 'bool'}, + 'language_extensions': {'key': 'properties.languageExtensions', 'type': 'LanguageExtensionsList'}, + 'workspace_uid': {'key': 'properties.workspaceUID', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(KustoPoolUpdate, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.sku = kwargs.get('sku', None) + self.state = None + self.provisioning_state = None + self.uri = None + self.data_ingestion_uri = None + self.state_reason = None + self.optimized_autoscale = kwargs.get('optimized_autoscale', None) + self.enable_streaming_ingest = kwargs.get('enable_streaming_ingest', False) + self.enable_purge = kwargs.get('enable_purge', False) + self.language_extensions = None + self.workspace_uid = kwargs.get('workspace_uid', None) + + +class LanguageExtension(msrest.serialization.Model): + """The language extension object. + + :param language_extension_name: The language extension name. Possible values include: "PYTHON", + "R". + :type language_extension_name: str or ~azure.mgmt.synapse.models.LanguageExtensionName + """ + + _attribute_map = { + 'language_extension_name': {'key': 'languageExtensionName', 'type': 'str'}, } def __init__( self, **kwargs ): - super(Key, self).__init__(**kwargs) - self.is_active_cmk = kwargs.get('is_active_cmk', None) - self.key_vault_url = kwargs.get('key_vault_url', None) + super(LanguageExtension, self).__init__(**kwargs) + self.language_extension_name = kwargs.get('language_extension_name', None) -class KeyInfoListResult(msrest.serialization.Model): - """List of keys. +class LanguageExtensionsList(msrest.serialization.Model): + """The list of language extension objects. - :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] + :param value: The list of language extensions. + :type value: list[~azure.mgmt.synapse.models.LanguageExtension] """ _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'value': {'key': 'value', 'type': '[Key]'}, + 'value': {'key': 'value', 'type': '[LanguageExtension]'}, } def __init__( self, **kwargs ): - super(KeyInfoListResult, self).__init__(**kwargs) - self.next_link = kwargs.get('next_link', None) + super(LanguageExtensionsList, self).__init__(**kwargs) self.value = kwargs.get('value', None) @@ -3164,6 +4583,25 @@ def __init__( self.resource_id = kwargs['resource_id'] +class ListResourceSkusResult(msrest.serialization.Model): + """List of available SKUs for a Kusto Pool. + + :param value: The collection of available SKUs for an existing resource. + :type value: list[~azure.mgmt.synapse.models.AzureResourceSku] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AzureResourceSku]'}, + } + + def __init__( + self, + **kwargs + ): + super(ListResourceSkusResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + class ListSqlPoolSecurityAlertPolicies(msrest.serialization.Model): """A list of SQL pool security alert policies. @@ -3756,6 +5194,97 @@ def __init__( self.sync_interval_in_minutes = kwargs.get('sync_interval_in_minutes', None) +class Operation(msrest.serialization.Model): + """A REST API operation. + + :param name: This is of the format {provider}/{resource}/{operation}. + :type name: str + :param display: The object that describes the operation. + :type display: ~azure.mgmt.synapse.models.OperationDisplay + :param origin: The intended executor of the operation. + :type origin: str + :param properties: Any object. + :type properties: any + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + self.origin = kwargs.get('origin', None) + self.properties = kwargs.get('properties', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that describes the operation. + + :param provider: Friendly name of the resource provider. + :type provider: str + :param operation: For example: read, write, delete. + :type operation: str + :param resource: The resource type on which the operation is performed. + :type resource: str + :param description: The friendly name of the operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.operation = kwargs.get('operation', None) + self.resource = kwargs.get('resource', None) + self.description = kwargs.get('description', None) + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of operations supported by the resource provider. + :type value: list[~azure.mgmt.synapse.models.Operation] + :ivar next_link: The URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + class OperationMetaLogSpecification(msrest.serialization.Model): """What is this?. @@ -3941,6 +5470,47 @@ def __init__( self.percent_complete = kwargs.get('percent_complete', None) +class OptimizedAutoscale(msrest.serialization.Model): + """A class that contains the optimized auto scale definition. + + All required parameters must be populated in order to send to Azure. + + :param version: Required. The version of the template defined, for instance 1. + :type version: int + :param is_enabled: Required. A boolean value that indicate if the optimized autoscale feature + is enabled or not. + :type is_enabled: bool + :param minimum: Required. Minimum allowed instances count. + :type minimum: int + :param maximum: Required. Maximum allowed instances count. + :type maximum: int + """ + + _validation = { + 'version': {'required': True}, + 'is_enabled': {'required': True}, + 'minimum': {'required': True}, + 'maximum': {'required': True}, + } + + _attribute_map = { + 'version': {'key': 'version', 'type': 'int'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + 'minimum': {'key': 'minimum', 'type': 'int'}, + 'maximum': {'key': 'maximum', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(OptimizedAutoscale, self).__init__(**kwargs) + self.version = kwargs['version'] + self.is_enabled = kwargs['is_enabled'] + self.minimum = kwargs['minimum'] + self.maximum = kwargs['maximum'] + + class PrivateEndpoint(msrest.serialization.Model): """Private endpoint details. @@ -4552,6 +6122,82 @@ def __init__( self.intervals = None +class ReadWriteDatabase(Database): + """Class representing a read write database. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the database.Constant filled by server. Possible values + include: "ReadWrite", "ReadOnlyFollowing". + :type kind: str or ~azure.mgmt.synapse.models.Kind + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.synapse.models.SystemData + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState + :param soft_delete_period: The time the data should be kept before it stops being accessible to + queries in TimeSpan. + :type soft_delete_period: ~datetime.timedelta + :param hot_cache_period: The time the data should be kept in cache for fast queries in + TimeSpan. + :type hot_cache_period: ~datetime.timedelta + :ivar statistics: The statistics of the database. + :vartype statistics: ~azure.mgmt.synapse.models.DatabaseStatistics + :ivar is_followed: Indicates whether the database is followed. + :vartype is_followed: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'statistics': {'readonly': True}, + 'is_followed': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'soft_delete_period': {'key': 'properties.softDeletePeriod', 'type': 'duration'}, + 'hot_cache_period': {'key': 'properties.hotCachePeriod', 'type': 'duration'}, + 'statistics': {'key': 'properties.statistics', 'type': 'DatabaseStatistics'}, + 'is_followed': {'key': 'properties.isFollowed', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(ReadWriteDatabase, self).__init__(**kwargs) + self.kind = 'ReadWrite' # type: str + self.provisioning_state = None + self.soft_delete_period = kwargs.get('soft_delete_period', None) + self.hot_cache_period = kwargs.get('hot_cache_period', None) + self.statistics = None + self.is_followed = None + + class RecommendedSensitivityLabelUpdate(ProxyResource): """A recommended sensitivity label update operation. @@ -6128,6 +7774,110 @@ def __init__( self.capacity = kwargs.get('capacity', None) +class SkuDescription(msrest.serialization.Model): + """The Kusto SKU description of given resource type. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar resource_type: The resource type. + :vartype resource_type: str + :ivar name: The name of the SKU. + :vartype name: str + :ivar size: The size of the SKU. + :vartype size: str + :ivar locations: The set of locations that the SKU is available. + :vartype locations: list[str] + :ivar location_info: Locations and zones. + :vartype location_info: list[~azure.mgmt.synapse.models.SkuLocationInfoItem] + :ivar restrictions: The restrictions because of which SKU cannot be used. + :vartype restrictions: list[any] + """ + + _validation = { + 'resource_type': {'readonly': True}, + 'name': {'readonly': True}, + 'size': {'readonly': True}, + 'locations': {'readonly': True}, + 'location_info': {'readonly': True}, + 'restrictions': {'readonly': True}, + } + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + 'location_info': {'key': 'locationInfo', 'type': '[SkuLocationInfoItem]'}, + 'restrictions': {'key': 'restrictions', 'type': '[object]'}, + } + + def __init__( + self, + **kwargs + ): + super(SkuDescription, self).__init__(**kwargs) + self.resource_type = None + self.name = None + self.size = None + self.locations = None + self.location_info = None + self.restrictions = None + + +class SkuDescriptionList(msrest.serialization.Model): + """The list of the SKU descriptions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: SKU descriptions. + :vartype value: list[~azure.mgmt.synapse.models.SkuDescription] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SkuDescription]'}, + } + + def __init__( + self, + **kwargs + ): + super(SkuDescriptionList, self).__init__(**kwargs) + self.value = None + + +class SkuLocationInfoItem(msrest.serialization.Model): + """The locations and zones info for SKU. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The available location of the SKU. + :type location: str + :param zones: The available zone of the SKU. + :type zones: list[str] + """ + + _validation = { + 'location': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(SkuLocationInfoItem, self).__init__(**kwargs) + self.location = kwargs['location'] + self.zones = kwargs.get('zones', None) + + class SparkConfigProperties(msrest.serialization.Model): """SparkConfig Properties for a Big Data pool powered by Apache Spark. @@ -6295,8 +8045,22 @@ class SqlPool(TrackedResource): :type status: str :param restore_point_in_time: Snapshot time to restore. :type restore_point_in_time: ~datetime.datetime - :param create_mode: What is this?. - :type create_mode: str + :param create_mode: Specifies the mode of sql pool creation. + + Default: regular sql pool creation. + + PointInTimeRestore: Creates a sql pool by restoring a point in time backup of an existing sql + pool. sourceDatabaseId must be specified as the resource ID of the existing sql pool, and + restorePointInTime must be specified. + + Recovery: Creates a sql pool by a geo-replicated backup. sourceDatabaseId must be specified + as the recoverableDatabaseId to restore. + + Restore: Creates a sql pool by restoring a backup of a deleted sql pool. SourceDatabaseId + should be the sql pool's original resource ID. SourceDatabaseId and sourceDatabaseDeletionDate + must be specified. Possible values include: "Default", "PointInTimeRestore", "Recovery", + "Restore". + :type create_mode: str or ~azure.mgmt.synapse.models.CreateMode :param creation_date: Date the SQL pool was created. :type creation_date: ~datetime.datetime :param storage_account_type: The storage account type used to store backups for this sql pool. @@ -6871,8 +8635,22 @@ class SqlPoolPatchInfo(msrest.serialization.Model): :type status: str :param restore_point_in_time: Snapshot time to restore. :type restore_point_in_time: ~datetime.datetime - :param create_mode: What is this?. - :type create_mode: str + :param create_mode: Specifies the mode of sql pool creation. + + Default: regular sql pool creation. + + PointInTimeRestore: Creates a sql pool by restoring a point in time backup of an existing sql + pool. sourceDatabaseId must be specified as the resource ID of the existing sql pool, and + restorePointInTime must be specified. + + Recovery: Creates a sql pool by a geo-replicated backup. sourceDatabaseId must be specified + as the recoverableDatabaseId to restore. + + Restore: Creates a sql pool by restoring a backup of a deleted sql pool. SourceDatabaseId + should be the sql pool's original resource ID. SourceDatabaseId and sourceDatabaseDeletionDate + must be specified. Possible values include: "Default", "PointInTimeRestore", "Recovery", + "Restore". + :type create_mode: str or ~azure.mgmt.synapse.models.CreateMode :param creation_date: Date the SQL pool was created. :type creation_date: ~datetime.datetime :param storage_account_type: The storage account type used to store backups for this sql pool. @@ -7815,6 +9593,88 @@ def __init__( self.sensitive_value = kwargs.get('sensitive_value', None) +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.synapse.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.synapse.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + +class TableLevelSharingProperties(msrest.serialization.Model): + """Tables that will be included and excluded in the follower database. + + :param tables_to_include: List of tables to include in the follower database. + :type tables_to_include: list[str] + :param tables_to_exclude: List of tables to exclude from the follower database. + :type tables_to_exclude: list[str] + :param external_tables_to_include: List of external tables to include in the follower database. + :type external_tables_to_include: list[str] + :param external_tables_to_exclude: List of external tables exclude from the follower database. + :type external_tables_to_exclude: list[str] + :param materialized_views_to_include: List of materialized views to include in the follower + database. + :type materialized_views_to_include: list[str] + :param materialized_views_to_exclude: List of materialized views exclude from the follower + database. + :type materialized_views_to_exclude: list[str] + """ + + _attribute_map = { + 'tables_to_include': {'key': 'tablesToInclude', 'type': '[str]'}, + 'tables_to_exclude': {'key': 'tablesToExclude', 'type': '[str]'}, + 'external_tables_to_include': {'key': 'externalTablesToInclude', 'type': '[str]'}, + 'external_tables_to_exclude': {'key': 'externalTablesToExclude', 'type': '[str]'}, + 'materialized_views_to_include': {'key': 'materializedViewsToInclude', 'type': '[str]'}, + 'materialized_views_to_exclude': {'key': 'materializedViewsToExclude', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(TableLevelSharingProperties, self).__init__(**kwargs) + self.tables_to_include = kwargs.get('tables_to_include', None) + self.tables_to_exclude = kwargs.get('tables_to_exclude', None) + self.external_tables_to_include = kwargs.get('external_tables_to_include', None) + self.external_tables_to_exclude = kwargs.get('external_tables_to_exclude', None) + self.materialized_views_to_include = kwargs.get('materialized_views_to_include', None) + self.materialized_views_to_exclude = kwargs.get('materialized_views_to_exclude', None) + + class TopQueries(msrest.serialization.Model): """A database query. 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 27978d1532047..881fe94691084 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 @@ -15,6 +15,180 @@ from ._synapse_management_client_enums import * +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + + +class AttachedDatabaseConfiguration(ProxyResource): + """Class representing an attached database configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param location: Resource location. + :type location: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.synapse.models.SystemData + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState + :param database_name: The name of the database which you would like to attach, use * if you + want to follow all current and future databases. + :type database_name: str + :param kusto_pool_resource_id: The resource id of the kusto pool where the databases you would + like to attach reside. + :type kusto_pool_resource_id: str + :ivar attached_database_names: The list of databases from the clusterResourceId which are + currently attached to the kusto pool. + :vartype attached_database_names: list[str] + :param default_principals_modification_kind: The default principals modification kind. Possible + values include: "Union", "Replace", "None". + :type default_principals_modification_kind: str or + ~azure.mgmt.synapse.models.DefaultPrincipalsModificationKind + :param table_level_sharing_properties: Table level sharing specifications. + :type table_level_sharing_properties: ~azure.mgmt.synapse.models.TableLevelSharingProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'attached_database_names': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'database_name': {'key': 'properties.databaseName', 'type': 'str'}, + 'kusto_pool_resource_id': {'key': 'properties.clusterResourceId', 'type': 'str'}, + 'attached_database_names': {'key': 'properties.attachedDatabaseNames', 'type': '[str]'}, + 'default_principals_modification_kind': {'key': 'properties.defaultPrincipalsModificationKind', 'type': 'str'}, + 'table_level_sharing_properties': {'key': 'properties.tableLevelSharingProperties', 'type': 'TableLevelSharingProperties'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + database_name: Optional[str] = None, + kusto_pool_resource_id: Optional[str] = None, + default_principals_modification_kind: Optional[Union[str, "DefaultPrincipalsModificationKind"]] = None, + table_level_sharing_properties: Optional["TableLevelSharingProperties"] = None, + **kwargs + ): + super(AttachedDatabaseConfiguration, self).__init__(**kwargs) + self.location = location + self.system_data = None + self.provisioning_state = None + self.database_name = database_name + self.kusto_pool_resource_id = kusto_pool_resource_id + self.attached_database_names = None + self.default_principals_modification_kind = default_principals_modification_kind + self.table_level_sharing_properties = table_level_sharing_properties + + +class AttachedDatabaseConfigurationListResult(msrest.serialization.Model): + """The list attached database configurations operation response. + + :param value: The list of attached database configurations. + :type value: list[~azure.mgmt.synapse.models.AttachedDatabaseConfiguration] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AttachedDatabaseConfiguration]'}, + } + + def __init__( + self, + *, + value: Optional[List["AttachedDatabaseConfiguration"]] = None, + **kwargs + ): + super(AttachedDatabaseConfigurationListResult, self).__init__(**kwargs) + self.value = value + + class AutoPauseProperties(msrest.serialization.Model): """Auto-pausing properties of a Big Data pool powered by Apache Spark. @@ -150,77 +324,6 @@ def __init__( self.operation = operation -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - class AzureADOnlyAuthentication(ProxyResource): """Azure Active Directory Only Authentication Info. @@ -302,6 +405,52 @@ def __init__( self.next_link = None +class AzureCapacity(msrest.serialization.Model): + """Azure capacity definition. + + All required parameters must be populated in order to send to Azure. + + :param scale_type: Required. Scale type. Possible values include: "automatic", "manual", + "none". + :type scale_type: str or ~azure.mgmt.synapse.models.AzureScaleType + :param minimum: Required. Minimum allowed capacity. + :type minimum: int + :param maximum: Required. Maximum allowed capacity. + :type maximum: int + :param default: Required. The default capacity that would be used. + :type default: int + """ + + _validation = { + 'scale_type': {'required': True}, + 'minimum': {'required': True}, + 'maximum': {'required': True}, + 'default': {'required': True}, + } + + _attribute_map = { + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + 'minimum': {'key': 'minimum', 'type': 'int'}, + 'maximum': {'key': 'maximum', 'type': 'int'}, + 'default': {'key': 'default', 'type': 'int'}, + } + + def __init__( + self, + *, + scale_type: Union[str, "AzureScaleType"], + minimum: int, + maximum: int, + default: int, + **kwargs + ): + super(AzureCapacity, self).__init__(**kwargs) + self.scale_type = scale_type + self.minimum = minimum + self.maximum = maximum + self.default = default + + class AzureEntityResource(Resource): """The resource model definition for an Azure Resource Manager resource with an etag. @@ -341,6 +490,77 @@ def __init__( self.etag = None +class AzureResourceSku(msrest.serialization.Model): + """Azure resource SKU definition. + + :param resource_type: Resource Namespace and Type. + :type resource_type: str + :param sku: The SKU details. + :type sku: ~azure.mgmt.synapse.models.AzureSku + :param capacity: The number of instances of the cluster. + :type capacity: ~azure.mgmt.synapse.models.AzureCapacity + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'AzureSku'}, + 'capacity': {'key': 'capacity', 'type': 'AzureCapacity'}, + } + + def __init__( + self, + *, + resource_type: Optional[str] = None, + sku: Optional["AzureSku"] = None, + capacity: Optional["AzureCapacity"] = None, + **kwargs + ): + super(AzureResourceSku, self).__init__(**kwargs) + self.resource_type = resource_type + self.sku = sku + self.capacity = capacity + + +class AzureSku(msrest.serialization.Model): + """Azure SKU definition. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. SKU name. Possible values include: "Compute optimized", "Storage + optimized". + :type name: str or ~azure.mgmt.synapse.models.SkuName + :param capacity: The number of instances of the cluster. + :type capacity: int + :param size: Required. SKU size. Possible values include: "Extra small", "Small", "Medium", + "Large". + :type size: str or ~azure.mgmt.synapse.models.SkuSize + """ + + _validation = { + 'name': {'required': True}, + 'size': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + 'size': {'key': 'size', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Union[str, "SkuName"], + size: Union[str, "SkuSize"], + capacity: Optional[int] = None, + **kwargs + ): + super(AzureSku, self).__init__(**kwargs) + self.name = name + self.capacity = capacity + self.size = size + + class BigDataPoolPatchInfo(msrest.serialization.Model): """Properties patch for a Big Data pool. @@ -636,201 +856,838 @@ def __init__( self.name = name -class CustomSetupBase(msrest.serialization.Model): - """The base definition of the custom setup. +class CheckNameResult(msrest.serialization.Model): + """The result returned from a check name availability request. + + :param name_available: Specifies a Boolean value that indicates if the name is available. + :type name_available: bool + :param name: The name that was checked. + :type name: str + :param message: Message indicating an unavailable name due to a conflict, or a description of + the naming rules that are violated. + :type message: str + :param reason: Message providing the reason why the given name is invalid. Possible values + include: "Invalid", "AlreadyExists". + :type reason: str or ~azure.mgmt.synapse.models.Reason + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, + } + + def __init__( + self, + *, + name_available: Optional[bool] = None, + name: Optional[str] = None, + message: Optional[str] = None, + reason: Optional[Union[str, "Reason"]] = None, + **kwargs + ): + super(CheckNameResult, self).__init__(**kwargs) + self.name_available = name_available + self.name = name + self.message = message + self.reason = reason + + +class ClusterPrincipalAssignment(ProxyResource): + """Class representing a cluster principal assignment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.synapse.models.SystemData + :param principal_id: The principal ID assigned to the cluster principal. It can be a user + email, application ID, or security group name. + :type principal_id: str + :param role: Cluster principal role. Possible values include: "AllDatabasesAdmin", + "AllDatabasesViewer". + :type role: str or ~azure.mgmt.synapse.models.ClusterPrincipalRole + :param tenant_id: The tenant id of the principal. + :type tenant_id: str + :param principal_type: Principal type. Possible values include: "App", "Group", "User". + :type principal_type: str or ~azure.mgmt.synapse.models.PrincipalType + :ivar tenant_name: The tenant name of the principal. + :vartype tenant_name: str + :ivar principal_name: The principal name. + :vartype principal_name: str + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'tenant_name': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'role': {'key': 'properties.role', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'principal_type': {'key': 'properties.principalType', 'type': 'str'}, + 'tenant_name': {'key': 'properties.tenantName', 'type': 'str'}, + 'principal_name': {'key': 'properties.principalName', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + principal_id: Optional[str] = None, + role: Optional[Union[str, "ClusterPrincipalRole"]] = None, + tenant_id: Optional[str] = None, + principal_type: Optional[Union[str, "PrincipalType"]] = None, + **kwargs + ): + super(ClusterPrincipalAssignment, self).__init__(**kwargs) + self.system_data = None + self.principal_id = principal_id + self.role = role + self.tenant_id = tenant_id + self.principal_type = principal_type + self.tenant_name = None + self.principal_name = None + self.provisioning_state = None + + +class ClusterPrincipalAssignmentCheckNameRequest(msrest.serialization.Model): + """A principal assignment check name availability request. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Principal Assignment resource name. + :type name: str + :ivar type: The type of resource, Microsoft.Synapse/workspaces/kustoPools/principalAssignments. + Has constant value: "Microsoft.Synapse/workspaces/kustoPools/principalAssignments". + :vartype type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + type = "Microsoft.Synapse/workspaces/kustoPools/principalAssignments" + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(ClusterPrincipalAssignmentCheckNameRequest, self).__init__(**kwargs) + self.name = name + + +class ClusterPrincipalAssignmentListResult(msrest.serialization.Model): + """The list Kusto cluster principal assignments operation response. + + :param value: The list of Kusto cluster principal assignments. + :type value: list[~azure.mgmt.synapse.models.ClusterPrincipalAssignment] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ClusterPrincipalAssignment]'}, + } + + def __init__( + self, + *, + value: Optional[List["ClusterPrincipalAssignment"]] = None, + **kwargs + ): + super(ClusterPrincipalAssignmentListResult, self).__init__(**kwargs) + self.value = value + + +class CustomSetupBase(msrest.serialization.Model): + """The base definition of the custom setup. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: CmdkeySetup, ComponentSetup, EnvironmentVariableSetup. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of custom setup.Constant filled by server. + :type type: str + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'CmdkeySetup': 'CmdkeySetup', 'ComponentSetup': 'ComponentSetup', 'EnvironmentVariableSetup': 'EnvironmentVariableSetup'} + } + + def __init__( + self, + **kwargs + ): + super(CustomSetupBase, self).__init__(**kwargs) + self.type = None # type: Optional[str] + + +class CmdkeySetup(CustomSetupBase): + """The custom setup of running cmdkey commands. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of custom setup.Constant filled by server. + :type type: str + :param target_name: Required. The server name of data source access. + :type target_name: any + :param user_name: Required. The user name of data source access. + :type user_name: any + :param password: Required. The password of data source access. + :type password: ~azure.mgmt.synapse.models.SecretBase + """ + + _validation = { + 'type': {'required': True}, + 'target_name': {'required': True}, + 'user_name': {'required': True}, + 'password': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'target_name': {'key': 'typeProperties.targetName', 'type': 'object'}, + 'user_name': {'key': 'typeProperties.userName', 'type': 'object'}, + 'password': {'key': 'typeProperties.password', 'type': 'SecretBase'}, + } + + def __init__( + self, + *, + target_name: Any, + user_name: Any, + 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 + + +class ComponentSetup(CustomSetupBase): + """The custom setup of installing 3rd party components. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of custom setup.Constant filled by server. + :type type: str + :param component_name: Required. The name of the 3rd party component. + :type component_name: str + :param license_key: The license key to activate the component. + :type license_key: ~azure.mgmt.synapse.models.SecretBase + """ + + _validation = { + 'type': {'required': True}, + 'component_name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'component_name': {'key': 'typeProperties.componentName', 'type': 'str'}, + 'license_key': {'key': 'typeProperties.licenseKey', 'type': 'SecretBase'}, + } + + def __init__( + self, + *, + 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 + + +class CreateSqlPoolRestorePointDefinition(msrest.serialization.Model): + """Contains the information necessary to perform a create Sql pool restore point operation. + + All required parameters must be populated in order to send to Azure. + + :param restore_point_label: Required. The restore point label to apply. + :type restore_point_label: str + """ + + _validation = { + 'restore_point_label': {'required': True}, + } + + _attribute_map = { + 'restore_point_label': {'key': 'restorePointLabel', 'type': 'str'}, + } + + def __init__( + self, + *, + restore_point_label: str, + **kwargs + ): + super(CreateSqlPoolRestorePointDefinition, self).__init__(**kwargs) + self.restore_point_label = restore_point_label + + +class CspWorkspaceAdminProperties(msrest.serialization.Model): + """Initial workspace AAD admin properties for a CSP subscription. + + :param initial_workspace_admin_object_id: AAD object ID of initial workspace admin. + :type initial_workspace_admin_object_id: str + """ + + _attribute_map = { + 'initial_workspace_admin_object_id': {'key': 'initialWorkspaceAdminObjectId', 'type': 'str'}, + } + + def __init__( + self, + *, + initial_workspace_admin_object_id: Optional[str] = None, + **kwargs + ): + super(CspWorkspaceAdminProperties, self).__init__(**kwargs) + self.initial_workspace_admin_object_id = initial_workspace_admin_object_id + + +class CustomerManagedKeyDetails(msrest.serialization.Model): + """Details of the customer managed key associated with the workspace. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: The customer managed key status on the workspace. + :vartype status: str + :param key: The key object of the workspace. + :type key: ~azure.mgmt.synapse.models.WorkspaceKeyDetails + :param kek_identity: Key encryption key. + :type kek_identity: ~azure.mgmt.synapse.models.KekIdentityProperties + """ + + _validation = { + 'status': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'key': {'key': 'key', 'type': 'WorkspaceKeyDetails'}, + 'kek_identity': {'key': 'kekIdentity', 'type': 'KekIdentityProperties'}, + } + + def __init__( + self, + *, + key: Optional["WorkspaceKeyDetails"] = None, + kek_identity: Optional["KekIdentityProperties"] = None, + **kwargs + ): + super(CustomerManagedKeyDetails, self).__init__(**kwargs) + self.status = None + self.key = key + self.kek_identity = kek_identity + + +class Database(ProxyResource): + """Class representing a Kusto database. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ReadWriteDatabase. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the database.Constant filled by server. Possible values + include: "ReadWrite", "ReadOnlyFollowing". + :type kind: str or ~azure.mgmt.synapse.models.Kind + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.synapse.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + _subtype_map = { + 'kind': {'ReadWrite': 'ReadWriteDatabase'} + } + + def __init__( + self, + *, + location: Optional[str] = None, + **kwargs + ): + super(Database, self).__init__(**kwargs) + self.location = location + self.kind = 'Database' # type: str + self.system_data = None + + +class DatabaseCheckNameRequest(msrest.serialization.Model): + """The result returned from a database check name availability request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Resource name. + :type name: str + :param type: Required. The type of resource, for instance + Microsoft.Synapse/workspaces/kustoPools/databases. Possible values include: + "Microsoft.Synapse/workspaces/kustoPools/databases", + "Microsoft.Synapse/workspaces/kustoPools/attachedDatabaseConfigurations". + :type type: str or ~azure.mgmt.synapse.models.Type + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + type: Union[str, "Type"], + **kwargs + ): + super(DatabaseCheckNameRequest, self).__init__(**kwargs) + self.name = name + self.type = type + + +class DatabaseListResult(msrest.serialization.Model): + """The list Kusto databases operation response. + + :param value: The list of Kusto databases. + :type value: list[~azure.mgmt.synapse.models.Database] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Database]'}, + } + + def __init__( + self, + *, + value: Optional[List["Database"]] = None, + **kwargs + ): + super(DatabaseListResult, self).__init__(**kwargs) + self.value = value + + +class DatabasePrincipalAssignment(ProxyResource): + """Class representing a database principal assignment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.synapse.models.SystemData + :param principal_id: The principal ID assigned to the database principal. It can be a user + email, application ID, or security group name. + :type principal_id: str + :param role: Database principal role. Possible values include: "Admin", "Ingestor", "Monitor", + "User", "UnrestrictedViewer", "Viewer". + :type role: str or ~azure.mgmt.synapse.models.DatabasePrincipalRole + :param tenant_id: The tenant id of the principal. + :type tenant_id: str + :param principal_type: Principal type. Possible values include: "App", "Group", "User". + :type principal_type: str or ~azure.mgmt.synapse.models.PrincipalType + :ivar tenant_name: The tenant name of the principal. + :vartype tenant_name: str + :ivar principal_name: The principal name. + :vartype principal_name: str + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'tenant_name': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'role': {'key': 'properties.role', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'principal_type': {'key': 'properties.principalType', 'type': 'str'}, + 'tenant_name': {'key': 'properties.tenantName', 'type': 'str'}, + 'principal_name': {'key': 'properties.principalName', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + principal_id: Optional[str] = None, + role: Optional[Union[str, "DatabasePrincipalRole"]] = None, + tenant_id: Optional[str] = None, + principal_type: Optional[Union[str, "PrincipalType"]] = None, + **kwargs + ): + super(DatabasePrincipalAssignment, self).__init__(**kwargs) + self.system_data = None + self.principal_id = principal_id + self.role = role + self.tenant_id = tenant_id + self.principal_type = principal_type + self.tenant_name = None + self.principal_name = None + self.provisioning_state = None + + +class DatabasePrincipalAssignmentCheckNameRequest(msrest.serialization.Model): + """A principal assignment check name availability request. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Principal Assignment resource name. + :type name: str + :ivar type: The type of resource, + Microsoft.Synapse/workspaces/kustoPools/databases/principalAssignments. Has constant value: + "Microsoft.Synapse/workspaces/kustoPools/databases/principalAssignments". + :vartype type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + type = "Microsoft.Synapse/workspaces/kustoPools/databases/principalAssignments" + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(DatabasePrincipalAssignmentCheckNameRequest, self).__init__(**kwargs) + self.name = name + + +class DatabasePrincipalAssignmentListResult(msrest.serialization.Model): + """The list Kusto database principal assignments operation response. + + :param value: The list of Kusto database principal assignments. + :type value: list[~azure.mgmt.synapse.models.DatabasePrincipalAssignment] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DatabasePrincipalAssignment]'}, + } + + def __init__( + self, + *, + value: Optional[List["DatabasePrincipalAssignment"]] = None, + **kwargs + ): + super(DatabasePrincipalAssignmentListResult, self).__init__(**kwargs) + self.value = value + + +class DatabaseStatistics(msrest.serialization.Model): + """A class that contains database statistics information. + + :param size: The database size - the total size of compressed data and index in bytes. + :type size: float + """ + + _attribute_map = { + 'size': {'key': 'size', 'type': 'float'}, + } + + def __init__( + self, + *, + size: Optional[float] = None, + **kwargs + ): + super(DatabaseStatistics, self).__init__(**kwargs) + self.size = size + + +class DataConnection(ProxyResource): + """Class representing a data connection. You probably want to use the sub-classes and not this class directly. Known - sub-classes are: CmdkeySetup, ComponentSetup, EnvironmentVariableSetup. + sub-classes are: EventGridDataConnection, EventHubDataConnection, IotHubDataConnection. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :param type: Required. The type of custom setup.Constant filled by server. - :type type: 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 + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + Possible values include: "EventHub", "EventGrid", "IotHub". + :type kind: str or ~azure.mgmt.synapse.models.DataConnectionKind + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.synapse.models.SystemData """ _validation = { - 'type': {'required': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + 'system_data': {'readonly': True}, } _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, } _subtype_map = { - 'type': {'CmdkeySetup': 'CmdkeySetup', 'ComponentSetup': 'ComponentSetup', 'EnvironmentVariableSetup': 'EnvironmentVariableSetup'} + 'kind': {'EventGrid': 'EventGridDataConnection', 'EventHub': 'EventHubDataConnection', 'IotHub': 'IotHubDataConnection'} } def __init__( self, + *, + location: Optional[str] = None, **kwargs ): - super(CustomSetupBase, self).__init__(**kwargs) - self.type = None # type: Optional[str] + super(DataConnection, self).__init__(**kwargs) + self.location = location + self.kind = 'DataConnection' # type: str + self.system_data = None -class CmdkeySetup(CustomSetupBase): - """The custom setup of running cmdkey commands. +class DataConnectionCheckNameRequest(msrest.serialization.Model): + """A data connection check name availability request. + + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :param type: Required. The type of custom setup.Constant filled by server. - :type type: str - :param target_name: Required. The server name of data source access. - :type target_name: any - :param user_name: Required. The user name of data source access. - :type user_name: any - :param password: Required. The password of data source access. - :type password: ~azure.mgmt.synapse.models.SecretBase + :param name: Required. Data Connection name. + :type name: str + :ivar type: The type of resource, + Microsoft.Synapse/workspaces/kustoPools/databases/dataConnections. Has constant value: + "Microsoft.Synapse/workspaces/kustoPools/databases/dataConnections". + :vartype type: str """ _validation = { - 'type': {'required': True}, - 'target_name': {'required': True}, - 'user_name': {'required': True}, - 'password': {'required': True}, + 'name': {'required': True}, + 'type': {'required': True, 'constant': True}, } _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'target_name': {'key': 'typeProperties.targetName', 'type': 'object'}, - 'user_name': {'key': 'typeProperties.userName', 'type': 'object'}, - 'password': {'key': 'typeProperties.password', 'type': 'SecretBase'}, } + type = "Microsoft.Synapse/workspaces/kustoPools/databases/dataConnections" + def __init__( self, *, - target_name: Any, - user_name: Any, - password: "SecretBase", + name: str, **kwargs ): - super(CmdkeySetup, self).__init__(**kwargs) - self.type = 'CmdkeySetup' # type: str - self.target_name = target_name - self.user_name = user_name - self.password = password - + super(DataConnectionCheckNameRequest, self).__init__(**kwargs) + self.name = name -class ComponentSetup(CustomSetupBase): - """The custom setup of installing 3rd party components. - All required parameters must be populated in order to send to Azure. +class DataConnectionListResult(msrest.serialization.Model): + """The list Kusto data connections operation response. - :param type: Required. The type of custom setup.Constant filled by server. - :type type: str - :param component_name: Required. The name of the 3rd party component. - :type component_name: str - :param license_key: The license key to activate the component. - :type license_key: ~azure.mgmt.synapse.models.SecretBase + :param value: The list of Kusto data connections. + :type value: list[~azure.mgmt.synapse.models.DataConnection] """ - _validation = { - 'type': {'required': True}, - 'component_name': {'required': True}, - } - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'component_name': {'key': 'typeProperties.componentName', 'type': 'str'}, - 'license_key': {'key': 'typeProperties.licenseKey', 'type': 'SecretBase'}, + 'value': {'key': 'value', 'type': '[DataConnection]'}, } def __init__( self, *, - component_name: str, - license_key: Optional["SecretBase"] = None, + value: Optional[List["DataConnection"]] = None, **kwargs ): - super(ComponentSetup, self).__init__(**kwargs) - self.type = 'ComponentSetup' # type: str - self.component_name = component_name - self.license_key = license_key - + super(DataConnectionListResult, self).__init__(**kwargs) + self.value = value -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. +class DataConnectionValidation(msrest.serialization.Model): + """Class representing an data connection validation. - :param restore_point_label: Required. The restore point label to apply. - :type restore_point_label: str + :param data_connection_name: The name of the data connection. + :type data_connection_name: str + :param properties: The data connection properties to validate. + :type properties: ~azure.mgmt.synapse.models.DataConnection """ - _validation = { - 'restore_point_label': {'required': True}, - } - _attribute_map = { - 'restore_point_label': {'key': 'restorePointLabel', 'type': 'str'}, + 'data_connection_name': {'key': 'dataConnectionName', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DataConnection'}, } def __init__( self, *, - restore_point_label: str, + data_connection_name: Optional[str] = None, + properties: Optional["DataConnection"] = None, **kwargs ): - super(CreateSqlPoolRestorePointDefinition, self).__init__(**kwargs) - self.restore_point_label = restore_point_label + super(DataConnectionValidation, self).__init__(**kwargs) + self.data_connection_name = data_connection_name + self.properties = properties -class CspWorkspaceAdminProperties(msrest.serialization.Model): - """Initial workspace AAD admin properties for a CSP subscription. +class DataConnectionValidationListResult(msrest.serialization.Model): + """The list Kusto data connection validation result. - :param initial_workspace_admin_object_id: AAD object ID of initial workspace admin. - :type initial_workspace_admin_object_id: str + :param value: The list of Kusto data connection validation errors. + :type value: list[~azure.mgmt.synapse.models.DataConnectionValidationResult] """ _attribute_map = { - 'initial_workspace_admin_object_id': {'key': 'initialWorkspaceAdminObjectId', 'type': 'str'}, + 'value': {'key': 'value', 'type': '[DataConnectionValidationResult]'}, } def __init__( self, *, - initial_workspace_admin_object_id: Optional[str] = None, + value: Optional[List["DataConnectionValidationResult"]] = None, **kwargs ): - super(CspWorkspaceAdminProperties, self).__init__(**kwargs) - self.initial_workspace_admin_object_id = initial_workspace_admin_object_id - + super(DataConnectionValidationListResult, self).__init__(**kwargs) + self.value = value -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 DataConnectionValidationResult(msrest.serialization.Model): + """The result returned from a data connection validation request. - :ivar status: The customer managed key status on the workspace. - :vartype status: str - :param key: The key object of the workspace. - :type key: ~azure.mgmt.synapse.models.WorkspaceKeyDetails - :param kek_identity: Key encryption key. - :type kek_identity: ~azure.mgmt.synapse.models.KekIdentityProperties + :param error_message: A message which indicates a problem in data connection validation. + :type error_message: str """ - _validation = { - 'status': {'readonly': True}, - } - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'key': {'key': 'key', 'type': 'WorkspaceKeyDetails'}, - 'kek_identity': {'key': 'kekIdentity', 'type': 'KekIdentityProperties'}, + 'error_message': {'key': 'errorMessage', 'type': 'str'}, } def __init__( self, *, - key: Optional["WorkspaceKeyDetails"] = None, - kek_identity: Optional["KekIdentityProperties"] = None, + error_message: Optional[str] = None, **kwargs ): - super(CustomerManagedKeyDetails, self).__init__(**kwargs) - self.status = None - self.key = key - self.kek_identity = kek_identity + super(DataConnectionValidationResult, self).__init__(**kwargs) + self.error_message = error_message class DataLakeStorageAccountDetails(msrest.serialization.Model): @@ -1434,6 +2291,213 @@ def __init__( self.error = error +class EventGridDataConnection(DataConnection): + """Class representing an Event Grid data connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + Possible values include: "EventHub", "EventGrid", "IotHub". + :type kind: str or ~azure.mgmt.synapse.models.DataConnectionKind + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.synapse.models.SystemData + :param storage_account_resource_id: The resource ID of the storage account where the data + resides. + :type storage_account_resource_id: str + :param event_hub_resource_id: The resource ID where the event grid is configured to send + events. + :type event_hub_resource_id: str + :param consumer_group: The event hub consumer group. + :type consumer_group: str + :param table_name: The table where the data should be ingested. Optionally the table + information can be added to each message. + :type table_name: str + :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the + mapping information can be added to each message. + :type mapping_rule_name: str + :param data_format: The data format of the message. Optionally the data format can be added to + each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", + "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", + "W3CLOGFILE". + :type data_format: str or ~azure.mgmt.synapse.models.EventGridDataFormat + :param ignore_first_record: A Boolean value that, if set to true, indicates that ingestion + should ignore the first record of every file. + :type ignore_first_record: bool + :param blob_storage_event_type: The name of blob storage event type to process. Possible values + include: "Microsoft.Storage.BlobCreated", "Microsoft.Storage.BlobRenamed". + :type blob_storage_event_type: str or ~azure.mgmt.synapse.models.BlobStorageEventType + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'storage_account_resource_id': {'key': 'properties.storageAccountResourceId', 'type': 'str'}, + 'event_hub_resource_id': {'key': 'properties.eventHubResourceId', 'type': 'str'}, + 'consumer_group': {'key': 'properties.consumerGroup', 'type': 'str'}, + 'table_name': {'key': 'properties.tableName', 'type': 'str'}, + 'mapping_rule_name': {'key': 'properties.mappingRuleName', 'type': 'str'}, + 'data_format': {'key': 'properties.dataFormat', 'type': 'str'}, + 'ignore_first_record': {'key': 'properties.ignoreFirstRecord', 'type': 'bool'}, + 'blob_storage_event_type': {'key': 'properties.blobStorageEventType', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + storage_account_resource_id: Optional[str] = None, + event_hub_resource_id: Optional[str] = None, + consumer_group: Optional[str] = None, + table_name: Optional[str] = None, + mapping_rule_name: Optional[str] = None, + data_format: Optional[Union[str, "EventGridDataFormat"]] = None, + ignore_first_record: Optional[bool] = None, + blob_storage_event_type: Optional[Union[str, "BlobStorageEventType"]] = None, + **kwargs + ): + super(EventGridDataConnection, self).__init__(location=location, **kwargs) + self.kind = 'EventGrid' # type: str + self.storage_account_resource_id = storage_account_resource_id + self.event_hub_resource_id = event_hub_resource_id + self.consumer_group = consumer_group + self.table_name = table_name + self.mapping_rule_name = mapping_rule_name + self.data_format = data_format + self.ignore_first_record = ignore_first_record + self.blob_storage_event_type = blob_storage_event_type + self.provisioning_state = None + + +class EventHubDataConnection(DataConnection): + """Class representing an event hub data connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + Possible values include: "EventHub", "EventGrid", "IotHub". + :type kind: str or ~azure.mgmt.synapse.models.DataConnectionKind + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.synapse.models.SystemData + :param event_hub_resource_id: The resource ID of the event hub to be used to create a data + connection. + :type event_hub_resource_id: str + :param consumer_group: The event hub consumer group. + :type consumer_group: str + :param table_name: The table where the data should be ingested. Optionally the table + information can be added to each message. + :type table_name: str + :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the + mapping information can be added to each message. + :type mapping_rule_name: str + :param data_format: The data format of the message. Optionally the data format can be added to + each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", + "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", + "W3CLOGFILE". + :type data_format: str or ~azure.mgmt.synapse.models.EventHubDataFormat + :param event_system_properties: System properties of the event hub. + :type event_system_properties: list[str] + :param compression: The event hub messages compression type. Possible values include: "None", + "GZip". + :type compression: str or ~azure.mgmt.synapse.models.Compression + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'event_hub_resource_id': {'key': 'properties.eventHubResourceId', 'type': 'str'}, + 'consumer_group': {'key': 'properties.consumerGroup', 'type': 'str'}, + 'table_name': {'key': 'properties.tableName', 'type': 'str'}, + 'mapping_rule_name': {'key': 'properties.mappingRuleName', 'type': 'str'}, + 'data_format': {'key': 'properties.dataFormat', 'type': 'str'}, + 'event_system_properties': {'key': 'properties.eventSystemProperties', 'type': '[str]'}, + 'compression': {'key': 'properties.compression', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + event_hub_resource_id: Optional[str] = None, + consumer_group: Optional[str] = None, + table_name: Optional[str] = None, + mapping_rule_name: Optional[str] = None, + data_format: Optional[Union[str, "EventHubDataFormat"]] = None, + event_system_properties: Optional[List[str]] = None, + compression: Optional[Union[str, "Compression"]] = None, + **kwargs + ): + super(EventHubDataConnection, self).__init__(location=location, **kwargs) + self.kind = 'EventHub' # type: str + self.event_hub_resource_id = event_hub_resource_id + self.consumer_group = consumer_group + self.table_name = table_name + self.mapping_rule_name = mapping_rule_name + self.data_format = data_format + self.event_system_properties = event_system_properties + self.compression = compression + self.provisioning_state = None + + class ExtendedServerBlobAuditingPolicy(ProxyResource): """An extended server blob auditing policy. @@ -1836,34 +2900,98 @@ def __init__( self.queue_delay_ms = queue_delay_ms -class ExtendedSqlPoolBlobAuditingPolicyListResult(msrest.serialization.Model): - """A list of sql pool extended auditing settings. +class ExtendedSqlPoolBlobAuditingPolicyListResult(msrest.serialization.Model): + """A list of sql pool extended auditing settings. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: Array of results. + :vartype value: list[~azure.mgmt.synapse.models.ExtendedSqlPoolBlobAuditingPolicy] + :ivar next_link: Link to retrieve next page of results. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ExtendedSqlPoolBlobAuditingPolicy]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExtendedSqlPoolBlobAuditingPolicyListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class FollowerDatabaseDefinition(msrest.serialization.Model): + """A class representing follower database request. Variables are only populated by the server, and will be ignored when sending a request. - :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 + All required parameters must be populated in order to send to Azure. + + :param kusto_pool_resource_id: Required. Resource id of the cluster that follows a database + owned by this cluster. + :type kusto_pool_resource_id: str + :param attached_database_configuration_name: Required. Resource name of the attached database + configuration in the follower cluster. + :type attached_database_configuration_name: str + :ivar database_name: The database name owned by this cluster that was followed. * in case + following all databases. + :vartype database_name: str """ _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, + 'kusto_pool_resource_id': {'required': True}, + 'attached_database_configuration_name': {'required': True}, + 'database_name': {'readonly': True}, } _attribute_map = { - 'value': {'key': 'value', 'type': '[ExtendedSqlPoolBlobAuditingPolicy]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'kusto_pool_resource_id': {'key': 'clusterResourceId', 'type': 'str'}, + 'attached_database_configuration_name': {'key': 'attachedDatabaseConfigurationName', 'type': 'str'}, + 'database_name': {'key': 'databaseName', 'type': 'str'}, } def __init__( self, + *, + kusto_pool_resource_id: str, + attached_database_configuration_name: str, **kwargs ): - super(ExtendedSqlPoolBlobAuditingPolicyListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None + super(FollowerDatabaseDefinition, self).__init__(**kwargs) + self.kusto_pool_resource_id = kusto_pool_resource_id + self.attached_database_configuration_name = attached_database_configuration_name + self.database_name = None + + +class FollowerDatabaseListResult(msrest.serialization.Model): + """The list Kusto database principals operation response. + + :param value: The list of follower database result. + :type value: list[~azure.mgmt.synapse.models.FollowerDatabaseDefinition] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[FollowerDatabaseDefinition]'}, + } + + def __init__( + self, + *, + value: Optional[List["FollowerDatabaseDefinition"]] = None, + **kwargs + ): + super(FollowerDatabaseListResult, self).__init__(**kwargs) + self.value = value class GeoBackupPolicy(ProxyResource): @@ -2861,6 +3989,105 @@ def __init__( self.subnet_id = subnet_id +class IotHubDataConnection(DataConnection): + """Class representing an iot hub data connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + Possible values include: "EventHub", "EventGrid", "IotHub". + :type kind: str or ~azure.mgmt.synapse.models.DataConnectionKind + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.synapse.models.SystemData + :param iot_hub_resource_id: The resource ID of the Iot hub to be used to create a data + connection. + :type iot_hub_resource_id: str + :param consumer_group: The iot hub consumer group. + :type consumer_group: str + :param table_name: The table where the data should be ingested. Optionally the table + information can be added to each message. + :type table_name: str + :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the + mapping information can be added to each message. + :type mapping_rule_name: str + :param data_format: The data format of the message. Optionally the data format can be added to + each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", + "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", + "W3CLOGFILE". + :type data_format: str or ~azure.mgmt.synapse.models.IotHubDataFormat + :param event_system_properties: System properties of the iot hub. + :type event_system_properties: list[str] + :param shared_access_policy_name: The name of the share access policy. + :type shared_access_policy_name: str + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'iot_hub_resource_id': {'key': 'properties.iotHubResourceId', 'type': 'str'}, + 'consumer_group': {'key': 'properties.consumerGroup', 'type': 'str'}, + 'table_name': {'key': 'properties.tableName', 'type': 'str'}, + 'mapping_rule_name': {'key': 'properties.mappingRuleName', 'type': 'str'}, + 'data_format': {'key': 'properties.dataFormat', 'type': 'str'}, + 'event_system_properties': {'key': 'properties.eventSystemProperties', 'type': '[str]'}, + 'shared_access_policy_name': {'key': 'properties.sharedAccessPolicyName', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + iot_hub_resource_id: Optional[str] = None, + consumer_group: Optional[str] = None, + table_name: Optional[str] = None, + mapping_rule_name: Optional[str] = None, + data_format: Optional[Union[str, "IotHubDataFormat"]] = None, + event_system_properties: Optional[List[str]] = None, + shared_access_policy_name: Optional[str] = None, + **kwargs + ): + super(IotHubDataConnection, self).__init__(location=location, **kwargs) + self.kind = 'IotHub' # type: str + self.iot_hub_resource_id = iot_hub_resource_id + self.consumer_group = consumer_group + self.table_name = table_name + self.mapping_rule_name = mapping_rule_name + self.data_format = data_format + self.event_system_properties = event_system_properties + self.shared_access_policy_name = shared_access_policy_name + self.provisioning_state = None + + class IpFirewallRuleInfo(ProxyResource): """IP firewall rule. @@ -3075,6 +4302,320 @@ def __init__( self.value = value +class KustoPool(TrackedResource): + """Class representing a Kusto kusto pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :param sku: Required. The SKU of the kusto pool. + :type sku: ~azure.mgmt.synapse.models.AzureSku + :ivar etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.synapse.models.SystemData + :ivar state: The state of the resource. Possible values include: "Creating", "Unavailable", + "Running", "Deleting", "Deleted", "Stopping", "Stopped", "Starting", "Updating". + :vartype state: str or ~azure.mgmt.synapse.models.State + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState + :ivar uri: The Kusto Pool URI. + :vartype uri: str + :ivar data_ingestion_uri: The Kusto Pool data ingestion URI. + :vartype data_ingestion_uri: str + :ivar state_reason: The reason for the Kusto Pool's current state. + :vartype state_reason: str + :param optimized_autoscale: Optimized auto scale definition. + :type optimized_autoscale: ~azure.mgmt.synapse.models.OptimizedAutoscale + :param enable_streaming_ingest: A boolean value that indicates if the streaming ingest is + enabled. + :type enable_streaming_ingest: bool + :param enable_purge: A boolean value that indicates if the purge operations are enabled. + :type enable_purge: bool + :ivar language_extensions: List of the Kusto Pool's language extensions. + :vartype language_extensions: ~azure.mgmt.synapse.models.LanguageExtensionsList + :param workspace_uid: The workspace unique identifier. + :type workspace_uid: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'sku': {'required': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'state': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'uri': {'readonly': True}, + 'data_ingestion_uri': {'readonly': True}, + 'state_reason': {'readonly': True}, + 'language_extensions': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'AzureSku'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'uri': {'key': 'properties.uri', 'type': 'str'}, + 'data_ingestion_uri': {'key': 'properties.dataIngestionUri', 'type': 'str'}, + 'state_reason': {'key': 'properties.stateReason', 'type': 'str'}, + 'optimized_autoscale': {'key': 'properties.optimizedAutoscale', 'type': 'OptimizedAutoscale'}, + 'enable_streaming_ingest': {'key': 'properties.enableStreamingIngest', 'type': 'bool'}, + 'enable_purge': {'key': 'properties.enablePurge', 'type': 'bool'}, + 'language_extensions': {'key': 'properties.languageExtensions', 'type': 'LanguageExtensionsList'}, + 'workspace_uid': {'key': 'properties.workspaceUID', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + sku: "AzureSku", + tags: Optional[Dict[str, str]] = None, + optimized_autoscale: Optional["OptimizedAutoscale"] = None, + enable_streaming_ingest: Optional[bool] = False, + enable_purge: Optional[bool] = False, + workspace_uid: Optional[str] = None, + **kwargs + ): + super(KustoPool, self).__init__(tags=tags, location=location, **kwargs) + self.sku = sku + self.etag = None + self.system_data = None + self.state = None + self.provisioning_state = None + self.uri = None + self.data_ingestion_uri = None + self.state_reason = None + self.optimized_autoscale = optimized_autoscale + self.enable_streaming_ingest = enable_streaming_ingest + self.enable_purge = enable_purge + self.language_extensions = None + self.workspace_uid = workspace_uid + + +class KustoPoolCheckNameRequest(msrest.serialization.Model): + """The object sent for a kusto pool check name availability request. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Kusto Pool name. + :type name: str + :ivar type: The type of resource, Microsoft.Synapse/workspaces/kustoPools. Has constant value: + "Microsoft.Synapse/workspaces/kustoPools". + :vartype type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + type = "Microsoft.Synapse/workspaces/kustoPools" + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(KustoPoolCheckNameRequest, self).__init__(**kwargs) + self.name = name + + +class KustoPoolListResult(msrest.serialization.Model): + """The list Kusto pools operation response. + + :param value: The list of Kusto pools. + :type value: list[~azure.mgmt.synapse.models.KustoPool] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[KustoPool]'}, + } + + def __init__( + self, + *, + value: Optional[List["KustoPool"]] = None, + **kwargs + ): + super(KustoPoolListResult, self).__init__(**kwargs) + self.value = value + + +class KustoPoolUpdate(Resource): + """Class representing an update to a Kusto kusto pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param sku: The SKU of the kusto pool. + :type sku: ~azure.mgmt.synapse.models.AzureSku + :ivar state: The state of the resource. Possible values include: "Creating", "Unavailable", + "Running", "Deleting", "Deleted", "Stopping", "Stopped", "Starting", "Updating". + :vartype state: str or ~azure.mgmt.synapse.models.State + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState + :ivar uri: The Kusto Pool URI. + :vartype uri: str + :ivar data_ingestion_uri: The Kusto Pool data ingestion URI. + :vartype data_ingestion_uri: str + :ivar state_reason: The reason for the Kusto Pool's current state. + :vartype state_reason: str + :param optimized_autoscale: Optimized auto scale definition. + :type optimized_autoscale: ~azure.mgmt.synapse.models.OptimizedAutoscale + :param enable_streaming_ingest: A boolean value that indicates if the streaming ingest is + enabled. + :type enable_streaming_ingest: bool + :param enable_purge: A boolean value that indicates if the purge operations are enabled. + :type enable_purge: bool + :ivar language_extensions: List of the Kusto Pool's language extensions. + :vartype language_extensions: ~azure.mgmt.synapse.models.LanguageExtensionsList + :param workspace_uid: The workspace unique identifier. + :type workspace_uid: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'state': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'uri': {'readonly': True}, + 'data_ingestion_uri': {'readonly': True}, + 'state_reason': {'readonly': True}, + 'language_extensions': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'AzureSku'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'uri': {'key': 'properties.uri', 'type': 'str'}, + 'data_ingestion_uri': {'key': 'properties.dataIngestionUri', 'type': 'str'}, + 'state_reason': {'key': 'properties.stateReason', 'type': 'str'}, + 'optimized_autoscale': {'key': 'properties.optimizedAutoscale', 'type': 'OptimizedAutoscale'}, + 'enable_streaming_ingest': {'key': 'properties.enableStreamingIngest', 'type': 'bool'}, + 'enable_purge': {'key': 'properties.enablePurge', 'type': 'bool'}, + 'language_extensions': {'key': 'properties.languageExtensions', 'type': 'LanguageExtensionsList'}, + 'workspace_uid': {'key': 'properties.workspaceUID', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + sku: Optional["AzureSku"] = None, + optimized_autoscale: Optional["OptimizedAutoscale"] = None, + enable_streaming_ingest: Optional[bool] = False, + enable_purge: Optional[bool] = False, + workspace_uid: Optional[str] = None, + **kwargs + ): + super(KustoPoolUpdate, self).__init__(**kwargs) + self.tags = tags + self.sku = sku + self.state = None + self.provisioning_state = None + self.uri = None + self.data_ingestion_uri = None + self.state_reason = None + self.optimized_autoscale = optimized_autoscale + self.enable_streaming_ingest = enable_streaming_ingest + self.enable_purge = enable_purge + self.language_extensions = None + self.workspace_uid = workspace_uid + + +class LanguageExtension(msrest.serialization.Model): + """The language extension object. + + :param language_extension_name: The language extension name. Possible values include: "PYTHON", + "R". + :type language_extension_name: str or ~azure.mgmt.synapse.models.LanguageExtensionName + """ + + _attribute_map = { + 'language_extension_name': {'key': 'languageExtensionName', 'type': 'str'}, + } + + def __init__( + self, + *, + language_extension_name: Optional[Union[str, "LanguageExtensionName"]] = None, + **kwargs + ): + super(LanguageExtension, self).__init__(**kwargs) + self.language_extension_name = language_extension_name + + +class LanguageExtensionsList(msrest.serialization.Model): + """The list of language extension objects. + + :param value: The list of language extensions. + :type value: list[~azure.mgmt.synapse.models.LanguageExtension] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[LanguageExtension]'}, + } + + def __init__( + self, + *, + value: Optional[List["LanguageExtension"]] = None, + **kwargs + ): + super(LanguageExtensionsList, self).__init__(**kwargs) + self.value = value + + class LibraryInfo(msrest.serialization.Model): """Library/package information of a Big Data pool powered by Apache Spark. @@ -3419,6 +4960,27 @@ def __init__( self.resource_id = resource_id +class ListResourceSkusResult(msrest.serialization.Model): + """List of available SKUs for a Kusto Pool. + + :param value: The collection of available SKUs for an existing resource. + :type value: list[~azure.mgmt.synapse.models.AzureResourceSku] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AzureResourceSku]'}, + } + + def __init__( + self, + *, + value: Optional[List["AzureResourceSku"]] = None, + **kwargs + ): + super(ListResourceSkusResult, self).__init__(**kwargs) + self.value = value + + class ListSqlPoolSecurityAlertPolicies(msrest.serialization.Model): """A list of SQL pool security alert policies. @@ -4053,6 +5615,109 @@ def __init__( self.sync_interval_in_minutes = sync_interval_in_minutes +class Operation(msrest.serialization.Model): + """A REST API operation. + + :param name: This is of the format {provider}/{resource}/{operation}. + :type name: str + :param display: The object that describes the operation. + :type display: ~azure.mgmt.synapse.models.OperationDisplay + :param origin: The intended executor of the operation. + :type origin: str + :param properties: Any object. + :type properties: any + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'object'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + properties: Optional[Any] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + self.origin = origin + self.properties = properties + + +class OperationDisplay(msrest.serialization.Model): + """The object that describes the operation. + + :param provider: Friendly name of the resource provider. + :type provider: str + :param operation: For example: read, write, delete. + :type operation: str + :param resource: The resource type on which the operation is performed. + :type resource: str + :param description: The friendly name of the operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + operation: Optional[str] = None, + resource: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.operation = operation + self.resource = resource + self.description = description + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The list of operations supported by the resource provider. + :type value: list[~azure.mgmt.synapse.models.Operation] + :ivar next_link: The URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Operation"]] = None, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class OperationMetaLogSpecification(msrest.serialization.Model): """What is this?. @@ -4270,6 +5935,52 @@ def __init__( self.percent_complete = percent_complete +class OptimizedAutoscale(msrest.serialization.Model): + """A class that contains the optimized auto scale definition. + + All required parameters must be populated in order to send to Azure. + + :param version: Required. The version of the template defined, for instance 1. + :type version: int + :param is_enabled: Required. A boolean value that indicate if the optimized autoscale feature + is enabled or not. + :type is_enabled: bool + :param minimum: Required. Minimum allowed instances count. + :type minimum: int + :param maximum: Required. Maximum allowed instances count. + :type maximum: int + """ + + _validation = { + 'version': {'required': True}, + 'is_enabled': {'required': True}, + 'minimum': {'required': True}, + 'maximum': {'required': True}, + } + + _attribute_map = { + 'version': {'key': 'version', 'type': 'int'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + 'minimum': {'key': 'minimum', 'type': 'int'}, + 'maximum': {'key': 'maximum', 'type': 'int'}, + } + + def __init__( + self, + *, + version: int, + is_enabled: bool, + minimum: int, + maximum: int, + **kwargs + ): + super(OptimizedAutoscale, self).__init__(**kwargs) + self.version = version + self.is_enabled = is_enabled + self.minimum = minimum + self.maximum = maximum + + class PrivateEndpoint(msrest.serialization.Model): """Private endpoint details. @@ -4915,6 +6626,86 @@ def __init__( self.intervals = None +class ReadWriteDatabase(Database): + """Class representing a read write database. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the database.Constant filled by server. Possible values + include: "ReadWrite", "ReadOnlyFollowing". + :type kind: str or ~azure.mgmt.synapse.models.Kind + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.synapse.models.SystemData + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving", "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.synapse.models.ResourceProvisioningState + :param soft_delete_period: The time the data should be kept before it stops being accessible to + queries in TimeSpan. + :type soft_delete_period: ~datetime.timedelta + :param hot_cache_period: The time the data should be kept in cache for fast queries in + TimeSpan. + :type hot_cache_period: ~datetime.timedelta + :ivar statistics: The statistics of the database. + :vartype statistics: ~azure.mgmt.synapse.models.DatabaseStatistics + :ivar is_followed: Indicates whether the database is followed. + :vartype is_followed: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + 'system_data': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'statistics': {'readonly': True}, + 'is_followed': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'soft_delete_period': {'key': 'properties.softDeletePeriod', 'type': 'duration'}, + 'hot_cache_period': {'key': 'properties.hotCachePeriod', 'type': 'duration'}, + 'statistics': {'key': 'properties.statistics', 'type': 'DatabaseStatistics'}, + 'is_followed': {'key': 'properties.isFollowed', 'type': 'bool'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + soft_delete_period: Optional[datetime.timedelta] = None, + hot_cache_period: Optional[datetime.timedelta] = None, + **kwargs + ): + super(ReadWriteDatabase, self).__init__(location=location, **kwargs) + self.kind = 'ReadWrite' # type: str + self.provisioning_state = None + self.soft_delete_period = soft_delete_period + self.hot_cache_period = hot_cache_period + self.statistics = None + self.is_followed = None + + class RecommendedSensitivityLabelUpdate(ProxyResource): """A recommended sensitivity label update operation. @@ -6563,6 +8354,113 @@ def __init__( self.capacity = capacity +class SkuDescription(msrest.serialization.Model): + """The Kusto SKU description of given resource type. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar resource_type: The resource type. + :vartype resource_type: str + :ivar name: The name of the SKU. + :vartype name: str + :ivar size: The size of the SKU. + :vartype size: str + :ivar locations: The set of locations that the SKU is available. + :vartype locations: list[str] + :ivar location_info: Locations and zones. + :vartype location_info: list[~azure.mgmt.synapse.models.SkuLocationInfoItem] + :ivar restrictions: The restrictions because of which SKU cannot be used. + :vartype restrictions: list[any] + """ + + _validation = { + 'resource_type': {'readonly': True}, + 'name': {'readonly': True}, + 'size': {'readonly': True}, + 'locations': {'readonly': True}, + 'location_info': {'readonly': True}, + 'restrictions': {'readonly': True}, + } + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + 'location_info': {'key': 'locationInfo', 'type': '[SkuLocationInfoItem]'}, + 'restrictions': {'key': 'restrictions', 'type': '[object]'}, + } + + def __init__( + self, + **kwargs + ): + super(SkuDescription, self).__init__(**kwargs) + self.resource_type = None + self.name = None + self.size = None + self.locations = None + self.location_info = None + self.restrictions = None + + +class SkuDescriptionList(msrest.serialization.Model): + """The list of the SKU descriptions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: SKU descriptions. + :vartype value: list[~azure.mgmt.synapse.models.SkuDescription] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SkuDescription]'}, + } + + def __init__( + self, + **kwargs + ): + super(SkuDescriptionList, self).__init__(**kwargs) + self.value = None + + +class SkuLocationInfoItem(msrest.serialization.Model): + """The locations and zones info for SKU. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The available location of the SKU. + :type location: str + :param zones: The available zone of the SKU. + :type zones: list[str] + """ + + _validation = { + 'location': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + } + + def __init__( + self, + *, + location: str, + zones: Optional[List[str]] = None, + **kwargs + ): + super(SkuLocationInfoItem, self).__init__(**kwargs) + self.location = location + self.zones = zones + + class SparkConfigProperties(msrest.serialization.Model): """SparkConfig Properties for a Big Data pool powered by Apache Spark. @@ -6744,8 +8642,22 @@ class SqlPool(TrackedResource): :type status: str :param restore_point_in_time: Snapshot time to restore. :type restore_point_in_time: ~datetime.datetime - :param create_mode: What is this?. - :type create_mode: str + :param create_mode: Specifies the mode of sql pool creation. + + Default: regular sql pool creation. + + PointInTimeRestore: Creates a sql pool by restoring a point in time backup of an existing sql + pool. sourceDatabaseId must be specified as the resource ID of the existing sql pool, and + restorePointInTime must be specified. + + Recovery: Creates a sql pool by a geo-replicated backup. sourceDatabaseId must be specified + as the recoverableDatabaseId to restore. + + Restore: Creates a sql pool by restoring a backup of a deleted sql pool. SourceDatabaseId + should be the sql pool's original resource ID. SourceDatabaseId and sourceDatabaseDeletionDate + must be specified. Possible values include: "Default", "PointInTimeRestore", "Recovery", + "Restore". + :type create_mode: str or ~azure.mgmt.synapse.models.CreateMode :param creation_date: Date the SQL pool was created. :type creation_date: ~datetime.datetime :param storage_account_type: The storage account type used to store backups for this sql pool. @@ -6795,7 +8707,7 @@ def __init__( provisioning_state: Optional[str] = None, status: Optional[str] = None, restore_point_in_time: Optional[datetime.datetime] = None, - create_mode: Optional[str] = None, + create_mode: Optional[Union[str, "CreateMode"]] = None, creation_date: Optional[datetime.datetime] = None, storage_account_type: Optional[Union[str, "StorageAccountType"]] = None, source_database_deletion_date: Optional[datetime.datetime] = None, @@ -7357,8 +9269,22 @@ class SqlPoolPatchInfo(msrest.serialization.Model): :type status: str :param restore_point_in_time: Snapshot time to restore. :type restore_point_in_time: ~datetime.datetime - :param create_mode: What is this?. - :type create_mode: str + :param create_mode: Specifies the mode of sql pool creation. + + Default: regular sql pool creation. + + PointInTimeRestore: Creates a sql pool by restoring a point in time backup of an existing sql + pool. sourceDatabaseId must be specified as the resource ID of the existing sql pool, and + restorePointInTime must be specified. + + Recovery: Creates a sql pool by a geo-replicated backup. sourceDatabaseId must be specified + as the recoverableDatabaseId to restore. + + Restore: Creates a sql pool by restoring a backup of a deleted sql pool. SourceDatabaseId + should be the sql pool's original resource ID. SourceDatabaseId and sourceDatabaseDeletionDate + must be specified. Possible values include: "Default", "PointInTimeRestore", "Recovery", + "Restore". + :type create_mode: str or ~azure.mgmt.synapse.models.CreateMode :param creation_date: Date the SQL pool was created. :type creation_date: ~datetime.datetime :param storage_account_type: The storage account type used to store backups for this sql pool. @@ -7398,7 +9324,7 @@ def __init__( provisioning_state: Optional[str] = None, status: Optional[str] = None, restore_point_in_time: Optional[datetime.datetime] = None, - create_mode: Optional[str] = None, + create_mode: Optional[Union[str, "CreateMode"]] = None, creation_date: Optional[datetime.datetime] = None, storage_account_type: Optional[Union[str, "StorageAccountType"]] = None, source_database_deletion_date: Optional[datetime.datetime] = None, @@ -8399,6 +10325,102 @@ def __init__( self.sensitive_value = sensitive_value +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.synapse.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.synapse.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class TableLevelSharingProperties(msrest.serialization.Model): + """Tables that will be included and excluded in the follower database. + + :param tables_to_include: List of tables to include in the follower database. + :type tables_to_include: list[str] + :param tables_to_exclude: List of tables to exclude from the follower database. + :type tables_to_exclude: list[str] + :param external_tables_to_include: List of external tables to include in the follower database. + :type external_tables_to_include: list[str] + :param external_tables_to_exclude: List of external tables exclude from the follower database. + :type external_tables_to_exclude: list[str] + :param materialized_views_to_include: List of materialized views to include in the follower + database. + :type materialized_views_to_include: list[str] + :param materialized_views_to_exclude: List of materialized views exclude from the follower + database. + :type materialized_views_to_exclude: list[str] + """ + + _attribute_map = { + 'tables_to_include': {'key': 'tablesToInclude', 'type': '[str]'}, + 'tables_to_exclude': {'key': 'tablesToExclude', 'type': '[str]'}, + 'external_tables_to_include': {'key': 'externalTablesToInclude', 'type': '[str]'}, + 'external_tables_to_exclude': {'key': 'externalTablesToExclude', 'type': '[str]'}, + 'materialized_views_to_include': {'key': 'materializedViewsToInclude', 'type': '[str]'}, + 'materialized_views_to_exclude': {'key': 'materializedViewsToExclude', 'type': '[str]'}, + } + + def __init__( + self, + *, + tables_to_include: Optional[List[str]] = None, + tables_to_exclude: Optional[List[str]] = None, + external_tables_to_include: Optional[List[str]] = None, + external_tables_to_exclude: Optional[List[str]] = None, + materialized_views_to_include: Optional[List[str]] = None, + materialized_views_to_exclude: Optional[List[str]] = None, + **kwargs + ): + super(TableLevelSharingProperties, self).__init__(**kwargs) + self.tables_to_include = tables_to_include + self.tables_to_exclude = tables_to_exclude + self.external_tables_to_include = external_tables_to_include + self.external_tables_to_exclude = external_tables_to_exclude + self.materialized_views_to_include = materialized_views_to_include + self.materialized_views_to_exclude = materialized_views_to_exclude + + class TopQueries(msrest.serialization.Model): """A database query. 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 dc1169b9f333f..b9ee2a3bfecca 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 @@ -30,6 +30,14 @@ class AzureADOnlyAuthenticationName(with_metaclass(_CaseInsensitiveEnumMeta, str DEFAULT = "default" +class AzureScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Scale type. + """ + + AUTOMATIC = "automatic" + MANUAL = "manual" + NONE = "none" + class BlobAuditingPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" @@ -42,6 +50,20 @@ class BlobAuditingPolicyState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum ENABLED = "Enabled" DISABLED = "Disabled" +class BlobStorageEventType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The name of blob storage event type to process. + """ + + MICROSOFT_STORAGE_BLOB_CREATED = "Microsoft.Storage.BlobCreated" + MICROSOFT_STORAGE_BLOB_RENAMED = "Microsoft.Storage.BlobRenamed" + +class ClusterPrincipalRole(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Cluster principal role. + """ + + ALL_DATABASES_ADMIN = "AllDatabasesAdmin" + ALL_DATABASES_VIEWER = "AllDatabasesViewer" + class ColumnDataType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The column data type. """ @@ -81,6 +103,13 @@ class ColumnDataType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): XML = "xml" SYSNAME = "sysname" +class Compression(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The compression type + """ + + NONE = "None" + G_ZIP = "GZip" + class ConfigurationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The type of the spark config properties file. """ @@ -92,6 +121,56 @@ class ConnectionPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class CreateMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the mode of sql pool creation. + + Default: regular sql pool creation. + + PointInTimeRestore: Creates a sql pool by restoring a point in time backup of an existing sql + pool. sourceDatabaseId must be specified as the resource ID of the existing sql pool, and + restorePointInTime must be specified. + + Recovery: Creates a sql pool by a geo-replicated backup. sourceDatabaseId must be specified as + the recoverableDatabaseId to restore. + + Restore: Creates a sql pool by restoring a backup of a deleted sql pool. SourceDatabaseId + should be the sql pool's original resource ID. SourceDatabaseId and sourceDatabaseDeletionDate + must be specified. + """ + + DEFAULT = "Default" + POINT_IN_TIME_RESTORE = "PointInTimeRestore" + RECOVERY = "Recovery" + RESTORE = "Restore" + +class DatabasePrincipalRole(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Database principal role. + """ + + ADMIN = "Admin" + INGESTOR = "Ingestor" + MONITOR = "Monitor" + USER = "User" + UNRESTRICTED_VIEWER = "UnrestrictedViewer" + VIEWER = "Viewer" + +class DataConnectionKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Kind of the endpoint for the data connection + """ + + EVENT_HUB = "EventHub" + EVENT_GRID = "EventGrid" + IOT_HUB = "IotHub" + class DataFlowComputeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Compute type of the cluster which will execute data flow job. """ @@ -144,10 +223,60 @@ class DayOfWeek(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FRIDAY = "Friday" SATURDAY = "Saturday" +class DefaultPrincipalsModificationKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The default principals modification kind + """ + + UNION = "Union" + REPLACE = "Replace" + NONE = "None" + class EncryptionProtectorName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): CURRENT = "current" +class EventGridDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The data format of the message. Optionally the data format can be added to each message. + """ + + MULTIJSON = "MULTIJSON" + JSON = "JSON" + CSV = "CSV" + TSV = "TSV" + SCSV = "SCSV" + SOHSV = "SOHSV" + PSV = "PSV" + TXT = "TXT" + RAW = "RAW" + SINGLEJSON = "SINGLEJSON" + AVRO = "AVRO" + TSVE = "TSVE" + PARQUET = "PARQUET" + ORC = "ORC" + APACHEAVRO = "APACHEAVRO" + W3_CLOGFILE = "W3CLOGFILE" + +class EventHubDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The data format of the message. Optionally the data format can be added to each message. + """ + + MULTIJSON = "MULTIJSON" + JSON = "JSON" + CSV = "CSV" + TSV = "TSV" + SCSV = "SCSV" + SOHSV = "SOHSV" + PSV = "PSV" + TXT = "TXT" + RAW = "RAW" + SINGLEJSON = "SINGLEJSON" + AVRO = "AVRO" + TSVE = "TSVE" + PARQUET = "PARQUET" + ORC = "ORC" + APACHEAVRO = "APACHEAVRO" + W3_CLOGFILE = "W3CLOGFILE" + class GeoBackupPolicyName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "Default" @@ -243,6 +372,41 @@ class IntegrationRuntimeUpdateResult(with_metaclass(_CaseInsensitiveEnumMeta, st SUCCEED = "Succeed" FAIL = "Fail" +class IotHubDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The data format of the message. Optionally the data format can be added to each message. + """ + + MULTIJSON = "MULTIJSON" + JSON = "JSON" + CSV = "CSV" + TSV = "TSV" + SCSV = "SCSV" + SOHSV = "SOHSV" + PSV = "PSV" + TXT = "TXT" + RAW = "RAW" + SINGLEJSON = "SINGLEJSON" + AVRO = "AVRO" + TSVE = "TSVE" + PARQUET = "PARQUET" + ORC = "ORC" + APACHEAVRO = "APACHEAVRO" + W3_CLOGFILE = "W3CLOGFILE" + +class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Kind of the database + """ + + READ_WRITE = "ReadWrite" + READ_ONLY_FOLLOWING = "ReadOnlyFollowing" + +class LanguageExtensionName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Language extension that can run within KQL query. + """ + + PYTHON = "PYTHON" + R = "R" + class ManagedIdentitySqlControlSettingsModelPropertiesGrantSqlControlToManagedIdentityActualState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Actual state """ @@ -310,6 +474,14 @@ class OperationStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" CANCELED = "Canceled" +class PrincipalType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Principal type. + """ + + APP = "App" + GROUP = "Group" + USER = "User" + class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Resource provisioning state """ @@ -357,6 +529,13 @@ class QueryObservedMetricType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum DURATION = "duration" EXECUTION_COUNT = "executionCount" +class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Message providing the reason why the given name is invalid. + """ + + INVALID = "Invalid" + ALREADY_EXISTS = "AlreadyExists" + class RecommendedSensitivityLabelUpdateKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ENABLE = "enable" @@ -389,6 +568,18 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM_ASSIGNED = "SystemAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" +class ResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The provisioned state of the resource. + """ + + RUNNING = "Running" + CREATING = "Creating" + DELETING = "Deleting" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + MOVING = "Moving" + CANCELED = "Canceled" + class RestorePointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The type of restore point """ @@ -450,6 +641,22 @@ class ServerKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SERVICE_MANAGED = "ServiceManaged" AZURE_KEY_VAULT = "AzureKeyVault" +class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """SKU name. + """ + + COMPUTE_OPTIMIZED = "Compute optimized" + STORAGE_OPTIMIZED = "Storage optimized" + +class SkuSize(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """SKU size. + """ + + EXTRA_SMALL = "Extra small" + SMALL = "Small" + MEDIUM = "Medium" + LARGE = "Large" + class SsisObjectMetadataType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The type of SSIS object metadata. """ @@ -459,6 +666,20 @@ class SsisObjectMetadataType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) PACKAGE = "Package" ENVIRONMENT = "Environment" +class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The state of the resource. + """ + + CREATING = "Creating" + UNAVAILABLE = "Unavailable" + RUNNING = "Running" + DELETING = "Deleting" + DELETED = "Deleted" + STOPPING = "Stopping" + STOPPED = "Stopped" + STARTING = "Starting" + UPDATING = "Updating" + class StateValue(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """property configuration state """ @@ -486,6 +707,13 @@ class TransparentDataEncryptionStatus(with_metaclass(_CaseInsensitiveEnumMeta, s ENABLED = "Enabled" DISABLED = "Disabled" +class Type(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of resource, for instance Microsoft.Synapse/workspaces/kustoPools/databases. + """ + + MICROSOFT_SYNAPSE_WORKSPACES_KUSTO_POOLS_DATABASES = "Microsoft.Synapse/workspaces/kustoPools/databases" + MICROSOFT_SYNAPSE_WORKSPACES_KUSTO_POOLS_ATTACHED_DATABASE_CONFIGURATIONS = "Microsoft.Synapse/workspaces/kustoPools/attachedDatabaseConfigurations" + class VulnerabilityAssessmentName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DEFAULT = "default" 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 8dbf81dbc73cc..44b8ebef2ef3a 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 @@ -70,6 +70,15 @@ from ._integration_runtime_status_operations import IntegrationRuntimeStatusOperations from ._spark_configuration_operations import SparkConfigurationOperations from ._spark_configurations_operations import SparkConfigurationsOperations +from ._kusto_operations_operations import KustoOperationsOperations +from ._kusto_pool_operations import KustoPoolOperations +from ._kusto_pools_operations import KustoPoolsOperations +from ._kusto_pool_child_resource_operations import KustoPoolChildResourceOperations +from ._kusto_pool_attached_database_configurations_operations import KustoPoolAttachedDatabaseConfigurationsOperations +from ._kusto_pool_databases_operations import KustoPoolDatabasesOperations +from ._kusto_pool_data_connections_operations import KustoPoolDataConnectionsOperations +from ._kusto_pool_principal_assignments_operations import KustoPoolPrincipalAssignmentsOperations +from ._kusto_pool_database_principal_assignments_operations import KustoPoolDatabasePrincipalAssignmentsOperations __all__ = [ 'AzureADOnlyAuthenticationsOperations', @@ -136,4 +145,13 @@ 'IntegrationRuntimeStatusOperations', 'SparkConfigurationOperations', 'SparkConfigurationsOperations', + 'KustoOperationsOperations', + 'KustoPoolOperations', + 'KustoPoolsOperations', + 'KustoPoolChildResourceOperations', + 'KustoPoolAttachedDatabaseConfigurationsOperations', + 'KustoPoolDatabasesOperations', + 'KustoPoolDataConnectionsOperations', + 'KustoPoolPrincipalAssignmentsOperations', + 'KustoPoolDatabasePrincipalAssignmentsOperations', ] diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_operations_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_operations_operations.py new file mode 100644 index 0000000000000..9847f7e3f5e12 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_operations_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 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 KustoOperationsOperations(object): + """KustoOperationsOperations 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, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationListResult"] + """Lists available operations for the Kusto sub-resources inside Microsoft.Synapse provider. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = 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('OperationListResult', 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.failsafe_deserialize(_models.ErrorResponse, 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': '/providers/Microsoft.Synapse/kustooperations'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_attached_database_configurations_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_attached_database_configurations_operations.py new file mode 100644 index 0000000000000..d7d859967fa78 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_attached_database_configurations_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 KustoPoolAttachedDatabaseConfigurationsOperations(object): + """KustoPoolAttachedDatabaseConfigurationsOperations 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_kusto_pool( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.AttachedDatabaseConfigurationListResult"] + """Returns the list of attached database configurations of the given Kusto Pool. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AttachedDatabaseConfigurationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.AttachedDatabaseConfigurationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AttachedDatabaseConfigurationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_kusto_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + 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('AttachedDatabaseConfigurationListResult', 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.failsafe_deserialize(_models.ErrorResponse, 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_kusto_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations'} # type: ignore + + def get( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + attached_database_configuration_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.AttachedDatabaseConfiguration" + """Returns an attached database configuration. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param attached_database_configuration_name: The name of the attached database configuration. + :type attached_database_configuration_name: str + :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: AttachedDatabaseConfiguration, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.AttachedDatabaseConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AttachedDatabaseConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore + + def _create_or_update_initial( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + attached_database_configuration_name, # type: str + resource_group_name, # type: str + parameters, # type: "_models.AttachedDatabaseConfiguration" + **kwargs # type: Any + ): + # type: (...) -> "_models.AttachedDatabaseConfiguration" + cls = kwargs.pop('cls', None) # type: ClsType["_models.AttachedDatabaseConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'AttachedDatabaseConfiguration') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('AttachedDatabaseConfiguration', 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}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore + + def begin_create_or_update( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + attached_database_configuration_name, # type: str + resource_group_name, # type: str + parameters, # type: "_models.AttachedDatabaseConfiguration" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.AttachedDatabaseConfiguration"] + """Creates or updates an attached database configuration. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param attached_database_configuration_name: The name of the attached database configuration. + :type attached_database_configuration_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param parameters: The database parameters supplied to the CreateOrUpdate operation. + :type parameters: ~azure.mgmt.synapse.models.AttachedDatabaseConfiguration + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either AttachedDatabaseConfiguration or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.AttachedDatabaseConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.AttachedDatabaseConfiguration"] + 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( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + attached_database_configuration_name=attached_database_configuration_name, + resource_group_name=resource_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('AttachedDatabaseConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore + + def _delete_initial( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + attached_database_configuration_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore + + def begin_delete( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + attached_database_configuration_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the attached database configuration with the given name. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param attached_database_configuration_name: The name of the attached database configuration. + :type attached_database_configuration_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + attached_database_configuration_name=attached_database_configuration_name, + resource_group_name=resource_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 = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_child_resource_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_child_resource_operations.py new file mode 100644 index 0000000000000..db0f31f5a3d50 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_child_resource_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 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 KustoPoolChildResourceOperations(object): + """KustoPoolChildResourceOperations 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 check_name_availability( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + resource_group_name, # type: str + resource_name, # type: "_models.DatabaseCheckNameRequest" + **kwargs # type: Any + ): + # type: (...) -> "_models.CheckNameResult" + """Checks that the Kusto Pool child resource name is valid and is not already in use. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param resource_name: The name of the Kusto Pool child resource. + :type resource_name: ~azure.mgmt.synapse.models.DatabaseCheckNameRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameResult, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.CheckNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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(resource_name, 'DatabaseCheckNameRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/checkNameAvailability'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_data_connections_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_data_connections_operations.py new file mode 100644 index 0000000000000..830b7c43f76ae --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_data_connections_operations.py @@ -0,0 +1,859 @@ +# 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 KustoPoolDataConnectionsOperations(object): + """KustoPoolDataConnectionsOperations 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 check_name_availability( + self, + resource_group_name, # type: str + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + data_connection_name, # type: "_models.DataConnectionCheckNameRequest" + **kwargs # type: Any + ): + # type: (...) -> "_models.CheckNameResult" + """Checks that the data connection name is valid and is not already in use. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param data_connection_name: The name of the data connection. + :type data_connection_name: ~azure.mgmt.synapse.models.DataConnectionCheckNameRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameResult, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.CheckNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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(data_connection_name, 'DataConnectionCheckNameRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/checkNameAvailability'} # type: ignore + + def _data_connection_validation_initial( + self, + resource_group_name, # type: str + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + parameters, # type: "_models.DataConnectionValidation" + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.DataConnectionValidationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DataConnectionValidationListResult"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._data_connection_validation_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'DataConnectionValidation') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DataConnectionValidationListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _data_connection_validation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnectionValidation'} # type: ignore + + def begin_data_connection_validation( + self, + resource_group_name, # type: str + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + parameters, # type: "_models.DataConnectionValidation" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DataConnectionValidationListResult"] + """Checks that the data connection parameters are valid. + + :param resource_group_name: 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 kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param parameters: The data connection parameters supplied to the CreateOrUpdate operation. + :type parameters: ~azure.mgmt.synapse.models.DataConnectionValidation + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DataConnectionValidationListResult or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.DataConnectionValidationListResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnectionValidationListResult"] + 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._data_connection_validation_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_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('DataConnectionValidationListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + 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_data_connection_validation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnectionValidation'} # type: ignore + + def list_by_database( + self, + resource_group_name, # type: str + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DataConnectionListResult"] + """Returns the list of data connections of the given Kusto pool database. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DataConnectionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.DataConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_database.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + 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('DataConnectionListResult', 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.failsafe_deserialize(_models.ErrorResponse, 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_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections'} # type: ignore + + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + data_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DataConnection" + """Returns a data 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 kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param data_connection_name: The name of the data connection. + :type data_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataConnection, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.DataConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + data_connection_name, # type: str + parameters, # type: "_models.DataConnection" + **kwargs # type: Any + ): + # type: (...) -> "_models.DataConnection" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'DataConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataConnection', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DataConnection', 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}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + data_connection_name, # type: str + parameters, # type: "_models.DataConnection" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DataConnection"] + """Creates or updates a data 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 kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param data_connection_name: The name of the data connection. + :type data_connection_name: str + :param parameters: The data connection parameters supplied to the CreateOrUpdate operation. + :type parameters: ~azure.mgmt.synapse.models.DataConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DataConnection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.DataConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnection"] + 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, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + data_connection_name=data_connection_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('DataConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + data_connection_name, # type: str + parameters, # type: "_models.DataConnection" + **kwargs # type: Any + ): + # type: (...) -> "_models.DataConnection" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'DataConnection') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DataConnection', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('DataConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + data_connection_name, # type: str + parameters, # type: "_models.DataConnection" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DataConnection"] + """Updates a data 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 kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param data_connection_name: The name of the data connection. + :type data_connection_name: str + :param parameters: The data connection parameters supplied to the Update operation. + :type parameters: ~azure.mgmt.synapse.models.DataConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DataConnection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.DataConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnection"] + 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._update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + data_connection_name=data_connection_name, + 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('DataConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + data_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + data_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the data connection with the given 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 kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param data_connection_name: The name of the data connection. + :type data_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + data_connection_name=data_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): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_database_principal_assignments_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_database_principal_assignments_operations.py new file mode 100644 index 0000000000000..784adcf975581 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_database_principal_assignments_operations.py @@ -0,0 +1,564 @@ +# 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 KustoPoolDatabasePrincipalAssignmentsOperations(object): + """KustoPoolDatabasePrincipalAssignmentsOperations 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 check_name_availability( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + resource_group_name, # type: str + principal_assignment_name, # type: "_models.DatabasePrincipalAssignmentCheckNameRequest" + **kwargs # type: Any + ): + # type: (...) -> "_models.CheckNameResult" + """Checks that the database principal assignment is valid and is not already in use. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param principal_assignment_name: The name of the resource. + :type principal_assignment_name: ~azure.mgmt.synapse.models.DatabasePrincipalAssignmentCheckNameRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameResult, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.CheckNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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(principal_assignment_name, 'DatabasePrincipalAssignmentCheckNameRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/checkPrincipalAssignmentNameAvailability'} # type: ignore + + def list( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DatabasePrincipalAssignmentListResult"] + """Lists all Kusto pool database principalAssignments. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DatabasePrincipalAssignmentListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.DatabasePrincipalAssignmentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabasePrincipalAssignmentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + 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('DatabasePrincipalAssignmentListResult', 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.failsafe_deserialize(_models.ErrorResponse, 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}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments'} # type: ignore + + def get( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + principal_assignment_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DatabasePrincipalAssignment" + """Gets a Kusto pool database principalAssignment. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param principal_assignment_name: The name of the Kusto principalAssignment. + :type principal_assignment_name: str + :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: DatabasePrincipalAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.DatabasePrincipalAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabasePrincipalAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DatabasePrincipalAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + def _create_or_update_initial( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + principal_assignment_name, # type: str + resource_group_name, # type: str + parameters, # type: "_models.DatabasePrincipalAssignment" + **kwargs # type: Any + ): + # type: (...) -> "_models.DatabasePrincipalAssignment" + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabasePrincipalAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'DatabasePrincipalAssignment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('DatabasePrincipalAssignment', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('DatabasePrincipalAssignment', 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}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + def begin_create_or_update( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + principal_assignment_name, # type: str + resource_group_name, # type: str + parameters, # type: "_models.DatabasePrincipalAssignment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.DatabasePrincipalAssignment"] + """Creates a Kusto pool database principalAssignment. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param principal_assignment_name: The name of the Kusto principalAssignment. + :type principal_assignment_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param parameters: The Kusto principalAssignments parameters supplied for the operation. + :type parameters: ~azure.mgmt.synapse.models.DatabasePrincipalAssignment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either DatabasePrincipalAssignment or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.DatabasePrincipalAssignment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabasePrincipalAssignment"] + 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( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + principal_assignment_name=principal_assignment_name, + resource_group_name=resource_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('DatabasePrincipalAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + def _delete_initial( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + principal_assignment_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + def begin_delete( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + principal_assignment_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a Kusto pool principalAssignment. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param principal_assignment_name: The name of the Kusto principalAssignment. + :type principal_assignment_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_name, + principal_assignment_name=principal_assignment_name, + resource_group_name=resource_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 = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_databases_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_databases_operations.py new file mode 100644 index 0000000000000..3b37bf62ab73b --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_databases_operations.py @@ -0,0 +1,611 @@ +# 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 KustoPoolDatabasesOperations(object): + """KustoPoolDatabasesOperations 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_kusto_pool( + self, + resource_group_name, # type: str + workspace_name, # type: str + kusto_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DatabaseListResult"] + """Returns the list of databases of the given Kusto pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_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 DatabaseListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.DatabaseListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_kusto_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + 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('DatabaseListResult', 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.failsafe_deserialize(_models.ErrorResponse, 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_kusto_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases'} # type: ignore + + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Database" + """Returns a database. + + :param resource_group_name: 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 kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Database, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.Database + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Database"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Database', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + parameters, # type: "_models.Database" + **kwargs # type: Any + ): + # type: (...) -> "_models.Database" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Database"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'Database') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Database', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Database', 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}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + parameters, # type: "_models.Database" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Database"] + """Creates or updates a database. + + :param resource_group_name: 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 kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param parameters: The database parameters supplied to the CreateOrUpdate operation. + :type parameters: ~azure.mgmt.synapse.models.Database + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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 Database or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.Database] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Database"] + 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, + kusto_pool_name=kusto_pool_name, + database_name=database_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('Database', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + parameters, # type: "_models.Database" + **kwargs # type: Any + ): + # type: (...) -> "_models.Database" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Database"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'Database') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Database', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Database', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + parameters, # type: "_models.Database" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Database"] + """Updates a database. + + :param resource_group_name: 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 kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :param parameters: The database parameters supplied to the Update operation. + :type parameters: ~azure.mgmt.synapse.models.Database + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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 Database or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.Database] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Database"] + 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._update_initial( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + database_name=database_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('Database', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + workspace_name, # type: str + kusto_pool_name, # type: str + database_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the database with the given 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 kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param database_name: The name of the database in the Kusto pool. + :type database_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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, + kusto_pool_name=kusto_pool_name, + database_name=database_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), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'databaseName': self._serialize.url("database_name", database_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/databases/{databaseName}'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_operations.py new file mode 100644 index 0000000000000..35f482d635eec --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_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 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 KustoPoolOperations(object): + """KustoPoolOperations 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_skus( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SkuDescriptionList"] + """Lists eligible SKUs for Kusto Pool resource. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SkuDescriptionList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.SkuDescriptionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SkuDescriptionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_skus.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + 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('SkuDescriptionList', 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.failsafe_deserialize(_models.ErrorResponse, 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_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/skus'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_principal_assignments_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_principal_assignments_operations.py new file mode 100644 index 0000000000000..41e182b779d0e --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pool_principal_assignments_operations.py @@ -0,0 +1,538 @@ +# 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 KustoPoolPrincipalAssignmentsOperations(object): + """KustoPoolPrincipalAssignmentsOperations 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 check_name_availability( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + resource_group_name, # type: str + principal_assignment_name, # type: "_models.ClusterPrincipalAssignmentCheckNameRequest" + **kwargs # type: Any + ): + # type: (...) -> "_models.CheckNameResult" + """Checks that the principal assignment name is valid and is not already in use. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param principal_assignment_name: The name of the principal assignment. + :type principal_assignment_name: ~azure.mgmt.synapse.models.ClusterPrincipalAssignmentCheckNameRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameResult, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.CheckNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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(principal_assignment_name, 'ClusterPrincipalAssignmentCheckNameRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/checkPrincipalAssignmentNameAvailability'} # type: ignore + + def list( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ClusterPrincipalAssignmentListResult"] + """Lists all Kusto pool principalAssignments. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ClusterPrincipalAssignmentListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.ClusterPrincipalAssignmentListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterPrincipalAssignmentListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + 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('ClusterPrincipalAssignmentListResult', 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.failsafe_deserialize(_models.ErrorResponse, 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}/kustoPools/{kustoPoolName}/principalAssignments'} # type: ignore + + def get( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + principal_assignment_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ClusterPrincipalAssignment" + """Gets a Kusto pool principalAssignment. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param principal_assignment_name: The name of the Kusto principalAssignment. + :type principal_assignment_name: str + :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: ClusterPrincipalAssignment, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.ClusterPrincipalAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterPrincipalAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ClusterPrincipalAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + def _create_or_update_initial( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + principal_assignment_name, # type: str + resource_group_name, # type: str + parameters, # type: "_models.ClusterPrincipalAssignment" + **kwargs # type: Any + ): + # type: (...) -> "_models.ClusterPrincipalAssignment" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterPrincipalAssignment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'ClusterPrincipalAssignment') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ClusterPrincipalAssignment', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ClusterPrincipalAssignment', 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}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + def begin_create_or_update( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + principal_assignment_name, # type: str + resource_group_name, # type: str + parameters, # type: "_models.ClusterPrincipalAssignment" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ClusterPrincipalAssignment"] + """Create a Kusto pool principalAssignment. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param principal_assignment_name: The name of the Kusto principalAssignment. + :type principal_assignment_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param parameters: The Kusto pool principalAssignment's parameters supplied for the operation. + :type parameters: ~azure.mgmt.synapse.models.ClusterPrincipalAssignment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ClusterPrincipalAssignment or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.ClusterPrincipalAssignment] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterPrincipalAssignment"] + 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( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + principal_assignment_name=principal_assignment_name, + resource_group_name=resource_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('ClusterPrincipalAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + def _delete_initial( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + principal_assignment_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + def begin_delete( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + principal_assignment_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a Kusto pool principalAssignment. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param principal_assignment_name: The name of the Kusto principalAssignment. + :type principal_assignment_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + principal_assignment_name=principal_assignment_name, + resource_group_name=resource_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 = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/principalAssignments/{principalAssignmentName}'} # type: ignore diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pools_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pools_operations.py new file mode 100644 index 0000000000000..4b9075942848c --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_kusto_pools_operations.py @@ -0,0 +1,1520 @@ +# 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 KustoPoolsOperations(object): + """KustoPoolsOperations 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 check_name_availability( + self, + location, # type: str + kusto_pool_name, # type: "_models.KustoPoolCheckNameRequest" + **kwargs # type: Any + ): + # type: (...) -> "_models.CheckNameResult" + """Checks that the kusto pool name is valid and is not already in use. + + :param location: The name of Azure region. + :type location: str + :param kusto_pool_name: The name of the cluster. + :type kusto_pool_name: ~azure.mgmt.synapse.models.KustoPoolCheckNameRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameResult, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.CheckNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'location': self._serialize.url("location", location, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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(kusto_pool_name, 'KustoPoolCheckNameRequest') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Synapse/locations/{location}/kustoPoolCheckNameAvailability'} # type: ignore + + def list_by_workspace( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.KustoPoolListResult" + """List Kusto pools. + + List all Kusto 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: KustoPoolListResult, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.KustoPoolListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.KustoPoolListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_by_workspace.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('KustoPoolListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools'} # type: ignore + + def get( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.KustoPool" + """Gets a Kusto pool. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :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: KustoPool, or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.KustoPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.KustoPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('KustoPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}'} # type: ignore + + def _create_or_update_initial( + self, + workspace_name, # type: str + resource_group_name, # type: str + kusto_pool_name, # type: str + parameters, # type: "_models.KustoPool" + if_match=None, # type: Optional[str] + if_none_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.KustoPool" + cls = kwargs.pop('cls', None) # type: ClsType["_models.KustoPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + if if_none_match is not None: + header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'KustoPool') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('KustoPool', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('KustoPool', 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}/kustoPools/{kustoPoolName}'} # type: ignore + + def begin_create_or_update( + self, + workspace_name, # type: str + resource_group_name, # type: str + kusto_pool_name, # type: str + parameters, # type: "_models.KustoPool" + if_match=None, # type: Optional[str] + if_none_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.KustoPool"] + """Create or update a Kusto pool. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param parameters: The Kusto pool parameters supplied to the CreateOrUpdate operation. + :type parameters: ~azure.mgmt.synapse.models.KustoPool + :param if_match: The ETag of the Kusto Pool. Omit this value to always overwrite the current + Kusto Pool. Specify the last-seen ETag value to prevent accidentally overwriting concurrent + changes. + :type if_match: str + :param if_none_match: Set to '*' to allow a new Kusto Pool to be created, but to prevent + updating an existing Kusto Pool. Other values will result in a 412 Pre-condition Failed + response. + :type if_none_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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 KustoPool or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.KustoPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.KustoPool"] + 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( + workspace_name=workspace_name, + resource_group_name=resource_group_name, + kusto_pool_name=kusto_pool_name, + parameters=parameters, + if_match=if_match, + if_none_match=if_none_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('KustoPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}'} # type: ignore + + def _update_initial( + self, + workspace_name, # type: str + resource_group_name, # type: str + kusto_pool_name, # type: str + parameters, # type: "_models.KustoPoolUpdate" + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_models.KustoPool" + cls = kwargs.pop('cls', None) # type: ClsType["_models.KustoPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'KustoPoolUpdate') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('KustoPool', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('KustoPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}'} # type: ignore + + def begin_update( + self, + workspace_name, # type: str + resource_group_name, # type: str + kusto_pool_name, # type: str + parameters, # type: "_models.KustoPoolUpdate" + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.KustoPool"] + """Update a Kusto Kusto Pool. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param parameters: The Kusto pool parameters supplied to the Update operation. + :type parameters: ~azure.mgmt.synapse.models.KustoPoolUpdate + :param if_match: The ETag of the Kusto Pool. Omit this value to always overwrite the current + Kusto Pool. Specify the last-seen ETag value to prevent accidentally overwriting concurrent + changes. + :type if_match: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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 KustoPool or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.synapse.models.KustoPool] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.KustoPool"] + 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._update_initial( + workspace_name=workspace_name, + resource_group_name=resource_group_name, + kusto_pool_name=kusto_pool_name, + parameters=parameters, + 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('KustoPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}'} # type: ignore + + def _delete_initial( + self, + workspace_name, # type: str + resource_group_name, # type: str + kusto_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}'} # type: ignore + + def begin_delete( + self, + workspace_name, # type: str + resource_group_name, # type: str + kusto_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a Kusto pool. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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( + workspace_name=workspace_name, + resource_group_name=resource_group_name, + kusto_pool_name=kusto_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): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}'} # type: ignore + + def _stop_initial( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._stop_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/stop'} # type: ignore + + def begin_stop( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Stops a Kusto pool. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + resource_group_name=resource_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 = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/stop'} # type: ignore + + def _start_initial( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._start_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/start'} # type: ignore + + def begin_start( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Starts a Kusto pool. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :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 + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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._start_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + resource_group_name=resource_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 = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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}/kustoPools/{kustoPoolName}/start'} # type: ignore + + def list_skus_by_resource( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ListResourceSkusResult"] + """Returns the SKUs available for the provided resource. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ListResourceSkusResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.ListResourceSkusResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListResourceSkusResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_skus_by_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + 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('ListResourceSkusResult', 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.failsafe_deserialize(_models.ErrorResponse, 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_skus_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/skus'} # type: ignore + + def list_language_extensions( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.LanguageExtensionsList"] + """Returns a list of language extensions that can run within KQL queries. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either LanguageExtensionsList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.LanguageExtensionsList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LanguageExtensionsList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_language_extensions.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + 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('LanguageExtensionsList', 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.failsafe_deserialize(_models.ErrorResponse, 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_language_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/listLanguageExtensions'} # type: ignore + + def _add_language_extensions_initial( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + resource_group_name, # type: str + language_extensions_to_add, # type: "_models.LanguageExtensionsList" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._add_language_extensions_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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(language_extensions_to_add, 'LanguageExtensionsList') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _add_language_extensions_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/addLanguageExtensions'} # type: ignore + + def begin_add_language_extensions( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + resource_group_name, # type: str + language_extensions_to_add, # type: "_models.LanguageExtensionsList" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Add a list of language extensions that can run within KQL queries. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param language_extensions_to_add: The language extensions to add. + :type language_extensions_to_add: ~azure.mgmt.synapse.models.LanguageExtensionsList + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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._add_language_extensions_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + resource_group_name=resource_group_name, + language_extensions_to_add=language_extensions_to_add, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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_add_language_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/addLanguageExtensions'} # type: ignore + + def _remove_language_extensions_initial( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + resource_group_name, # type: str + language_extensions_to_remove, # type: "_models.LanguageExtensionsList" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._remove_language_extensions_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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(language_extensions_to_remove, 'LanguageExtensionsList') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _remove_language_extensions_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/removeLanguageExtensions'} # type: ignore + + def begin_remove_language_extensions( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + resource_group_name, # type: str + language_extensions_to_remove, # type: "_models.LanguageExtensionsList" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Remove a list of language extensions that can run within KQL queries. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param language_extensions_to_remove: The language extensions to remove. + :type language_extensions_to_remove: ~azure.mgmt.synapse.models.LanguageExtensionsList + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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._remove_language_extensions_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + resource_group_name=resource_group_name, + language_extensions_to_remove=language_extensions_to_remove, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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_remove_language_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/removeLanguageExtensions'} # type: ignore + + def list_follower_databases( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.FollowerDatabaseListResult"] + """Returns a list of databases that are owned by this Kusto Pool and were followed by another + Kusto Pool. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either FollowerDatabaseListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.synapse.models.FollowerDatabaseListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.FollowerDatabaseListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_follower_databases.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + 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('FollowerDatabaseListResult', 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.failsafe_deserialize(_models.ErrorResponse, 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_follower_databases.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/listFollowerDatabases'} # type: ignore + + def _detach_follower_databases_initial( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + resource_group_name, # type: str + follower_database_to_remove, # type: "_models.FollowerDatabaseDefinition" + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._detach_follower_databases_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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(follower_database_to_remove, 'FollowerDatabaseDefinition') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _detach_follower_databases_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/detachFollowerDatabases'} # type: ignore + + def begin_detach_follower_databases( + self, + workspace_name, # type: str + kusto_pool_name, # type: str + resource_group_name, # type: str + follower_database_to_remove, # type: "_models.FollowerDatabaseDefinition" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Detaches all followers of a database owned by this Kusto Pool. + + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param kusto_pool_name: The name of the Kusto pool. + :type kusto_pool_name: str + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param follower_database_to_remove: The follower databases properties to remove. + :type follower_database_to_remove: ~azure.mgmt.synapse.models.FollowerDatabaseDefinition + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :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._detach_follower_databases_initial( + workspace_name=workspace_name, + kusto_pool_name=kusto_pool_name, + resource_group_name=resource_group_name, + follower_database_to_remove=follower_database_to_remove, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str'), + 'kustoPoolName': self._serialize.url("kusto_pool_name", kusto_pool_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + 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_detach_follower_databases.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/kustoPools/{kustoPoolName}/detachFollowerDatabases'} # type: ignore