Skip to content

Commit

Permalink
[DataFactory]Support new features in ADF 1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Jingshu918 committed Aug 20, 2024
1 parent 524a41f commit 1eb127d
Show file tree
Hide file tree
Showing 55 changed files with 1,751 additions and 674 deletions.
3 changes: 3 additions & 0 deletions src/datafactory/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Release History
===============
1.0.3
* Support new features in ADF

1.0.2
* Support new features in ADF

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from copy import deepcopy
from typing import Any, TYPE_CHECKING
from typing_extensions import Self

from azure.core.pipeline import policies
from azure.core.rest import HttpRequest, HttpResponse
Expand Down Expand Up @@ -230,7 +231,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
def close(self) -> None:
self._client.close()

def __enter__(self) -> "DataFactoryManagementClient":
def __enter__(self) -> Self:
self._client.__enter__()
return self

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ def _json_attemp(data):
# context otherwise.
_LOGGER.critical("Wasn't XML not JSON, failing")
raise DeserializationError("XML is invalid") from err
elif content_type.startswith("text/"):
return data_as_str
raise DeserializationError("Cannot deserialize content-type: {}".format(content_type))

@classmethod
Expand Down Expand Up @@ -1441,7 +1443,7 @@ def _deserialize(self, target_obj, data):
elif isinstance(response, type) and issubclass(response, Enum):
return self.deserialize_enum(data, response)

if data is None:
if data is None or data is CoreNull:
return data
try:
attributes = response._attribute_map # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "8.0.0"
VERSION = "9.0.0"
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
from typing_extensions import Self

from azure.core.pipeline import policies
from azure.core.rest import AsyncHttpResponse, HttpRequest
Expand Down Expand Up @@ -233,7 +234,7 @@ def _send_request(
async def close(self) -> None:
await self._client.close()

async def __aenter__(self) -> "DataFactoryManagementClient":
async def __aenter__(self) -> Self:
await self._client.__aenter__()
return self

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.rest import AsyncHttpResponse, 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._activity_runs_operations import build_query_by_pipeline_run_request

if sys.version_info >= (3, 9):
Expand Down Expand Up @@ -173,7 +171,6 @@ async def query_by_pipeline_run(
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)

_stream = False
Expand All @@ -187,7 +184,7 @@ async def query_by_pipeline_run(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)

deserialized = self._deserialize("ActivityRunsQueryResponse", pipeline_response)
deserialized = self._deserialize("ActivityRunsQueryResponse", pipeline_response.http_response)

if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
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._change_data_capture_operations import (
build_create_or_update_request,
build_delete_request,
Expand Down Expand Up @@ -108,7 +106,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)

else:
Expand All @@ -124,7 +121,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
Expand Down Expand Up @@ -287,7 +283,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)

_stream = False
Expand All @@ -301,7 +296,7 @@ async def create_or_update(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)

deserialized = self._deserialize("ChangeDataCaptureResource", pipeline_response)
deserialized = self._deserialize("ChangeDataCaptureResource", pipeline_response.http_response)

if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
Expand Down Expand Up @@ -357,7 +352,6 @@ async def get(
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)

_stream = False
Expand All @@ -371,7 +365,7 @@ async def get(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)

deserialized = self._deserialize("ChangeDataCaptureResource", pipeline_response)
deserialized = self._deserialize("ChangeDataCaptureResource", pipeline_response.http_response)

if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
Expand Down Expand Up @@ -417,7 +411,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)

_stream = False
Expand Down Expand Up @@ -473,7 +466,6 @@ async def start( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)

_stream = False
Expand Down Expand Up @@ -529,7 +521,6 @@ async def stop( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)

_stream = False
Expand Down Expand Up @@ -585,7 +576,6 @@ async def status(
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)

_stream = False
Expand All @@ -599,7 +589,7 @@ async def status(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)

deserialized = self._deserialize("str", pipeline_response)
deserialized = self._deserialize("str", pipeline_response.http_response)

if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.core.tracing.decorator import distributed_trace
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._credential_operations_operations import (
build_create_or_update_request,
build_delete_request,
Expand Down Expand Up @@ -104,7 +102,6 @@ def prepare_request(next_link=None):
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)

else:
Expand All @@ -120,7 +117,6 @@ def prepare_request(next_link=None):
_request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)
_request.method = "GET"
return _request
Expand Down Expand Up @@ -279,7 +275,6 @@ async def create_or_update(
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)

_stream = False
Expand All @@ -293,7 +288,7 @@ async def create_or_update(
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)

deserialized = self._deserialize("CredentialResource", pipeline_response)
deserialized = self._deserialize("CredentialResource", pipeline_response.http_response)

if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
Expand Down Expand Up @@ -349,7 +344,6 @@ async def get(
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)

_stream = False
Expand All @@ -365,7 +359,7 @@ async def get(

deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("CredentialResource", pipeline_response)
deserialized = self._deserialize("CredentialResource", pipeline_response.http_response)

if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
Expand Down Expand Up @@ -411,7 +405,6 @@ async def delete( # pylint: disable=inconsistent-return-statements
headers=_headers,
params=_params,
)
_request = _convert_request(_request)
_request.url = self._client.format_url(_request.url)

_stream = False
Expand Down
Loading

0 comments on commit 1eb127d

Please sign in to comment.