Skip to content

Commit

Permalink
CodeGen from PR 12186 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
add datalake store track2 config (Azure#12186)
  • Loading branch information
SDKAuto committed Dec 22, 2020
1 parent e43995b commit b2b4f7b
Show file tree
Hide file tree
Showing 15 changed files with 294 additions and 242 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def __init__(

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)

self.accounts = AccountsOperations(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"chosen_version": "2016-11-01",
"total_api_version_list": ["2016-11-01"],
"client": {
"name": "DataLakeStoreAccountManagementClient",
"filename": "_data_lake_store_account_management_client",
"description": "Creates an Azure Data Lake Store account management client.",
"base_url": "\u0027https://management.azure.com\u0027",
"custom_base_url": null,
"azure_arm": true,
"has_lro_operations": true,
"client_side_validation": true
},
"global_parameters": {
"sync": {
"credential": {
"signature": "credential, # type: \"TokenCredential\"",
"description": "Credential needed for the client to connect to Azure.",
"docstring_type": "~azure.core.credentials.TokenCredential",
"required": true
},
"subscription_id": {
"signature": "subscription_id, # type: str",
"description": "Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.",
"docstring_type": "str",
"required": true
}
},
"async": {
"credential": {
"signature": "credential, # type: \"AsyncTokenCredential\"",
"description": "Credential needed for the client to connect to Azure.",
"docstring_type": "~azure.core.credentials_async.AsyncTokenCredential",
"required": true
},
"subscription_id": {
"signature": "subscription_id, # type: str",
"description": "Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.",
"docstring_type": "str",
"required": true
}
},
"constant": {
},
"call": "credential, subscription_id"
},
"config": {
"credential": true,
"credential_scopes": ["https://management.azure.com/.default"],
"credential_default_policy_type": "BearerTokenCredentialPolicy",
"credential_default_policy_type_has_async_version": true,
"credential_key_header_name": null
},
"operation_groups": {
"accounts": "AccountsOperations",
"firewall_rules": "FirewallRulesOperations",
"virtual_network_rules": "VirtualNetworkRulesOperations",
"trusted_id_providers": "TrustedIdProvidersOperations",
"operations": "Operations",
"locations": "LocationsOperations"
},
"operation_mixins": {
},
"sync_imports": "None",
"async_imports": "None"
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def __init__(

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)

self.accounts = AccountsOperations(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling

from ... import models
from ... import models as _models

T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
Expand All @@ -35,7 +35,7 @@ class AccountsOperations:
:param deserializer: An object model deserializer.
"""

models = models
models = _models

def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
Expand All @@ -52,7 +52,7 @@ def list(
orderby: Optional[str] = None,
count: Optional[bool] = None,
**kwargs
) -> AsyncIterable["models.DataLakeStoreAccountListResult"]:
) -> AsyncIterable["_models.DataLakeStoreAccountListResult"]:
"""Lists the Data Lake Store accounts within the subscription. The response includes a link to the
next page of results, if any.
Expand All @@ -77,7 +77,7 @@ def list(
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datalake.store.models.DataLakeStoreAccountListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.DataLakeStoreAccountListResult"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.DataLakeStoreAccountListResult"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -154,7 +154,7 @@ def list_by_resource_group(
orderby: Optional[str] = None,
count: Optional[bool] = None,
**kwargs
) -> AsyncIterable["models.DataLakeStoreAccountListResult"]:
) -> AsyncIterable["_models.DataLakeStoreAccountListResult"]:
"""Lists the Data Lake Store accounts within a specific resource group. The response includes a
link to the next page of results, if any.
Expand All @@ -181,7 +181,7 @@ def list_by_resource_group(
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datalake.store.models.DataLakeStoreAccountListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.DataLakeStoreAccountListResult"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.DataLakeStoreAccountListResult"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -253,10 +253,10 @@ async def _create_initial(
self,
resource_group_name: str,
account_name: str,
parameters: "models.CreateDataLakeStoreAccountParameters",
parameters: "_models.CreateDataLakeStoreAccountParameters",
**kwargs
) -> "models.DataLakeStoreAccount":
cls = kwargs.pop('cls', None) # type: ClsType["models.DataLakeStoreAccount"]
) -> "_models.DataLakeStoreAccount":
cls = kwargs.pop('cls', None) # type: ClsType["_models.DataLakeStoreAccount"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -310,9 +310,9 @@ async def begin_create(
self,
resource_group_name: str,
account_name: str,
parameters: "models.CreateDataLakeStoreAccountParameters",
parameters: "_models.CreateDataLakeStoreAccountParameters",
**kwargs
) -> AsyncLROPoller["models.DataLakeStoreAccount"]:
) -> AsyncLROPoller["_models.DataLakeStoreAccount"]:
"""Creates the specified Data Lake Store account.
:param resource_group_name: The name of the Azure resource group.
Expand All @@ -332,7 +332,7 @@ async def begin_create(
:raises ~azure.core.exceptions.HttpResponseError:
"""
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
cls = kwargs.pop('cls', None) # type: ClsType["models.DataLakeStoreAccount"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.DataLakeStoreAccount"]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
Expand All @@ -357,7 +357,13 @@ def get_long_running_output(pipeline_response):
return cls(pipeline_response, deserialized, {})
return deserialized

if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs)
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'accountName': self._serialize.url("account_name", account_name, 'str'),
}

if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs)
elif polling is False: polling_method = AsyncNoPolling()
else: polling_method = polling
if cont_token:
Expand All @@ -376,7 +382,7 @@ async def get(
resource_group_name: str,
account_name: str,
**kwargs
) -> "models.DataLakeStoreAccount":
) -> "_models.DataLakeStoreAccount":
"""Gets the specified Data Lake Store account.
:param resource_group_name: The name of the Azure resource group.
Expand All @@ -388,7 +394,7 @@ async def get(
:rtype: ~azure.mgmt.datalake.store.models.DataLakeStoreAccount
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.DataLakeStoreAccount"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.DataLakeStoreAccount"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -433,10 +439,10 @@ async def _update_initial(
self,
resource_group_name: str,
account_name: str,
parameters: "models.UpdateDataLakeStoreAccountParameters",
parameters: "_models.UpdateDataLakeStoreAccountParameters",
**kwargs
) -> "models.DataLakeStoreAccount":
cls = kwargs.pop('cls', None) # type: ClsType["models.DataLakeStoreAccount"]
) -> "_models.DataLakeStoreAccount":
cls = kwargs.pop('cls', None) # type: ClsType["_models.DataLakeStoreAccount"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -493,9 +499,9 @@ async def begin_update(
self,
resource_group_name: str,
account_name: str,
parameters: "models.UpdateDataLakeStoreAccountParameters",
parameters: "_models.UpdateDataLakeStoreAccountParameters",
**kwargs
) -> AsyncLROPoller["models.DataLakeStoreAccount"]:
) -> AsyncLROPoller["_models.DataLakeStoreAccount"]:
"""Updates the specified Data Lake Store account information.
:param resource_group_name: The name of the Azure resource group.
Expand All @@ -515,7 +521,7 @@ async def begin_update(
:raises ~azure.core.exceptions.HttpResponseError:
"""
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
cls = kwargs.pop('cls', None) # type: ClsType["models.DataLakeStoreAccount"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.DataLakeStoreAccount"]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
Expand All @@ -540,7 +546,13 @@ def get_long_running_output(pipeline_response):
return cls(pipeline_response, deserialized, {})
return deserialized

if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs)
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'accountName': self._serialize.url("account_name", account_name, 'str'),
}

if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs)
elif polling is False: polling_method = AsyncNoPolling()
else: polling_method = polling
if cont_token:
Expand Down Expand Up @@ -640,7 +652,13 @@ def get_long_running_output(pipeline_response):
if cls:
return cls(pipeline_response, None, {})

if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs)
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'accountName': self._serialize.url("account_name", account_name, 'str'),
}

if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs)
elif polling is False: polling_method = AsyncNoPolling()
else: polling_method = polling
if cont_token:
Expand Down Expand Up @@ -711,27 +729,25 @@ async def enable_key_vault(
async def check_name_availability(
self,
location: str,
name: str,
parameters: "_models.CheckNameAvailabilityParameters",
**kwargs
) -> "models.NameAvailabilityInformation":
) -> "_models.NameAvailabilityInformation":
"""Checks whether the specified account name is available or taken.
:param location: The resource location without whitespace.
:type location: str
:param name: The Data Lake Store name to check availability for.
:type name: str
:param parameters: Parameters supplied to check the Data Lake Store account name availability.
:type parameters: ~azure.mgmt.datalake.store.models.CheckNameAvailabilityParameters
:keyword callable cls: A custom type or function that will be passed the direct response
:return: NameAvailabilityInformation, or the result of cls(response)
:rtype: ~azure.mgmt.datalake.store.models.NameAvailabilityInformation
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.NameAvailabilityInformation"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailabilityInformation"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))

_parameters = models.CheckNameAvailabilityParameters(name=name)
api_version = "2016-11-01"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"
Expand All @@ -754,7 +770,7 @@ async def check_name_availability(
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')

body_content_kwargs = {} # type: Dict[str, Any]
body_content = self._serialize.body(_parameters, 'CheckNameAvailabilityParameters')
body_content = self._serialize.body(parameters, 'CheckNameAvailabilityParameters')
body_content_kwargs['content'] = body_content
request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
Expand Down
Loading

0 comments on commit b2b4f7b

Please sign in to comment.