Skip to content

Commit

Permalink
CodeGen from PR 12371 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 7ea8f0f10ed3435fe94a02ad69f7c57fc309a4be into fee34e8
  • Loading branch information
SDKAuto committed Jan 11, 2021
1 parent 0429086 commit 2882ff3
Show file tree
Hide file tree
Showing 228 changed files with 9,072 additions and 1,688 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MonitorClientConfiguration(Configuration):
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The Azure subscription Id.
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
"""

Expand All @@ -45,7 +45,7 @@ def __init__(
self.credential = credential
self.subscription_id = subscription_id
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'azure-mgmt-eventhub/{}'.format(VERSION))
kwargs.setdefault('sdk_moniker', 'azure-mgmt-monitor/{}'.format(VERSION))
self._configure(**kwargs)

def _configure(
Expand Down
165 changes: 101 additions & 64 deletions sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_client.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MonitorClientConfiguration(Configuration):
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The Azure subscription Id.
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
"""

Expand All @@ -44,7 +44,7 @@ def __init__(
self.credential = credential
self.subscription_id = subscription_id
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'azure-mgmt-eventhub/{}'.format(VERSION))
kwargs.setdefault('sdk_moniker', 'azure-mgmt-monitor/{}'.format(VERSION))
self._configure(**kwargs)

def _configure(
Expand Down
165 changes: 101 additions & 64 deletions sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_client.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class MonitorClientConfiguration(Configuration):
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The Azure subscription Id.
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
"""

Expand All @@ -49,7 +49,7 @@ def __init__(
self.subscription_id = subscription_id
self.api_version = "2015-04-01"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION))
kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION))
self._configure(**kwargs)

def _configure(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,34 @@
"base_url": "\u0027https://management.azure.com\u0027",
"custom_base_url": null,
"azure_arm": true,
"has_lro_operations": false
"has_lro_operations": false,
"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",
"description": "The Azure subscription Id.",
"signature": "subscription_id, # type: str",
"description": "The ID of the target subscription.",
"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",
"description": "The Azure subscription Id.",
"signature": "subscription_id, # type: str",
"description": "The ID of the target subscription.",
"docstring_type": "str",
"required": true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class MonitorClient(object):
:vartype tenant_activity_logs: $(python-base-namespace).v2015_04_01.operations.TenantActivityLogsOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The Azure subscription Id.
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
:param str base_url: Service URL
"""
Expand All @@ -61,7 +61,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.activity_logs = ActivityLogsOperations(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class MonitorClientConfiguration(Configuration):
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The Azure subscription Id.
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
"""

Expand All @@ -46,7 +46,7 @@ def __init__(
self.subscription_id = subscription_id
self.api_version = "2015-04-01"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-eventhub/{}'.format(VERSION))
kwargs.setdefault('sdk_moniker', 'mgmt-monitor/{}'.format(VERSION))
self._configure(**kwargs)

def _configure(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MonitorClient(object):
:vartype tenant_activity_logs: $(python-base-namespace).v2015_04_01.aio.operations.TenantActivityLogsOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The Azure subscription Id.
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
:param str base_url: Service URL
"""
Expand All @@ -58,7 +58,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.activity_logs = ActivityLogsOperations(
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 ActivityLogsOperations:
: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(
filter: str,
select: Optional[str] = None,
**kwargs
) -> AsyncIterable["models.EventDataCollection"]:
) -> AsyncIterable["_models.EventDataCollection"]:
"""Provides the list of records from the activity logs.
:param filter: Reduces the set of data collected.:code:`<br>`This argument is required and it
Expand Down Expand Up @@ -77,7 +77,7 @@ def list(
:rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2015_04_01.models.EventDataCollection]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.EventDataCollection"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.EventDataCollection"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand All @@ -94,7 +94,7 @@ def prepare_request(next_link=None):
# Construct URL
url = self.list.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
Expand Down Expand Up @@ -125,7 +125,7 @@ async def get_next(next_link=None):
response = pipeline_response.http_response

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

Expand Down
Loading

0 comments on commit 2882ff3

Please sign in to comment.