Skip to content

Commit

Permalink
CodeGen from PR 11722 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
[T2] datalakestore for python track2 (Azure#11722)

* python track2

* python.md
  • Loading branch information
SDKAuto committed Nov 20, 2020
1 parent 771b68c commit e67fe6b
Show file tree
Hide file tree
Showing 15 changed files with 246 additions and 146 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 @@ -713,7 +731,7 @@ async def check_name_availability(
location: str,
name: str,
**kwargs
) -> "models.NameAvailabilityInformation":
) -> "_models.NameAvailabilityInformation":
"""Checks whether the specified account name is available or taken.
:param location: The resource location without whitespace.
Expand All @@ -725,13 +743,13 @@ async def check_name_availability(
: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)
_parameters = _models.CheckNameAvailabilityParameters(name=name)
api_version = "2016-11-01"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.mgmt.core.exceptions import ARMErrorFormat

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

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

models = models
models = _models

def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
Expand All @@ -46,7 +46,7 @@ def list_by_account(
resource_group_name: str,
account_name: str,
**kwargs
) -> AsyncIterable["models.FirewallRuleListResult"]:
) -> AsyncIterable["_models.FirewallRuleListResult"]:
"""Lists the Data Lake Store firewall rules within the specified Data Lake Store account.
:param resource_group_name: The name of the Azure resource group.
Expand All @@ -58,7 +58,7 @@ def list_by_account(
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.datalake.store.models.FirewallRuleListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.FirewallRuleListResult"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.FirewallRuleListResult"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -123,7 +123,7 @@ async def create_or_update(
start_ip_address: str,
end_ip_address: str,
**kwargs
) -> "models.FirewallRule":
) -> "_models.FirewallRule":
"""Creates or updates the specified firewall rule. During update, the firewall rule with the
specified name will be replaced with this new firewall rule.
Expand All @@ -144,13 +144,13 @@ async def create_or_update(
:rtype: ~azure.mgmt.datalake.store.models.FirewallRule
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.FirewallRule"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.FirewallRule"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))

_parameters = models.CreateOrUpdateFirewallRuleParameters(start_ip_address=start_ip_address, end_ip_address=end_ip_address)
_parameters = _models.CreateOrUpdateFirewallRuleParameters(start_ip_address=start_ip_address, end_ip_address=end_ip_address)
api_version = "2016-11-01"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"
Expand Down Expand Up @@ -199,7 +199,7 @@ async def get(
account_name: str,
firewall_rule_name: str,
**kwargs
) -> "models.FirewallRule":
) -> "_models.FirewallRule":
"""Gets the specified Data Lake Store firewall rule.
:param resource_group_name: The name of the Azure resource group.
Expand All @@ -213,7 +213,7 @@ async def get(
:rtype: ~azure.mgmt.datalake.store.models.FirewallRule
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.FirewallRule"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.FirewallRule"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -263,7 +263,7 @@ async def update(
start_ip_address: Optional[str] = None,
end_ip_address: Optional[str] = None,
**kwargs
) -> "models.FirewallRule":
) -> "_models.FirewallRule":
"""Updates the specified firewall rule.
:param resource_group_name: The name of the Azure resource group.
Expand All @@ -283,13 +283,13 @@ async def update(
:rtype: ~azure.mgmt.datalake.store.models.FirewallRule
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.FirewallRule"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.FirewallRule"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))

_parameters = models.UpdateFirewallRuleParameters(start_ip_address=start_ip_address, end_ip_address=end_ip_address)
_parameters = _models.UpdateFirewallRuleParameters(start_ip_address=start_ip_address, end_ip_address=end_ip_address)
api_version = "2016-11-01"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"
Expand Down
Loading

0 comments on commit e67fe6b

Please sign in to comment.