Skip to content

Commit

Permalink
CodeGen from PR 3330 in test-repo-billy/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 39b325bd644dd489b69b1b889e9e5312dfb999a4 into 26ae65b7cff0082d7acce6e28ac8d6739bc19745
  • Loading branch information
SDKAuto committed Apr 26, 2024
1 parent 1e3ce6d commit f26b50b
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 230 deletions.
6 changes: 3 additions & 3 deletions sdk/datafactory/azure-mgmt-datafactory/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "9716e0c05a8c278ea44d8aa3f3b8ece46fb62ba2",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"commit": "1cd68b408db128963f7698834e4f2a054a214c42",
"repository_url": "https://github.com/test-repo-billy/azure-rest-api-specs",
"autorest": "3.9.7",
"use": [
"@autorest/[email protected]",
"@autorest/[email protected]"
],
"autorest_command": "autorest specification/datafactory/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/[email protected] --use=@autorest/[email protected] --version=3.9.7 --version-tolerant=False",
"autorest_command": "autorest specification/datafactory/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/[email protected] --use=@autorest/[email protected] --version=3.9.7 --version-tolerant=False",
"readme": "specification/datafactory/resource-manager/readme.md"
}
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 = "7.0.0"
VERSION = "1.0.0"
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
build_get_git_hub_access_token_request,
build_get_request,
build_list_by_resource_group_request,
build_list_request,
build_update_request,
)

Expand All @@ -64,82 +63,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 = {
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 = _convert_request(_request)
_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 = _convert_request(_request)
_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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ class ScriptActivityParameterType(str, Enum, metaclass=CaseInsensitiveEnumMeta):


class ScriptType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of the query. Type: string."""
"""The type of the ScriptActivityScriptBlock."""

QUERY = "Query"
NON_QUERY = "NonQuery"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38765,6 +38765,8 @@ class ManagedIdentityCredential(Credential):
:vartype description: str
:ivar annotations: List of tags that can be used for describing the Credential.
:vartype annotations: list[JSON]
:ivar resource_id: The resource id of user assigned managed identity.
:vartype resource_id: str
"""

_validation = {
Expand All @@ -38776,6 +38778,7 @@ class ManagedIdentityCredential(Credential):
"type": {"key": "type", "type": "str"},
"description": {"key": "description", "type": "str"},
"annotations": {"key": "annotations", "type": "[object]"},
"resource_id": {"key": "typeProperties.resourceId", "type": "str"},
}

def __init__(
Expand All @@ -38784,6 +38787,7 @@ def __init__(
additional_properties: Optional[Dict[str, JSON]] = None,
description: Optional[str] = None,
annotations: Optional[List[JSON]] = None,
resource_id: Optional[str] = None,
**kwargs: Any
) -> None:
"""
Expand All @@ -38794,11 +38798,14 @@ def __init__(
:paramtype description: str
:keyword annotations: List of tags that can be used for describing the Credential.
:paramtype annotations: list[JSON]
:keyword resource_id: The resource id of user assigned managed identity.
:paramtype resource_id: str
"""
super().__init__(
additional_properties=additional_properties, description=description, annotations=annotations, **kwargs
)
self.type: str = "ManagedIdentity"
self.resource_id = resource_id


class ManagedIdentityCredentialResource(CredentialResource):
Expand Down Expand Up @@ -57548,9 +57555,9 @@ class ScriptActivityScriptBlock(_serialization.Model):

:ivar text: The query text. Type: string (or Expression with resultType string). Required.
:vartype text: JSON
:ivar type: The type of the query. Type: string. Required. Known values are: "Query" and
"NonQuery".
:vartype type: str or ~azure.mgmt.datafactory.models.ScriptType
:ivar type: The type of the query. Please refer to the ScriptType for valid options. Type:
string (or Expression with resultType string). Required.
:vartype type: JSON
:ivar parameters: Array of script parameters. Type: array.
:vartype parameters: list[~azure.mgmt.datafactory.models.ScriptActivityParameter]
"""
Expand All @@ -57562,24 +57569,24 @@ class ScriptActivityScriptBlock(_serialization.Model):

_attribute_map = {
"text": {"key": "text", "type": "object"},
"type": {"key": "type", "type": "str"},
"type": {"key": "type", "type": "object"},
"parameters": {"key": "parameters", "type": "[ScriptActivityParameter]"},
}

def __init__(
self,
*,
text: JSON,
type: Union[str, "_models.ScriptType"],
type: JSON,
parameters: Optional[List["_models.ScriptActivityParameter"]] = None,
**kwargs: Any
) -> None:
"""
:keyword text: The query text. Type: string (or Expression with resultType string). Required.
:paramtype text: JSON
:keyword type: The type of the query. Type: string. Required. Known values are: "Query" and
"NonQuery".
:paramtype type: str or ~azure.mgmt.datafactory.models.ScriptType
:keyword type: The type of the query. Please refer to the ScriptType for valid options. Type:
string (or Expression with resultType string). Required.
:paramtype type: JSON
:keyword parameters: Array of script parameters. Type: array.
:paramtype parameters: list[~azure.mgmt.datafactory.models.ScriptActivityParameter]
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,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 {})
Expand Down Expand Up @@ -402,82 +378,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 = {
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 = _convert_request(_request)
_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 = _convert_request(_request)
_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,
Expand Down

This file was deleted.

0 comments on commit f26b50b

Please sign in to comment.