From 72a71034a8fa845760fcafb1d6e02aaad6b17fcf Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 23 Jan 2025 06:52:10 +0000 Subject: [PATCH] CodeGen from PR 3590 in test-repo-billy/azure-rest-api-specs Merge bba679c7e712e86f7bf3c1aee4c0f00a99b1efde into 303e50ce42c8416bbd1bda5af623498501a5ada5 --- .../azure-mgmt-datafactory/_meta.json | 8 +- .../_data_factory_management_client.py | 10 +- .../azure/mgmt/datafactory/_serialization.py | 16 +- .../azure/mgmt/datafactory/_version.py | 2 +- .../aio/_data_factory_management_client.py | 10 +- .../datafactory/aio/operations/__init__.py | 6 +- .../aio/operations/_factories_operations.py | 185 -------------- .../datafactory/aio/operations/_operations.py | 128 ---------- .../mgmt/datafactory/models/_models_py3.py | 66 ++--- .../mgmt/datafactory/operations/__init__.py | 6 +- .../operations/_factories_operations.py | 238 ------------------ .../datafactory/operations/_operations.py | 150 ----------- .../factories_configure_factory_repo.py | 54 ---- .../generated_samples/factories_list.py | 40 --- .../generated_samples/operations_list.py | 40 --- ...factory_management_factories_operations.py | 22 -- ...y_management_factories_operations_async.py | 22 -- .../azure-mgmt-datafactory/setup.py | 8 +- 18 files changed, 61 insertions(+), 950 deletions(-) delete mode 100644 sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_operations.py delete mode 100644 sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_operations.py delete mode 100644 sdk/datafactory/azure-mgmt-datafactory/generated_samples/factories_configure_factory_repo.py delete mode 100644 sdk/datafactory/azure-mgmt-datafactory/generated_samples/factories_list.py delete mode 100644 sdk/datafactory/azure-mgmt-datafactory/generated_samples/operations_list.py diff --git a/sdk/datafactory/azure-mgmt-datafactory/_meta.json b/sdk/datafactory/azure-mgmt-datafactory/_meta.json index bf776bd01373..acf8acd25444 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/_meta.json +++ b/sdk/datafactory/azure-mgmt-datafactory/_meta.json @@ -1,11 +1,11 @@ { - "commit": "f06cffbda682a8cd225a8b16bc6f000d26d01612", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "commit": "8430663f244cc1158781ee2ebb451a22d0e48161", + "repository_url": "https://github.com/test-repo-billy/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.26.4", + "@autorest/python@6.27.4", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/datafactory/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.26.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/datafactory/resource-manager/readme.md --generate-sample=True --generate-test=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.27.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/datafactory/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_data_factory_management_client.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_data_factory_management_client.py index b8f83bfb18b9..4d147194c205 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_data_factory_management_client.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_data_factory_management_client.py @@ -34,7 +34,6 @@ LinkedServicesOperations, ManagedPrivateEndpointsOperations, ManagedVirtualNetworksOperations, - Operations, PipelineRunsOperations, PipelinesOperations, PrivateEndPointConnectionsOperations, @@ -52,12 +51,10 @@ class DataFactoryManagementClient: # pylint: disable=too-many-instance-attribut """The Azure Data Factory V2 management API provides a RESTful set of web services that interact with Azure Data Factory V2 services. - :ivar operations: Operations operations - :vartype operations: azure.mgmt.datafactory.operations.Operations - :ivar factories: FactoriesOperations operations - :vartype factories: azure.mgmt.datafactory.operations.FactoriesOperations :ivar exposure_control: ExposureControlOperations operations :vartype exposure_control: azure.mgmt.datafactory.operations.ExposureControlOperations + :ivar factories: FactoriesOperations operations + :vartype factories: azure.mgmt.datafactory.operations.FactoriesOperations :ivar integration_runtimes: IntegrationRuntimesOperations operations :vartype integration_runtimes: azure.mgmt.datafactory.operations.IntegrationRuntimesOperations :ivar integration_runtime_object_metadata: IntegrationRuntimeObjectMetadataOperations @@ -155,11 +152,10 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.factories = FactoriesOperations(self._client, self._config, self._serialize, self._deserialize) self.exposure_control = ExposureControlOperations( self._client, self._config, self._serialize, self._deserialize ) + self.factories = FactoriesOperations(self._client, self._config, self._serialize, self._deserialize) self.integration_runtimes = IntegrationRuntimesOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_serialization.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_serialization.py index ce17d1798ce7..b24ab2885450 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_serialization.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_serialization.py @@ -310,7 +310,7 @@ def _create_xml_node(tag, prefix=None, ns=None): return ET.Element(tag) -class Model(object): +class Model: """Mixin for all client request body/response body models to support serialization and deserialization. """ @@ -563,7 +563,7 @@ def _decode_attribute_map_key(key): return key.replace("\\.", ".") -class Serializer(object): # pylint: disable=too-many-public-methods +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -1441,7 +1441,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1683,17 +1683,21 @@ def _instantiate_model(self, response, attrs, additional_properties=None): subtype = getattr(response, "_subtype_map", {}) try: readonly = [ - k for k, v in response._validation.items() if v.get("readonly") # pylint: disable=protected-access + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") ] const = [ - k for k, v in response._validation.items() if v.get("constant") # pylint: disable=protected-access + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_version.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_version.py index f89ed38360ab..c47f66669f1b 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_version.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.1.0" +VERSION = "1.0.0" diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/_data_factory_management_client.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/_data_factory_management_client.py index 3bfae1c79ed5..fc240e321773 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/_data_factory_management_client.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/_data_factory_management_client.py @@ -34,7 +34,6 @@ LinkedServicesOperations, ManagedPrivateEndpointsOperations, ManagedVirtualNetworksOperations, - Operations, PipelineRunsOperations, PipelinesOperations, PrivateEndPointConnectionsOperations, @@ -52,12 +51,10 @@ class DataFactoryManagementClient: # pylint: disable=too-many-instance-attribut """The Azure Data Factory V2 management API provides a RESTful set of web services that interact with Azure Data Factory V2 services. - :ivar operations: Operations operations - :vartype operations: azure.mgmt.datafactory.aio.operations.Operations - :ivar factories: FactoriesOperations operations - :vartype factories: azure.mgmt.datafactory.aio.operations.FactoriesOperations :ivar exposure_control: ExposureControlOperations operations :vartype exposure_control: azure.mgmt.datafactory.aio.operations.ExposureControlOperations + :ivar factories: FactoriesOperations operations + :vartype factories: azure.mgmt.datafactory.aio.operations.FactoriesOperations :ivar integration_runtimes: IntegrationRuntimesOperations operations :vartype integration_runtimes: azure.mgmt.datafactory.aio.operations.IntegrationRuntimesOperations @@ -156,11 +153,10 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.factories = FactoriesOperations(self._client, self._config, self._serialize, self._deserialize) self.exposure_control = ExposureControlOperations( self._client, self._config, self._serialize, self._deserialize ) + self.factories = FactoriesOperations(self._client, self._config, self._serialize, self._deserialize) self.integration_runtimes = IntegrationRuntimesOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/__init__.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/__init__.py index f42af8783eb3..6d2800079333 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/__init__.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/__init__.py @@ -12,9 +12,8 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._operations import Operations # type: ignore -from ._factories_operations import FactoriesOperations # type: ignore from ._exposure_control_operations import ExposureControlOperations # type: ignore +from ._factories_operations import FactoriesOperations # type: ignore from ._integration_runtimes_operations import IntegrationRuntimesOperations # type: ignore from ._integration_runtime_object_metadata_operations import IntegrationRuntimeObjectMetadataOperations # type: ignore from ._integration_runtime_nodes_operations import IntegrationRuntimeNodesOperations # type: ignore @@ -41,9 +40,8 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "Operations", - "FactoriesOperations", "ExposureControlOperations", + "FactoriesOperations", "IntegrationRuntimesOperations", "IntegrationRuntimeObjectMetadataOperations", "IntegrationRuntimeNodesOperations", diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_factories_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_factories_operations.py index 392de8b7be89..dfb69c34f3f0 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_factories_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_factories_operations.py @@ -28,14 +28,12 @@ from ... import models as _models from ...operations._factories_operations import ( - build_configure_factory_repo_request, build_create_or_update_request, build_delete_request, build_get_data_plane_access_request, build_get_git_hub_access_token_request, build_get_request, build_list_by_resource_group_request, - build_list_request, build_update_request, ) @@ -66,189 +64,6 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Factory"]: - """Lists factories under the specified subscription. - - :return: An iterator like instance of either Factory or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datafactory.models.Factory] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.FactoryListResponse] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FactoryListResponse", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @overload - async def configure_factory_repo( - self, - location_id: str, - factory_repo_update: _models.FactoryRepoUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Factory: - """Updates a factory's repo information. - - :param location_id: The location identifier. Required. - :type location_id: str - :param factory_repo_update: Update factory repo request definition. Required. - :type factory_repo_update: ~azure.mgmt.datafactory.models.FactoryRepoUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Factory or the result of cls(response) - :rtype: ~azure.mgmt.datafactory.models.Factory - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def configure_factory_repo( - self, location_id: str, factory_repo_update: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Factory: - """Updates a factory's repo information. - - :param location_id: The location identifier. Required. - :type location_id: str - :param factory_repo_update: Update factory repo request definition. Required. - :type factory_repo_update: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Factory or the result of cls(response) - :rtype: ~azure.mgmt.datafactory.models.Factory - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def configure_factory_repo( - self, location_id: str, factory_repo_update: Union[_models.FactoryRepoUpdate, IO[bytes]], **kwargs: Any - ) -> _models.Factory: - """Updates a factory's repo information. - - :param location_id: The location identifier. Required. - :type location_id: str - :param factory_repo_update: Update factory repo request definition. Is either a - FactoryRepoUpdate type or a IO[bytes] type. Required. - :type factory_repo_update: ~azure.mgmt.datafactory.models.FactoryRepoUpdate or IO[bytes] - :return: Factory or the result of cls(response) - :rtype: ~azure.mgmt.datafactory.models.Factory - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Factory] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(factory_repo_update, (IOBase, bytes)): - _content = factory_repo_update - else: - _json = self._serialize.body(factory_repo_update, "FactoryRepoUpdate") - - _request = build_configure_factory_repo_request( - location_id=location_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Factory", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Factory"]: """Lists factories. diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_operations.py deleted file mode 100644 index a2b09223e1b9..000000000000 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/aio/operations/_operations.py +++ /dev/null @@ -1,128 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, 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 ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.datafactory.aio.DataFactoryManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: - """Lists the available Azure Data Factory API operations. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datafactory.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationListResponse] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResponse", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_models_py3.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_models_py3.py index c93dd92dc173..ceac6ca7f86b 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_models_py3.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/models/_models_py3.py @@ -5587,9 +5587,9 @@ class AvroWriteSettings(FormatWriteSettings): :ivar max_rows_per_file: Limit the written file's row count to be smaller than or equal to the specified count. Type: integer (or Expression with resultType integer). :vartype max_rows_per_file: JSON - :ivar file_name_prefix: Specifies the file name pattern - :code:``_:code:``.:code:`` when copy from non-file - based store without partitionOptions. Type: string (or Expression with resultType string). + :ivar file_name_prefix: Specifies the file name pattern :code:``_\\ + :code:``.\\ :code:`` when copy from non-file based store without + partitionOptions. Type: string (or Expression with resultType string). :vartype file_name_prefix: JSON """ @@ -5627,9 +5627,9 @@ def __init__( :keyword max_rows_per_file: Limit the written file's row count to be smaller than or equal to the specified count. Type: integer (or Expression with resultType integer). :paramtype max_rows_per_file: JSON - :keyword file_name_prefix: Specifies the file name pattern - :code:``_:code:``.:code:`` when copy from non-file - based store without partitionOptions. Type: string (or Expression with resultType string). + :keyword file_name_prefix: Specifies the file name pattern :code:``_\\ + :code:``.\\ :code:`` when copy from non-file based store without + partitionOptions. Type: string (or Expression with resultType string). :paramtype file_name_prefix: JSON """ super().__init__(additional_properties=additional_properties, **kwargs) @@ -8575,8 +8575,8 @@ class AzureDataExplorerLinkedService(LinkedService): :ivar annotations: List of tags that can be used for describing the linked service. :vartype annotations: list[JSON] :ivar endpoint: The endpoint of Azure Data Explorer (the engine's endpoint). URL will be in the - format https://:code:``.:code:``.kusto.windows.net. Type: string (or - Expression with resultType string). Required. + format https://\\ :code:``.\\ :code:``.kusto.windows.net. Type: string + (or Expression with resultType string). Required. :vartype endpoint: JSON :ivar service_principal_id: The ID of the service principal used to authenticate against Azure Data Explorer. Type: string (or Expression with resultType string). @@ -8648,8 +8648,8 @@ def __init__( :keyword annotations: List of tags that can be used for describing the linked service. :paramtype annotations: list[JSON] :keyword endpoint: The endpoint of Azure Data Explorer (the engine's endpoint). URL will be in - the format https://:code:``.:code:``.kusto.windows.net. Type: string - (or Expression with resultType string). Required. + the format https://\\ :code:``.\\ :code:``.kusto.windows.net. Type: + string (or Expression with resultType string). Required. :paramtype endpoint: JSON :keyword service_principal_id: The ID of the service principal used to authenticate against Azure Data Explorer. Type: string (or Expression with resultType string). @@ -10566,7 +10566,7 @@ class AzureFunctionLinkedService(LinkedService): :ivar annotations: List of tags that can be used for describing the linked service. :vartype annotations: list[JSON] :ivar function_app_url: The endpoint of the Azure Function App. URL will be in the format - https://:code:``.azurewebsites.net. Type: string (or Expression with resultType + https://\\ :code:``.azurewebsites.net. Type: string (or Expression with resultType string). Required. :vartype function_app_url: JSON :ivar function_key: Function or Host key for Azure Function App. @@ -10637,7 +10637,7 @@ def __init__( :keyword annotations: List of tags that can be used for describing the linked service. :paramtype annotations: list[JSON] :keyword function_app_url: The endpoint of the Azure Function App. URL will be in the format - https://:code:``.azurewebsites.net. Type: string (or Expression with resultType + https://\\ :code:``.azurewebsites.net. Type: string (or Expression with resultType string). Required. :paramtype function_app_url: JSON :keyword function_key: Function or Host key for Azure Function App. @@ -16485,8 +16485,8 @@ class AzureSynapseArtifactsLinkedService(LinkedService): :vartype parameters: dict[str, ~azure.mgmt.datafactory.models.ParameterSpecification] :ivar annotations: List of tags that can be used for describing the linked service. :vartype annotations: list[JSON] - :ivar endpoint: https://:code:``.dev.azuresynapse.net, Azure Synapse Analytics - workspace URL. Type: string (or Expression with resultType string). Required. + :ivar endpoint: https://\\ :code:``.dev.azuresynapse.net, Azure Synapse + Analytics workspace URL. Type: string (or Expression with resultType string). Required. :vartype endpoint: JSON :ivar authentication: Required to specify MSI, if using system assigned managed identity as authentication method. Type: string (or Expression with resultType string). @@ -16543,7 +16543,7 @@ def __init__( :paramtype parameters: dict[str, ~azure.mgmt.datafactory.models.ParameterSpecification] :keyword annotations: List of tags that can be used for describing the linked service. :paramtype annotations: list[JSON] - :keyword endpoint: https://:code:``.dev.azuresynapse.net, Azure Synapse + :keyword endpoint: https://\\ :code:``.dev.azuresynapse.net, Azure Synapse Analytics workspace URL. Type: string (or Expression with resultType string). Required. :paramtype endpoint: JSON :keyword authentication: Required to specify MSI, if using system assigned managed identity as @@ -25271,9 +25271,9 @@ class DelimitedTextWriteSettings(FormatWriteSettings): :ivar max_rows_per_file: Limit the written file's row count to be smaller than or equal to the specified count. Type: integer (or Expression with resultType integer). :vartype max_rows_per_file: JSON - :ivar file_name_prefix: Specifies the file name pattern - :code:``_:code:``.:code:`` when copy from non-file - based store without partitionOptions. Type: string (or Expression with resultType string). + :ivar file_name_prefix: Specifies the file name pattern :code:``_\\ + :code:``.\\ :code:`` when copy from non-file based store without + partitionOptions. Type: string (or Expression with resultType string). :vartype file_name_prefix: JSON """ @@ -25314,9 +25314,9 @@ def __init__( :keyword max_rows_per_file: Limit the written file's row count to be smaller than or equal to the specified count. Type: integer (or Expression with resultType integer). :paramtype max_rows_per_file: JSON - :keyword file_name_prefix: Specifies the file name pattern - :code:``_:code:``.:code:`` when copy from non-file - based store without partitionOptions. Type: string (or Expression with resultType string). + :keyword file_name_prefix: Specifies the file name pattern :code:``_\\ + :code:``.\\ :code:`` when copy from non-file based store without + partitionOptions. Type: string (or Expression with resultType string). :paramtype file_name_prefix: JSON """ super().__init__(additional_properties=additional_properties, **kwargs) @@ -50084,9 +50084,9 @@ class OrcWriteSettings(FormatWriteSettings): :ivar max_rows_per_file: Limit the written file's row count to be smaller than or equal to the specified count. Type: integer (or Expression with resultType integer). :vartype max_rows_per_file: JSON - :ivar file_name_prefix: Specifies the file name pattern - :code:``_:code:``.:code:`` when copy from non-file - based store without partitionOptions. Type: string (or Expression with resultType string). + :ivar file_name_prefix: Specifies the file name pattern :code:``_\\ + :code:``.\\ :code:`` when copy from non-file based store without + partitionOptions. Type: string (or Expression with resultType string). :vartype file_name_prefix: JSON """ @@ -50116,9 +50116,9 @@ def __init__( :keyword max_rows_per_file: Limit the written file's row count to be smaller than or equal to the specified count. Type: integer (or Expression with resultType integer). :paramtype max_rows_per_file: JSON - :keyword file_name_prefix: Specifies the file name pattern - :code:``_:code:``.:code:`` when copy from non-file - based store without partitionOptions. Type: string (or Expression with resultType string). + :keyword file_name_prefix: Specifies the file name pattern :code:``_\\ + :code:``.\\ :code:`` when copy from non-file based store without + partitionOptions. Type: string (or Expression with resultType string). :paramtype file_name_prefix: JSON """ super().__init__(additional_properties=additional_properties, **kwargs) @@ -50638,9 +50638,9 @@ class ParquetWriteSettings(FormatWriteSettings): :ivar max_rows_per_file: Limit the written file's row count to be smaller than or equal to the specified count. Type: integer (or Expression with resultType integer). :vartype max_rows_per_file: JSON - :ivar file_name_prefix: Specifies the file name pattern - :code:``_:code:``.:code:`` when copy from non-file - based store without partitionOptions. Type: string (or Expression with resultType string). + :ivar file_name_prefix: Specifies the file name pattern :code:``_\\ + :code:``.\\ :code:`` when copy from non-file based store without + partitionOptions. Type: string (or Expression with resultType string). :vartype file_name_prefix: JSON """ @@ -50670,9 +50670,9 @@ def __init__( :keyword max_rows_per_file: Limit the written file's row count to be smaller than or equal to the specified count. Type: integer (or Expression with resultType integer). :paramtype max_rows_per_file: JSON - :keyword file_name_prefix: Specifies the file name pattern - :code:``_:code:``.:code:`` when copy from non-file - based store without partitionOptions. Type: string (or Expression with resultType string). + :keyword file_name_prefix: Specifies the file name pattern :code:``_\\ + :code:``.\\ :code:`` when copy from non-file based store without + partitionOptions. Type: string (or Expression with resultType string). :paramtype file_name_prefix: JSON """ super().__init__(additional_properties=additional_properties, **kwargs) diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/__init__.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/__init__.py index f42af8783eb3..6d2800079333 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/__init__.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/__init__.py @@ -12,9 +12,8 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._operations import Operations # type: ignore -from ._factories_operations import FactoriesOperations # type: ignore from ._exposure_control_operations import ExposureControlOperations # type: ignore +from ._factories_operations import FactoriesOperations # type: ignore from ._integration_runtimes_operations import IntegrationRuntimesOperations # type: ignore from ._integration_runtime_object_metadata_operations import IntegrationRuntimeObjectMetadataOperations # type: ignore from ._integration_runtime_nodes_operations import IntegrationRuntimeNodesOperations # type: ignore @@ -41,9 +40,8 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "Operations", - "FactoriesOperations", "ExposureControlOperations", + "FactoriesOperations", "IntegrationRuntimesOperations", "IntegrationRuntimeObjectMetadataOperations", "IntegrationRuntimeNodesOperations", diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_factories_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_factories_operations.py index 6656f49415bd..d337671d6bd1 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_factories_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_factories_operations.py @@ -40,61 +40,6 @@ _SERIALIZER.client_side_validation = False -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DataFactory/factories") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**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_configure_factory_repo_request(location_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: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.DataFactory/locations/{locationId}/configureFactoryRepo", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "locationId": _SERIALIZER.url("location_id", location_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -405,189 +350,6 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Factory"]: - """Lists factories under the specified subscription. - - :return: An iterator like instance of either Factory or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.datafactory.models.Factory] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.FactoryListResponse] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FactoryListResponse", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @overload - def configure_factory_repo( - self, - location_id: str, - factory_repo_update: _models.FactoryRepoUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Factory: - """Updates a factory's repo information. - - :param location_id: The location identifier. Required. - :type location_id: str - :param factory_repo_update: Update factory repo request definition. Required. - :type factory_repo_update: ~azure.mgmt.datafactory.models.FactoryRepoUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Factory or the result of cls(response) - :rtype: ~azure.mgmt.datafactory.models.Factory - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def configure_factory_repo( - self, location_id: str, factory_repo_update: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> _models.Factory: - """Updates a factory's repo information. - - :param location_id: The location identifier. Required. - :type location_id: str - :param factory_repo_update: Update factory repo request definition. Required. - :type factory_repo_update: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Factory or the result of cls(response) - :rtype: ~azure.mgmt.datafactory.models.Factory - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def configure_factory_repo( - self, location_id: str, factory_repo_update: Union[_models.FactoryRepoUpdate, IO[bytes]], **kwargs: Any - ) -> _models.Factory: - """Updates a factory's repo information. - - :param location_id: The location identifier. Required. - :type location_id: str - :param factory_repo_update: Update factory repo request definition. Is either a - FactoryRepoUpdate type or a IO[bytes] type. Required. - :type factory_repo_update: ~azure.mgmt.datafactory.models.FactoryRepoUpdate or IO[bytes] - :return: Factory or the result of cls(response) - :rtype: ~azure.mgmt.datafactory.models.Factory - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Factory] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(factory_repo_update, (IOBase, bytes)): - _content = factory_repo_update - else: - _json = self._serialize.body(factory_repo_update, "FactoryRepoUpdate") - - _request = build_configure_factory_repo_request( - location_id=location_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Factory", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Factory"]: """Lists factories. diff --git a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_operations.py b/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_operations.py deleted file mode 100644 index 179e968805e5..000000000000 --- a/sdk/datafactory/azure-mgmt-datafactory/azure/mgmt/datafactory/operations/_operations.py +++ /dev/null @@ -1,150 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -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 - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2018-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.DataFactory/operations") - - # 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 Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.datafactory.DataFactoryManagementClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: - """Lists the available Azure Data Factory API operations. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.datafactory.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationListResponse] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResponse", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_samples/factories_configure_factory_repo.py b/sdk/datafactory/azure-mgmt-datafactory/generated_samples/factories_configure_factory_repo.py deleted file mode 100644 index 594252a37e67..000000000000 --- a/sdk/datafactory/azure-mgmt-datafactory/generated_samples/factories_configure_factory_repo.py +++ /dev/null @@ -1,54 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.datafactory import DataFactoryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-datafactory -# USAGE - python factories_configure_factory_repo.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 = DataFactoryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="12345678-1234-1234-1234-12345678abc", - ) - - response = client.factories.configure_factory_repo( - location_id="East US", - factory_repo_update={ - "factoryResourceId": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.DataFactory/factories/exampleFactoryName", - "repoConfiguration": { - "accountName": "ADF", - "collaborationBranch": "master", - "lastCommitId": "", - "projectName": "project", - "repositoryName": "repo", - "rootFolder": "/", - "tenantId": "", - "type": "FactoryVSTSConfiguration", - }, - }, - ) - print(response) - - -# x-ms-original-file: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/Factories_ConfigureFactoryRepo.json -if __name__ == "__main__": - main() diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_samples/factories_list.py b/sdk/datafactory/azure-mgmt-datafactory/generated_samples/factories_list.py deleted file mode 100644 index eea9551b7ce0..000000000000 --- a/sdk/datafactory/azure-mgmt-datafactory/generated_samples/factories_list.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.datafactory import DataFactoryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-datafactory -# USAGE - python factories_list.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 = DataFactoryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="12345678-1234-1234-1234-12345678abc", - ) - - response = client.factories.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/Factories_List.json -if __name__ == "__main__": - main() diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_samples/operations_list.py b/sdk/datafactory/azure-mgmt-datafactory/generated_samples/operations_list.py deleted file mode 100644 index e1b8ee859d63..000000000000 --- a/sdk/datafactory/azure-mgmt-datafactory/generated_samples/operations_list.py +++ /dev/null @@ -1,40 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.datafactory import DataFactoryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-datafactory -# USAGE - python operations_list.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 = DataFactoryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="12345678-1234-1234-1234-12345678abc", - ) - - response = client.operations.list() - for item in response: - print(item) - - -# x-ms-original-file: specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/examples/Operations_List.json -if __name__ == "__main__": - main() diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_factories_operations.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_factories_operations.py index 27215817e5e6..44f92482eb52 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_factories_operations.py +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_factories_operations.py @@ -18,28 +18,6 @@ class TestDataFactoryManagementFactoriesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(DataFactoryManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_factories_list(self, resource_group): - response = self.client.factories.list( - api_version="2018-06-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_factories_configure_factory_repo(self, resource_group): - response = self.client.factories.configure_factory_repo( - location_id="str", - factory_repo_update={"factoryResourceId": "str", "repoConfiguration": "factory_repo_configuration"}, - api_version="2018-06-01", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_factories_list_by_resource_group(self, resource_group): diff --git a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_factories_operations_async.py b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_factories_operations_async.py index 6a41ac09f6e9..d29551a70f6d 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_factories_operations_async.py +++ b/sdk/datafactory/azure-mgmt-datafactory/generated_tests/test_data_factory_management_factories_operations_async.py @@ -19,28 +19,6 @@ class TestDataFactoryManagementFactoriesOperationsAsync(AzureMgmtRecordedTestCas def setup_method(self, method): self.client = self.create_mgmt_client(DataFactoryManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_factories_list(self, resource_group): - response = self.client.factories.list( - api_version="2018-06-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_factories_configure_factory_repo(self, resource_group): - response = await self.client.factories.configure_factory_repo( - location_id="str", - factory_repo_update={"factoryResourceId": "str", "repoConfiguration": "factory_repo_configuration"}, - api_version="2018-06-01", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_factories_list_by_resource_group(self, resource_group): diff --git a/sdk/datafactory/azure-mgmt-datafactory/setup.py b/sdk/datafactory/azure-mgmt-datafactory/setup.py index 570262824209..907fd55998d6 100644 --- a/sdk/datafactory/azure-mgmt-datafactory/setup.py +++ b/sdk/datafactory/azure-mgmt-datafactory/setup.py @@ -22,11 +22,9 @@ # Version extraction inspired from 'requests' with open( - ( - os.path.join(package_folder_path, "version.py") - if os.path.exists(os.path.join(package_folder_path, "version.py")) - else os.path.join(package_folder_path, "_version.py") - ), + os.path.join(package_folder_path, "version.py") + if os.path.exists(os.path.join(package_folder_path, "version.py")) + else os.path.join(package_folder_path, "_version.py"), "r", ) as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1)