diff --git a/sdk/synapse/azure-mgmt-synapse/_meta.json b/sdk/synapse/azure-mgmt-synapse/_meta.json index e371f9c5709c..788e487411a4 100644 --- a/sdk/synapse/azure-mgmt-synapse/_meta.json +++ b/sdk/synapse/azure-mgmt-synapse/_meta.json @@ -1,11 +1,11 @@ { - "commit": "7a54c1a83d14da431c0ae48c4315cba143084bce", + "commit": "3da06fc59377121c44b25fc9aa161c92c464ff29", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ "@autorest/python@6.2.7", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/synapse/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/synapse/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/synapse/resource-manager/readme.md" } \ 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 e3f345df2d7b..7efbeace92af 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 @@ -21,6 +21,7 @@ DataMaskingPoliciesOperations, DataMaskingRulesOperations, ExtendedSqlPoolBlobAuditingPoliciesOperations, + GetOperations, IntegrationRuntimeAuthKeysOperations, IntegrationRuntimeConnectionInfosOperations, IntegrationRuntimeCredentialsOperations, @@ -286,6 +287,8 @@ class SynapseManagementClient: # pylint: disable=client-accepts-api-version-key :ivar integration_runtime_status: IntegrationRuntimeStatusOperations operations :vartype integration_runtime_status: azure.mgmt.synapse.operations.IntegrationRuntimeStatusOperations + :ivar get: GetOperations operations + :vartype get: azure.mgmt.synapse.operations.GetOperations :ivar spark_configuration: SparkConfigurationOperations operations :vartype spark_configuration: azure.mgmt.synapse.operations.SparkConfigurationOperations :ivar spark_configurations: SparkConfigurationsOperations operations @@ -521,6 +524,7 @@ def __init__( self.integration_runtime_status = IntegrationRuntimeStatusOperations( self._client, self._config, self._serialize, self._deserialize ) + self.get = GetOperations(self._client, self._config, self._serialize, self._deserialize) self.spark_configuration = SparkConfigurationOperations( self._client, self._config, self._serialize, self._deserialize ) 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 966803995c04..e5754a47ce68 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.0b6" +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 51d56e465a50..86f595a83a8e 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 @@ -21,6 +21,7 @@ DataMaskingPoliciesOperations, DataMaskingRulesOperations, ExtendedSqlPoolBlobAuditingPoliciesOperations, + GetOperations, IntegrationRuntimeAuthKeysOperations, IntegrationRuntimeConnectionInfosOperations, IntegrationRuntimeCredentialsOperations, @@ -290,6 +291,8 @@ class SynapseManagementClient: # pylint: disable=client-accepts-api-version-key :ivar integration_runtime_status: IntegrationRuntimeStatusOperations operations :vartype integration_runtime_status: azure.mgmt.synapse.aio.operations.IntegrationRuntimeStatusOperations + :ivar get: GetOperations operations + :vartype get: azure.mgmt.synapse.aio.operations.GetOperations :ivar spark_configuration: SparkConfigurationOperations operations :vartype spark_configuration: azure.mgmt.synapse.aio.operations.SparkConfigurationOperations :ivar spark_configurations: SparkConfigurationsOperations operations @@ -525,6 +528,7 @@ def __init__( self.integration_runtime_status = IntegrationRuntimeStatusOperations( self._client, self._config, self._serialize, self._deserialize ) + self.get = GetOperations(self._client, self._config, self._serialize, self._deserialize) self.spark_configuration = SparkConfigurationOperations( self._client, self._config, self._serialize, self._deserialize ) 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 09104f09bc6d..b1719c4e0458 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 @@ -89,6 +89,7 @@ from ._integration_runtime_auth_keys_operations import IntegrationRuntimeAuthKeysOperations from ._integration_runtime_monitoring_data_operations import IntegrationRuntimeMonitoringDataOperations from ._integration_runtime_status_operations import IntegrationRuntimeStatusOperations +from ._get_operations import GetOperations from ._spark_configuration_operations import SparkConfigurationOperations from ._spark_configurations_operations import SparkConfigurationsOperations from ._kusto_operations_operations import KustoOperationsOperations @@ -169,6 +170,7 @@ "IntegrationRuntimeAuthKeysOperations", "IntegrationRuntimeMonitoringDataOperations", "IntegrationRuntimeStatusOperations", + "GetOperations", "SparkConfigurationOperations", "SparkConfigurationsOperations", "KustoOperationsOperations", diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_get_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_get_operations.py new file mode 100644 index 000000000000..7cdd37717d4d --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/aio/operations/_get_operations.py @@ -0,0 +1,217 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._get_operations import ( + build_integration_runtime_start_request, + build_integration_runtime_stop_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class GetOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.synapse.aio.SynapseManagementClient`'s + :attr:`get` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def integration_runtime_start( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + integration_runtime_operation_id: str, + **kwargs: Any + ) -> _models.IntegrationRuntimeOperationStatus: + """Get integration runtime start operation status. + + Get an integration runtime start operation status. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param integration_runtime_name: Integration runtime name. Required. + :type integration_runtime_name: str + :param integration_runtime_operation_id: Integration runtime Operation Id. Required. + :type integration_runtime_operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IntegrationRuntimeOperationStatus or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeOperationStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.IntegrationRuntimeOperationStatus] = kwargs.pop("cls", None) + + request = build_integration_runtime_start_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + integration_runtime_operation_id=integration_runtime_operation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.integration_runtime_start.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IntegrationRuntimeOperationStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + integration_runtime_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/start/operationstatuses/{integrationRuntimeOperationId}" + } + + @distributed_trace_async + async def integration_runtime_stop( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + integration_runtime_operation_id: str, + **kwargs: Any + ) -> _models.IntegrationRuntimeStopOperationStatus: + """Get integration runtime stop operation status. + + Get an integration runtime stop operation status. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param integration_runtime_name: Integration runtime name. Required. + :type integration_runtime_name: str + :param integration_runtime_operation_id: Integration runtime Operation Id. Required. + :type integration_runtime_operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IntegrationRuntimeStopOperationStatus or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeStopOperationStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.IntegrationRuntimeStopOperationStatus] = kwargs.pop("cls", None) + + request = build_integration_runtime_stop_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + integration_runtime_operation_id=integration_runtime_operation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.integration_runtime_stop.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IntegrationRuntimeStopOperationStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + integration_runtime_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/stop/operationstatuses/{integrationRuntimeOperationId}" + } 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 7747a72fbbfa..8baae65e261f 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 @@ -86,6 +86,7 @@ from ._models_py3 import IntegrationRuntimeMonitoringData from ._models_py3 import IntegrationRuntimeNodeIpAddress from ._models_py3 import IntegrationRuntimeNodeMonitoringData +from ._models_py3 import IntegrationRuntimeOperationStatus from ._models_py3 import IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint from ._models_py3 import IntegrationRuntimeOutboundNetworkDependenciesEndpoint from ._models_py3 import IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails @@ -96,6 +97,7 @@ from ._models_py3 import IntegrationRuntimeSsisProperties from ._models_py3 import IntegrationRuntimeStatus from ._models_py3 import IntegrationRuntimeStatusResponse +from ._models_py3 import IntegrationRuntimeStopOperationStatus from ._models_py3 import IntegrationRuntimeVNetProperties from ._models_py3 import IotHubDataConnection from ._models_py3 import IpFirewallRuleInfo @@ -346,6 +348,7 @@ from ._synapse_management_client_enums import VulnerabilityAssessmentScanState from ._synapse_management_client_enums import VulnerabilityAssessmentScanTriggerType from ._synapse_management_client_enums import WorkspacePublicNetworkAccess +from ._synapse_management_client_enums import WorkspaceStatus from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk @@ -431,6 +434,7 @@ "IntegrationRuntimeMonitoringData", "IntegrationRuntimeNodeIpAddress", "IntegrationRuntimeNodeMonitoringData", + "IntegrationRuntimeOperationStatus", "IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint", "IntegrationRuntimeOutboundNetworkDependenciesEndpoint", "IntegrationRuntimeOutboundNetworkDependenciesEndpointDetails", @@ -441,6 +445,7 @@ "IntegrationRuntimeSsisProperties", "IntegrationRuntimeStatus", "IntegrationRuntimeStatusResponse", + "IntegrationRuntimeStopOperationStatus", "IntegrationRuntimeVNetProperties", "IotHubDataConnection", "IpFirewallRuleInfo", @@ -690,6 +695,7 @@ "VulnerabilityAssessmentScanState", "VulnerabilityAssessmentScanTriggerType", "WorkspacePublicNetworkAccess", + "WorkspaceStatus", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() 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 ae9ddf74f015..439463482d13 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 @@ -4331,6 +4331,54 @@ def __init__(self, *, additional_properties: Optional[Dict[str, JSON]] = None, * self.received_bytes = None +class IntegrationRuntimeOperationStatus(_serialization.Model): + """Integration Runtime Operation Status Properties. + + :ivar status: status of Start Integrationruntimes. Known values are: "InProgress", "Succeeded", + and "Failed". + :vartype status: str or ~azure.mgmt.synapse.models.WorkspaceStatus + :ivar name: The operation name. + :vartype name: str + :ivar properties: The operation properties. + :vartype properties: JSON + :ivar error: The operation error message. + :vartype error: str + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "properties": {"key": "properties", "type": "object"}, + "error": {"key": "error", "type": "str"}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "_models.WorkspaceStatus"]] = None, + name: Optional[str] = None, + properties: Optional[JSON] = None, + error: Optional[str] = None, + **kwargs + ): + """ + :keyword status: status of Start Integrationruntimes. Known values are: "InProgress", + "Succeeded", and "Failed". + :paramtype status: str or ~azure.mgmt.synapse.models.WorkspaceStatus + :keyword name: The operation name. + :paramtype name: str + :keyword properties: The operation properties. + :paramtype properties: JSON + :keyword error: The operation error message. + :paramtype error: str + """ + super().__init__(**kwargs) + self.status = status + self.name = name + self.properties = properties + self.error = error + + class IntegrationRuntimeOutboundNetworkDependenciesCategoryEndpoint(_serialization.Model): """Azure-SSIS integration runtime outbound network dependency endpoints for one category. @@ -4807,6 +4855,54 @@ def __init__(self, **kwargs): self.state = None +class IntegrationRuntimeStopOperationStatus(_serialization.Model): + """Integration Runtime Operation Status Properties. + + :ivar status: status of Start Integrationruntimes. Known values are: "InProgress", "Succeeded", + and "Failed". + :vartype status: str or ~azure.mgmt.synapse.models.WorkspaceStatus + :ivar name: The operation name. + :vartype name: str + :ivar properties: The operation properties. + :vartype properties: JSON + :ivar error: The operation error message. + :vartype error: str + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "properties": {"key": "properties", "type": "object"}, + "error": {"key": "error", "type": "str"}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "_models.WorkspaceStatus"]] = None, + name: Optional[str] = None, + properties: Optional[JSON] = None, + error: Optional[str] = None, + **kwargs + ): + """ + :keyword status: status of Start Integrationruntimes. Known values are: "InProgress", + "Succeeded", and "Failed". + :paramtype status: str or ~azure.mgmt.synapse.models.WorkspaceStatus + :keyword name: The operation name. + :paramtype name: str + :keyword properties: The operation properties. + :paramtype properties: JSON + :keyword error: The operation error message. + :paramtype error: str + """ + super().__init__(**kwargs) + self.status = status + self.name = name + self.properties = properties + self.error = error + + class IntegrationRuntimeVNetProperties(_serialization.Model): """VNet properties for managed integration runtime. 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 0f549cb33d61..7377b4791d10 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 @@ -779,3 +779,11 @@ class WorkspacePublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta) ENABLED = "Enabled" DISABLED = "Disabled" + + +class WorkspaceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """status of Start Integrationruntimes.""" + + IN_PROGRESS = "InProgress" + SUCCEEDED = "Succeeded" + FAILED = "Failed" 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 09104f09bc6d..b1719c4e0458 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 @@ -89,6 +89,7 @@ from ._integration_runtime_auth_keys_operations import IntegrationRuntimeAuthKeysOperations from ._integration_runtime_monitoring_data_operations import IntegrationRuntimeMonitoringDataOperations from ._integration_runtime_status_operations import IntegrationRuntimeStatusOperations +from ._get_operations import GetOperations from ._spark_configuration_operations import SparkConfigurationOperations from ._spark_configurations_operations import SparkConfigurationsOperations from ._kusto_operations_operations import KustoOperationsOperations @@ -169,6 +170,7 @@ "IntegrationRuntimeAuthKeysOperations", "IntegrationRuntimeMonitoringDataOperations", "IntegrationRuntimeStatusOperations", + "GetOperations", "SparkConfigurationOperations", "SparkConfigurationsOperations", "KustoOperationsOperations", diff --git a/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_get_operations.py b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_get_operations.py new file mode 100644 index 000000000000..85299ae00f74 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/azure/mgmt/synapse/operations/_get_operations.py @@ -0,0 +1,305 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_integration_runtime_start_request( + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + integration_runtime_operation_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/start/operationstatuses/{integrationRuntimeOperationId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, "str"), + "integrationRuntimeOperationId": _SERIALIZER.url( + "integration_runtime_operation_id", integration_runtime_operation_id, "str" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_integration_runtime_stop_request( + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + integration_runtime_operation_id: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/stop/operationstatuses/{integrationRuntimeOperationId}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, "str"), + "integrationRuntimeName": _SERIALIZER.url("integration_runtime_name", integration_runtime_name, "str"), + "integrationRuntimeOperationId": _SERIALIZER.url( + "integration_runtime_operation_id", integration_runtime_operation_id, "str" + ), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class GetOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.synapse.SynapseManagementClient`'s + :attr:`get` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def integration_runtime_start( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + integration_runtime_operation_id: str, + **kwargs: Any + ) -> _models.IntegrationRuntimeOperationStatus: + """Get integration runtime start operation status. + + Get an integration runtime start operation status. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param integration_runtime_name: Integration runtime name. Required. + :type integration_runtime_name: str + :param integration_runtime_operation_id: Integration runtime Operation Id. Required. + :type integration_runtime_operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IntegrationRuntimeOperationStatus or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeOperationStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.IntegrationRuntimeOperationStatus] = kwargs.pop("cls", None) + + request = build_integration_runtime_start_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + integration_runtime_operation_id=integration_runtime_operation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.integration_runtime_start.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IntegrationRuntimeOperationStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + integration_runtime_start.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/start/operationstatuses/{integrationRuntimeOperationId}" + } + + @distributed_trace + def integration_runtime_stop( + self, + resource_group_name: str, + workspace_name: str, + integration_runtime_name: str, + integration_runtime_operation_id: str, + **kwargs: Any + ) -> _models.IntegrationRuntimeStopOperationStatus: + """Get integration runtime stop operation status. + + Get an integration runtime stop operation status. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param workspace_name: The name of the workspace. Required. + :type workspace_name: str + :param integration_runtime_name: Integration runtime name. Required. + :type integration_runtime_name: str + :param integration_runtime_operation_id: Integration runtime Operation Id. Required. + :type integration_runtime_operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IntegrationRuntimeStopOperationStatus or the result of cls(response) + :rtype: ~azure.mgmt.synapse.models.IntegrationRuntimeStopOperationStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2021-06-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2021-06-01-preview") + ) + cls: ClsType[_models.IntegrationRuntimeStopOperationStatus] = kwargs.pop("cls", None) + + request = build_integration_runtime_stop_request( + resource_group_name=resource_group_name, + workspace_name=workspace_name, + integration_runtime_name=integration_runtime_name, + integration_runtime_operation_id=integration_runtime_operation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.integration_runtime_stop.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("IntegrationRuntimeStopOperationStatus", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + integration_runtime_stop.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Synapse/workspaces/{workspaceName}/integrationRuntimes/{integrationRuntimeName}/stop/operationstatuses/{integrationRuntimeOperationId}" + } diff --git a/sdk/synapse/azure-mgmt-synapse/generated_samples/integration_runtimes_start_operation_status.py b/sdk/synapse/azure-mgmt-synapse/generated_samples/integration_runtimes_start_operation_status.py new file mode 100644 index 000000000000..251a803300aa --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/generated_samples/integration_runtimes_start_operation_status.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.synapse import SynapseManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-synapse +# USAGE + python integration_runtimes_start_operation_status.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SynapseManagementClient( + credential=DefaultAzureCredential(), + subscription_id="2d03866b-587b-4e1f-a2fe-0a55958c655e", + ) + + response = client.get.integration_runtime_start( + resource_group_name="drage-felles-prod-rg", + workspace_name="felles-prod-synapse-workspace", + integration_runtime_name="SSIS-intergrationRuntime-Drage", + integration_runtime_operation_id="5752dcdf918e4aecb941245ddf6ebb83", + ) + print(response) + + +# x-ms-original-file: specification/synapse/resource-manager/Microsoft.Synapse/preview/2021-06-01-preview/examples/IntegrationRuntimes_Start_OperationStatus.json +if __name__ == "__main__": + main() diff --git a/sdk/synapse/azure-mgmt-synapse/generated_samples/integration_runtimes_stop_operation_status.py b/sdk/synapse/azure-mgmt-synapse/generated_samples/integration_runtimes_stop_operation_status.py new file mode 100644 index 000000000000..940e467ccec7 --- /dev/null +++ b/sdk/synapse/azure-mgmt-synapse/generated_samples/integration_runtimes_stop_operation_status.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.synapse import SynapseManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-synapse +# USAGE + python integration_runtimes_stop_operation_status.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SynapseManagementClient( + credential=DefaultAzureCredential(), + subscription_id="2d03866b-587b-4e1f-a2fe-0a55958c655e", + ) + + response = client.get.integration_runtime_stop( + resource_group_name="drage-felles-prod-rg", + workspace_name="felles-prod-synapse-workspace", + integration_runtime_name="SSIS-intergrationRuntime-Drage", + integration_runtime_operation_id="5752dcdf918e4aecb941245ddf6ebb83", + ) + print(response) + + +# x-ms-original-file: specification/synapse/resource-manager/Microsoft.Synapse/preview/2021-06-01-preview/examples/IntegrationRuntimes_Stop_OperationStatus.json +if __name__ == "__main__": + main()