Skip to content

Commit

Permalink
CodeGen from PR 12312 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 2ebbef8e518d2684e3448871efb3480d8e8744be into a533c2e
  • Loading branch information
SDKAuto committed Jan 12, 2021
1 parent 739b24a commit fa20127
Show file tree
Hide file tree
Showing 23 changed files with 128 additions and 109 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,33 @@
"base_url": "\u0027https://management.azure.com\u0027",
"custom_base_url": null,
"azure_arm": true,
"has_lro_operations": true
"has_lro_operations": true,
"client_side_validation": true
},
"global_parameters": {
"sync_method": {
"sync": {
"credential": {
"method_signature": "credential, # type: \"TokenCredential\"",
"signature": "credential, # type: \"TokenCredential\"",
"description": "Credential needed for the client to connect to Azure.",
"docstring_type": "~azure.core.credentials.TokenCredential",
"required": true
},
"subscription_id": {
"method_signature": "subscription_id, # type: str",
"signature": "subscription_id, # type: str",
"description": "Microsoft Azure subscription id.",
"docstring_type": "str",
"required": true
}
},
"async_method": {
"async": {
"credential": {
"method_signature": "credential, # type: \"AsyncTokenCredential\"",
"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": {
"method_signature": "subscription_id, # type: str",
"signature": "subscription_id, # type: str",
"description": "Microsoft Azure subscription id.",
"docstring_type": "str",
"required": true
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 MarketplaceAgreementsOperations:
:param deserializer: An object model deserializer.
"""

models = models
models = _models

def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
Expand All @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None:
def list(
self,
**kwargs
) -> AsyncIterable["models.ConfluentAgreementResourceListResponse"]:
) -> AsyncIterable["_models.ConfluentAgreementResourceListResponse"]:
"""List Confluent marketplace agreements in the subscription.
List Confluent marketplace agreements in the subscription.
Expand All @@ -54,7 +54,7 @@ def list(
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.confluent.models.ConfluentAgreementResourceListResponse]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.ConfluentAgreementResourceListResponse"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfluentAgreementResourceListResponse"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -97,7 +97,7 @@ async def get_next(next_link=None):
response = pipeline_response.http_response

if response.status_code not in [200]:
error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response)
error = self._deserialize(_models.ResourceProviderDefaultErrorResponse, response)
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

Expand All @@ -110,27 +110,25 @@ async def get_next(next_link=None):

async def create(
self,
properties: Optional["models.ConfluentAgreementProperties"] = None,
body: Optional["_models.ConfluentAgreementResource"] = None,
**kwargs
) -> "models.ConfluentAgreementResource":
) -> "_models.ConfluentAgreementResource":
"""Create Confluent Marketplace agreement in the subscription.
Create Confluent Marketplace agreement in the subscription.
:param properties: Represents the properties of the resource.
:type properties: ~azure.mgmt.confluent.models.ConfluentAgreementProperties
:param body:
:type body: ~azure.mgmt.confluent.models.ConfluentAgreementResource
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ConfluentAgreementResource, or the result of cls(response)
:rtype: ~azure.mgmt.confluent.models.ConfluentAgreementResource
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.ConfluentAgreementResource"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfluentAgreementResource"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))

_body = models.ConfluentAgreementResource(properties=properties)
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"

Expand All @@ -150,8 +148,8 @@ async def create(
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')

body_content_kwargs = {} # type: Dict[str, Any]
if _body is not None:
body_content = self._serialize.body(_body, 'ConfluentAgreementResource')
if body is not None:
body_content = self._serialize.body(body, 'ConfluentAgreementResource')
else:
body_content = None
body_content_kwargs['content'] = body_content
Expand All @@ -161,7 +159,7 @@ async def create(

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response)
error = self._deserialize(_models.ResourceProviderDefaultErrorResponse, response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

deserialized = self._deserialize('ConfluentAgreementResource', pipeline_response)
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 OrganizationOperations:
: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 __init__(self, client, config, serializer, deserializer) -> None:
def list_by_subscription(
self,
**kwargs
) -> AsyncIterable["models.OrganizationResourceListResult"]:
) -> AsyncIterable["_models.OrganizationResourceListResult"]:
"""List all organizations under the specified subscription.
List all organizations under the specified subscription.
Expand All @@ -56,7 +56,7 @@ def list_by_subscription(
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.confluent.models.OrganizationResourceListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.OrganizationResourceListResult"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.OrganizationResourceListResult"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -101,7 +101,7 @@ async def get_next(next_link=None):
response = pipeline_response.http_response

if response.status_code not in [200]:
error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response)
error = self._deserialize(_models.ResourceProviderDefaultErrorResponse, response)
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

Expand All @@ -116,7 +116,7 @@ def list_by_resource_group(
self,
resource_group_name: str,
**kwargs
) -> AsyncIterable["models.OrganizationResourceListResult"]:
) -> AsyncIterable["_models.OrganizationResourceListResult"]:
"""List all Organizations under the specified resource group.
List all Organizations under the specified resource group.
Expand All @@ -128,7 +128,7 @@ def list_by_resource_group(
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.confluent.models.OrganizationResourceListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.OrganizationResourceListResult"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.OrganizationResourceListResult"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -174,7 +174,7 @@ async def get_next(next_link=None):
response = pipeline_response.http_response

if response.status_code not in [200]:
error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response)
error = self._deserialize(_models.ResourceProviderDefaultErrorResponse, response)
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

Expand All @@ -190,7 +190,7 @@ async def get(
resource_group_name: str,
organization_name: str,
**kwargs
) -> "models.OrganizationResource":
) -> "_models.OrganizationResource":
"""Get the properties of a specific Organization resource.
Get the properties of a specific Organization resource.
Expand All @@ -204,7 +204,7 @@ async def get(
:rtype: ~azure.mgmt.confluent.models.OrganizationResource
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.OrganizationResource"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.OrganizationResource"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -235,7 +235,7 @@ async def get(

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response)
error = self._deserialize(_models.ResourceProviderDefaultErrorResponse, response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

deserialized = self._deserialize('OrganizationResource', pipeline_response)
Expand All @@ -250,10 +250,10 @@ async def _create_initial(
self,
resource_group_name: str,
organization_name: str,
body: Optional["models.OrganizationResource"] = None,
body: Optional["_models.OrganizationResource"] = None,
**kwargs
) -> "models.OrganizationResource":
cls = kwargs.pop('cls', None) # type: ClsType["models.OrganizationResource"]
) -> "_models.OrganizationResource":
cls = kwargs.pop('cls', None) # type: ClsType["_models.OrganizationResource"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -292,7 +292,7 @@ async def _create_initial(

if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response)
error = self._deserialize(_models.ResourceProviderDefaultErrorResponse, response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

if response.status_code == 200:
Expand All @@ -311,9 +311,9 @@ async def begin_create(
self,
resource_group_name: str,
organization_name: str,
body: Optional["models.OrganizationResource"] = None,
body: Optional["_models.OrganizationResource"] = None,
**kwargs
) -> AsyncLROPoller["models.OrganizationResource"]:
) -> AsyncLROPoller["_models.OrganizationResource"]:
"""Create Organization resource.
Create Organization resource.
Expand All @@ -335,7 +335,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.OrganizationResource"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.OrganizationResource"]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
Expand All @@ -360,7 +360,13 @@ def get_long_running_output(pipeline_response):
return cls(pipeline_response, deserialized, {})
return deserialized

if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **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'),
'organizationName': self._serialize.url("organization_name", organization_name, 'str'),
}

if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs)
elif polling is False: polling_method = AsyncNoPolling()
else: polling_method = polling
if cont_token:
Expand All @@ -378,9 +384,9 @@ async def update(
self,
resource_group_name: str,
organization_name: str,
tags: Optional[Dict[str, str]] = None,
body: Optional["_models.OrganizationResourceUpdate"] = None,
**kwargs
) -> "models.OrganizationResource":
) -> "_models.OrganizationResource":
"""Update Organization resource.
Update Organization resource.
Expand All @@ -389,20 +395,18 @@ async def update(
:type resource_group_name: str
:param organization_name: Organization resource name.
:type organization_name: str
:param tags: ARM resource tags.
:type tags: dict[str, str]
:param body: Updated Organization resource.
:type body: ~azure.mgmt.confluent.models.OrganizationResourceUpdate
:keyword callable cls: A custom type or function that will be passed the direct response
:return: OrganizationResource, or the result of cls(response)
:rtype: ~azure.mgmt.confluent.models.OrganizationResource
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.OrganizationResource"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.OrganizationResource"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))

_body = models.OrganizationResourceUpdate(tags=tags)
api_version = "2020-03-01-preview"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"
Expand All @@ -426,8 +430,8 @@ async def update(
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')

body_content_kwargs = {} # type: Dict[str, Any]
if _body is not None:
body_content = self._serialize.body(_body, 'OrganizationResourceUpdate')
if body is not None:
body_content = self._serialize.body(body, 'OrganizationResourceUpdate')
else:
body_content = None
body_content_kwargs['content'] = body_content
Expand All @@ -437,7 +441,7 @@ async def update(

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response)
error = self._deserialize(_models.ResourceProviderDefaultErrorResponse, response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

deserialized = self._deserialize('OrganizationResource', pipeline_response)
Expand Down Expand Up @@ -485,7 +489,7 @@ async def _delete_initial(

if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize(models.ResourceProviderDefaultErrorResponse, response)
error = self._deserialize(_models.ResourceProviderDefaultErrorResponse, response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

if cls:
Expand Down Expand Up @@ -539,7 +543,13 @@ def get_long_running_output(pipeline_response):
if cls:
return cls(pipeline_response, None, {})

if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **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'),
'organizationName': self._serialize.url("organization_name", organization_name, 'str'),
}

if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs)
elif polling is False: polling_method = AsyncNoPolling()
else: polling_method = polling
if cont_token:
Expand Down
Loading

0 comments on commit fa20127

Please sign in to comment.