Skip to content

Commit 3235d2d

Browse files
author
SDKAuto
committed
CodeGen from PR 15004 in Azure/azure-rest-api-specs
track2 config (Azure#15004)
1 parent a542cc9 commit 3235d2d

File tree

14 files changed

+161
-923
lines changed

14 files changed

+161
-923
lines changed

sdk/workloadmonitor/azure-mgmt-workloadmonitor/MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
include _meta.json
12
recursive-include tests *.py *.yaml
23
include *.md
34
include azure/__init__.py
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"autorest": "3.4.2",
3+
"use": [
4+
"@autorest/[email protected]",
5+
"@autorest/[email protected]"
6+
],
7+
"commit": "3cf8aa90fbdf15379f62a1e8e0c3dcbd9c4d46af",
8+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9+
"autorest_command": "autorest specification/workloadmonitor/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.4.2",
10+
"readme": "specification/workloadmonitor/resource-manager/readme.md"
11+
}

sdk/workloadmonitor/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/_metadata.json

Lines changed: 55 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,42 +8,85 @@
88
"base_url": "\u0027https://management.azure.com\u0027",
99
"custom_base_url": null,
1010
"azure_arm": true,
11-
"has_lro_operations": false
11+
"has_lro_operations": false,
12+
"client_side_validation": false,
13+
"sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"WorkloadMonitorAPIConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}",
14+
"async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"WorkloadMonitorAPIConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}"
1215
},
1316
"global_parameters": {
14-
"sync_method": {
17+
"sync": {
1518
"credential": {
16-
"method_signature": "credential, # type: \"TokenCredential\"",
19+
"signature": "credential, # type: \"TokenCredential\"",
1720
"description": "Credential needed for the client to connect to Azure.",
1821
"docstring_type": "~azure.core.credentials.TokenCredential",
1922
"required": true
2023
}
2124
},
22-
"async_method": {
25+
"async": {
2326
"credential": {
24-
"method_signature": "credential, # type: \"AsyncTokenCredential\"",
27+
"signature": "credential: \"AsyncTokenCredential\",",
2528
"description": "Credential needed for the client to connect to Azure.",
2629
"docstring_type": "~azure.core.credentials_async.AsyncTokenCredential",
2730
"required": true
2831
}
2932
},
3033
"constant": {
3134
},
32-
"call": "credential"
35+
"call": "credential",
36+
"service_client_specific": {
37+
"sync": {
38+
"api_version": {
39+
"signature": "api_version=None, # type: Optional[str]",
40+
"description": "API version to use if no profile is provided, or if missing in profile.",
41+
"docstring_type": "str",
42+
"required": false
43+
},
44+
"base_url": {
45+
"signature": "base_url=None, # type: Optional[str]",
46+
"description": "Service URL",
47+
"docstring_type": "str",
48+
"required": false
49+
},
50+
"profile": {
51+
"signature": "profile=KnownProfiles.default, # type: KnownProfiles",
52+
"description": "A profile definition, from KnownProfiles to dict.",
53+
"docstring_type": "azure.profiles.KnownProfiles",
54+
"required": false
55+
}
56+
},
57+
"async": {
58+
"api_version": {
59+
"signature": "api_version: Optional[str] = None,",
60+
"description": "API version to use if no profile is provided, or if missing in profile.",
61+
"docstring_type": "str",
62+
"required": false
63+
},
64+
"base_url": {
65+
"signature": "base_url: Optional[str] = None,",
66+
"description": "Service URL",
67+
"docstring_type": "str",
68+
"required": false
69+
},
70+
"profile": {
71+
"signature": "profile: KnownProfiles = KnownProfiles.default,",
72+
"description": "A profile definition, from KnownProfiles to dict.",
73+
"docstring_type": "azure.profiles.KnownProfiles",
74+
"required": false
75+
}
76+
}
77+
}
3378
},
3479
"config": {
3580
"credential": true,
3681
"credential_scopes": ["https://management.azure.com/.default"],
3782
"credential_default_policy_type": "BearerTokenCredentialPolicy",
3883
"credential_default_policy_type_has_async_version": true,
39-
"credential_key_header_name": null
84+
"credential_key_header_name": null,
85+
"sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
86+
"async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
4087
},
4188
"operation_groups": {
4289
"operations": "Operations",
4390
"health_monitors": "HealthMonitorsOperations"
44-
},
45-
"operation_mixins": {
46-
},
47-
"sync_imports": "None",
48-
"async_imports": "None"
91+
}
4992
}

sdk/workloadmonitor/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
VERSION = "1.0.0b2"
9+
VERSION = "1.0.0b1"

sdk/workloadmonitor/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/_workload_monitor_api.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from typing import Any, Optional
1717

1818
from azure.core.credentials import TokenCredential
19+
from azure.core.pipeline.transport import HttpRequest, HttpResponse
1920

2021
from ._configuration import WorkloadMonitorAPIConfiguration
2122
from .operations import Operations
@@ -49,13 +50,29 @@ def __init__(
4950

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

5456
self.operations = Operations(
5557
self._client, self._config, self._serialize, self._deserialize)
5658
self.health_monitors = HealthMonitorsOperations(
5759
self._client, self._config, self._serialize, self._deserialize)
5860

61+
def _send_request(self, http_request, **kwargs):
62+
# type: (HttpRequest, Any) -> HttpResponse
63+
"""Runs the network request through the client's chained policies.
64+
65+
:param http_request: The network request you want to make. Required.
66+
:type http_request: ~azure.core.pipeline.transport.HttpRequest
67+
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
68+
:return: The response of your network call. Does not do error handling on your response.
69+
:rtype: ~azure.core.pipeline.transport.HttpResponse
70+
"""
71+
http_request.url = self._client.format_url(http_request.url)
72+
stream = kwargs.pop("stream", True)
73+
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
74+
return pipeline_response.http_response
75+
5976
def close(self):
6077
# type: () -> None
6178
self._client.close()

sdk/workloadmonitor/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/aio/_workload_monitor_api.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from typing import Any, Optional, TYPE_CHECKING
1010

11+
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
1112
from azure.mgmt.core import AsyncARMPipelineClient
1213
from msrest import Deserializer, Serializer
1314

@@ -46,13 +47,28 @@ def __init__(
4647

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

5153
self.operations = Operations(
5254
self._client, self._config, self._serialize, self._deserialize)
5355
self.health_monitors = HealthMonitorsOperations(
5456
self._client, self._config, self._serialize, self._deserialize)
5557

58+
async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse:
59+
"""Runs the network request through the client's chained policies.
60+
61+
:param http_request: The network request you want to make. Required.
62+
:type http_request: ~azure.core.pipeline.transport.HttpRequest
63+
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
64+
:return: The response of your network call. Does not do error handling on your response.
65+
:rtype: ~azure.core.pipeline.transport.AsyncHttpResponse
66+
"""
67+
http_request.url = self._client.format_url(http_request.url)
68+
stream = kwargs.pop("stream", True)
69+
pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs)
70+
return pipeline_response.http_response
71+
5672
async def close(self) -> None:
5773
await self._client.close()
5874

sdk/workloadmonitor/azure-mgmt-workloadmonitor/azure/mgmt/workloadmonitor/aio/operations/_health_monitors_operations.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
1616
from azure.mgmt.core.exceptions import ARMErrorFormat
1717

18-
from ... import models
18+
from ... import models as _models
1919

2020
T = TypeVar('T')
2121
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
@@ -34,7 +34,7 @@ class HealthMonitorsOperations:
3434
:param deserializer: An object model deserializer.
3535
"""
3636

37-
models = models
37+
models = _models
3838

3939
def __init__(self, client, config, serializer, deserializer) -> None:
4040
self._client = client
@@ -51,8 +51,8 @@ def list(
5151
resource_name: str,
5252
filter: Optional[str] = None,
5353
expand: Optional[str] = None,
54-
**kwargs
55-
) -> AsyncIterable["models.HealthMonitorList"]:
54+
**kwargs: Any
55+
) -> AsyncIterable["_models.HealthMonitorList"]:
5656
"""Get the current health status of all monitors of a virtual machine. Optional parameters: $expand (retrieve the monitor's evidence and configuration) and $filter (filter by monitor name).
5757
5858
Get the current health status of all monitors of a virtual machine. Optional parameters:
@@ -70,8 +70,8 @@ def list(
7070
:type resource_collection_name: str
7171
:param resource_name: The name of the virtual machine.
7272
:type resource_name: str
73-
:param filter: Optionally filter by monitor name. Example: $filter=monitorName eq 'logical-
74-
disks|C:|disk-free-space-mb.'.
73+
:param filter: Optionally filter by monitor name. Example: $filter=monitorName eq
74+
'logical-disks|C:|disk-free-space-mb.'.
7575
:type filter: str
7676
:param expand: Optionally expand the monitor’s evidence and/or configuration. Example:
7777
$expand=evidence,configuration.
@@ -81,7 +81,7 @@ def list(
8181
:rtype: ~azure.core.async_paging.AsyncItemPaged[~workload_monitor_api.models.HealthMonitorList]
8282
:raises: ~azure.core.exceptions.HttpResponseError
8383
"""
84-
cls = kwargs.pop('cls', None) # type: ClsType["models.HealthMonitorList"]
84+
cls = kwargs.pop('cls', None) # type: ClsType["_models.HealthMonitorList"]
8585
error_map = {
8686
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
8787
}
@@ -134,7 +134,7 @@ async def get_next(next_link=None):
134134
response = pipeline_response.http_response
135135

136136
if response.status_code not in [200]:
137-
error = self._deserialize(models.ErrorResponse, response)
137+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
138138
map_error(status_code=response.status_code, response=response, error_map=error_map)
139139
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
140140

@@ -154,8 +154,8 @@ async def get(
154154
resource_name: str,
155155
monitor_id: str,
156156
expand: Optional[str] = None,
157-
**kwargs
158-
) -> "models.HealthMonitor":
157+
**kwargs: Any
158+
) -> "_models.HealthMonitor":
159159
"""Get the current health status of a monitor of a virtual machine. Optional parameter: $expand (retrieve the monitor's evidence and configuration).
160160
161161
Get the current health status of a monitor of a virtual machine. Optional parameter: $expand
@@ -182,7 +182,7 @@ async def get(
182182
:rtype: ~workload_monitor_api.models.HealthMonitor
183183
:raises: ~azure.core.exceptions.HttpResponseError
184184
"""
185-
cls = kwargs.pop('cls', None) # type: ClsType["models.HealthMonitor"]
185+
cls = kwargs.pop('cls', None) # type: ClsType["_models.HealthMonitor"]
186186
error_map = {
187187
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
188188
}
@@ -218,7 +218,7 @@ async def get(
218218

219219
if response.status_code not in [200]:
220220
map_error(status_code=response.status_code, response=response, error_map=error_map)
221-
error = self._deserialize(models.ErrorResponse, response)
221+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
222222
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
223223

224224
deserialized = self._deserialize('HealthMonitor', pipeline_response)
@@ -241,8 +241,8 @@ def list_state_changes(
241241
expand: Optional[str] = None,
242242
start_timestamp_utc: Optional[datetime.datetime] = None,
243243
end_timestamp_utc: Optional[datetime.datetime] = None,
244-
**kwargs
245-
) -> AsyncIterable["models.HealthMonitorStateChangeList"]:
244+
**kwargs: Any
245+
) -> AsyncIterable["_models.HealthMonitorStateChangeList"]:
246246
"""Get the health state changes of a monitor of a virtual machine within the provided time window (default is the last 24 hours). Optional parameters: $expand (retrieve the monitor's evidence and configuration) and $filter (filter by heartbeat condition).
247247
248248
Get the health state changes of a monitor of a virtual machine within the provided time window
@@ -276,7 +276,7 @@ def list_state_changes(
276276
:rtype: ~azure.core.async_paging.AsyncItemPaged[~workload_monitor_api.models.HealthMonitorStateChangeList]
277277
:raises: ~azure.core.exceptions.HttpResponseError
278278
"""
279-
cls = kwargs.pop('cls', None) # type: ClsType["models.HealthMonitorStateChangeList"]
279+
cls = kwargs.pop('cls', None) # type: ClsType["_models.HealthMonitorStateChangeList"]
280280
error_map = {
281281
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
282282
}
@@ -334,7 +334,7 @@ async def get_next(next_link=None):
334334
response = pipeline_response.http_response
335335

336336
if response.status_code not in [200]:
337-
error = self._deserialize(models.ErrorResponse, response)
337+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
338338
map_error(status_code=response.status_code, response=response, error_map=error_map)
339339
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
340340

@@ -355,8 +355,8 @@ async def get_state_change(
355355
monitor_id: str,
356356
timestamp_unix: str,
357357
expand: Optional[str] = None,
358-
**kwargs
359-
) -> "models.HealthMonitorStateChange":
358+
**kwargs: Any
359+
) -> "_models.HealthMonitorStateChange":
360360
"""Get the health state change of a monitor of a virtual machine at the provided timestamp. Optional parameter: $expand (retrieve the monitor's evidence and configuration).
361361
362362
Get the health state change of a monitor of a virtual machine at the provided timestamp.
@@ -385,7 +385,7 @@ async def get_state_change(
385385
:rtype: ~workload_monitor_api.models.HealthMonitorStateChange
386386
:raises: ~azure.core.exceptions.HttpResponseError
387387
"""
388-
cls = kwargs.pop('cls', None) # type: ClsType["models.HealthMonitorStateChange"]
388+
cls = kwargs.pop('cls', None) # type: ClsType["_models.HealthMonitorStateChange"]
389389
error_map = {
390390
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
391391
}
@@ -422,7 +422,7 @@ async def get_state_change(
422422

423423
if response.status_code not in [200]:
424424
map_error(status_code=response.status_code, response=response, error_map=error_map)
425-
error = self._deserialize(models.ErrorResponse, response)
425+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
426426
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
427427

428428
deserialized = self._deserialize('HealthMonitorStateChange', pipeline_response)

0 commit comments

Comments
 (0)