Skip to content

Commit 61421e6

Browse files
SDKAutoYan Zhang (WICRESOFT NORTH AMERICA LTD)
andcommitted
CodeGen from PR 14277 in Azure/azure-rest-api-specs
AzureStackHCI wave4 (Azure#14277) Co-authored-by: Yan Zhang (WICRESOFT NORTH AMERICA LTD) <v-yanzhang@microsoft.com>
1 parent 4486c6a commit 61421e6

File tree

14 files changed

+293
-72
lines changed

14 files changed

+293
-72
lines changed

sdk/azurestackhci/azure-mgmt-azurestackhci/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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"autorest": "3.3.0",
3+
"use": "@autorest/python@5.6.6",
4+
"commit": "54692d5a0346c6040f14f5c836eaca598009c52d",
5+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
6+
"autorest_command": "autorest specification/azurestackhci/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/python@5.6.6 --version=3.3.0",
7+
"readme": "specification/azurestackhci/resource-manager/readme.md"
8+
}

sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/_azure_stack_hci_client.py

Lines changed: 21 additions & 2 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 AzureStackHCIClientConfiguration
2122
from .operations import Operations
@@ -27,9 +28,9 @@ class AzureStackHCIClient(object):
2728
"""Azure Stack HCI management service.
2829
2930
:ivar operations: Operations operations
30-
:vartype operations: azure.mgmt.azurestackhci.operations.Operations
31+
:vartype operations: azure_stack_hci_client.operations.Operations
3132
:ivar clusters: ClustersOperations operations
32-
:vartype clusters: azure.mgmt.azurestackhci.operations.ClustersOperations
33+
:vartype clusters: azure_stack_hci_client.operations.ClustersOperations
3334
:param credential: Credential needed for the client to connect to Azure.
3435
:type credential: ~azure.core.credentials.TokenCredential
3536
:param subscription_id: The ID of the target subscription.
@@ -60,6 +61,24 @@ def __init__(
6061
self.clusters = ClustersOperations(
6162
self._client, self._config, self._serialize, self._deserialize)
6263

64+
def _send_request(self, http_request, **kwargs):
65+
# type: (HttpRequest, Any) -> HttpResponse
66+
"""Runs the network request through the client's chained policies.
67+
68+
:param http_request: The network request you want to make. Required.
69+
:type http_request: ~azure.core.pipeline.transport.HttpRequest
70+
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
71+
:return: The response of your network call. Does not do error handling on your response.
72+
:rtype: ~azure.core.pipeline.transport.HttpResponse
73+
"""
74+
path_format_arguments = {
75+
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
76+
}
77+
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
78+
stream = kwargs.pop("stream", True)
79+
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
80+
return pipeline_response.http_response
81+
6382
def close(self):
6483
# type: () -> None
6584
self._client.close()
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
{
2+
"chosen_version": "2020-10-01",
3+
"total_api_version_list": ["2020-10-01"],
4+
"client": {
5+
"name": "AzureStackHCIClient",
6+
"filename": "_azure_stack_hci_client",
7+
"description": "Azure Stack HCI management service.",
8+
"base_url": "\u0027https://management.azure.com\u0027",
9+
"custom_base_url": null,
10+
"azure_arm": true,
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\": [\"AzureStackHCIClientConfiguration\"]}}, \"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\": [\"AzureStackHCIClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}"
15+
},
16+
"global_parameters": {
17+
"sync": {
18+
"credential": {
19+
"signature": "credential, # type: \"TokenCredential\"",
20+
"description": "Credential needed for the client to connect to Azure.",
21+
"docstring_type": "~azure.core.credentials.TokenCredential",
22+
"required": true
23+
},
24+
"subscription_id": {
25+
"signature": "subscription_id, # type: str",
26+
"description": "The ID of the target subscription.",
27+
"docstring_type": "str",
28+
"required": true
29+
}
30+
},
31+
"async": {
32+
"credential": {
33+
"signature": "credential: \"AsyncTokenCredential\",",
34+
"description": "Credential needed for the client to connect to Azure.",
35+
"docstring_type": "~azure.core.credentials_async.AsyncTokenCredential",
36+
"required": true
37+
},
38+
"subscription_id": {
39+
"signature": "subscription_id: str,",
40+
"description": "The ID of the target subscription.",
41+
"docstring_type": "str",
42+
"required": true
43+
}
44+
},
45+
"constant": {
46+
},
47+
"call": "credential, subscription_id",
48+
"service_client_specific": {
49+
"sync": {
50+
"api_version": {
51+
"signature": "api_version=None, # type: Optional[str]",
52+
"description": "API version to use if no profile is provided, or if missing in profile.",
53+
"docstring_type": "str",
54+
"required": false
55+
},
56+
"base_url": {
57+
"signature": "base_url=None, # type: Optional[str]",
58+
"description": "Service URL",
59+
"docstring_type": "str",
60+
"required": false
61+
},
62+
"profile": {
63+
"signature": "profile=KnownProfiles.default, # type: KnownProfiles",
64+
"description": "A profile definition, from KnownProfiles to dict.",
65+
"docstring_type": "azure.profiles.KnownProfiles",
66+
"required": false
67+
}
68+
},
69+
"async": {
70+
"api_version": {
71+
"signature": "api_version: Optional[str] = None,",
72+
"description": "API version to use if no profile is provided, or if missing in profile.",
73+
"docstring_type": "str",
74+
"required": false
75+
},
76+
"base_url": {
77+
"signature": "base_url: Optional[str] = None,",
78+
"description": "Service URL",
79+
"docstring_type": "str",
80+
"required": false
81+
},
82+
"profile": {
83+
"signature": "profile: KnownProfiles = KnownProfiles.default,",
84+
"description": "A profile definition, from KnownProfiles to dict.",
85+
"docstring_type": "azure.profiles.KnownProfiles",
86+
"required": false
87+
}
88+
}
89+
}
90+
},
91+
"config": {
92+
"credential": true,
93+
"credential_scopes": ["https://management.azure.com/.default"],
94+
"credential_default_policy_type": "BearerTokenCredentialPolicy",
95+
"credential_default_policy_type_has_async_version": true,
96+
"credential_key_header_name": null,
97+
"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\"]}}}",
98+
"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\"]}}}"
99+
},
100+
"operation_groups": {
101+
"operations": "Operations",
102+
"clusters": "ClustersOperations"
103+
}
104+
}

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

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

9-
VERSION = "6.0.0b1"
10-
9+
VERSION = "1.0.0b1"

sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/_azure_stack_hci_client.py

Lines changed: 20 additions & 2 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

@@ -25,9 +26,9 @@ class AzureStackHCIClient(object):
2526
"""Azure Stack HCI management service.
2627
2728
:ivar operations: Operations operations
28-
:vartype operations: azure.mgmt.azurestackhci.aio.operations.Operations
29+
:vartype operations: azure_stack_hci_client.aio.operations.Operations
2930
:ivar clusters: ClustersOperations operations
30-
:vartype clusters: azure.mgmt.azurestackhci.aio.operations.ClustersOperations
31+
:vartype clusters: azure_stack_hci_client.aio.operations.ClustersOperations
3132
:param credential: Credential needed for the client to connect to Azure.
3233
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
3334
:param subscription_id: The ID of the target subscription.
@@ -57,6 +58,23 @@ def __init__(
5758
self.clusters = ClustersOperations(
5859
self._client, self._config, self._serialize, self._deserialize)
5960

61+
async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse:
62+
"""Runs the network request through the client's chained policies.
63+
64+
:param http_request: The network request you want to make. Required.
65+
:type http_request: ~azure.core.pipeline.transport.HttpRequest
66+
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
67+
:return: The response of your network call. Does not do error handling on your response.
68+
:rtype: ~azure.core.pipeline.transport.AsyncHttpResponse
69+
"""
70+
path_format_arguments = {
71+
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
72+
}
73+
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
74+
stream = kwargs.pop("stream", True)
75+
pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs)
76+
return pipeline_response.http_response
77+
6078
async def close(self) -> None:
6179
await self._client.close()
6280

sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_clusters_operations.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class ClustersOperations:
2626
instantiates it for you and attaches it as an attribute.
2727
2828
:ivar models: Alias to model classes used in this operation group.
29-
:type models: ~azure.mgmt.azurestackhci.models
29+
:type models: ~azure_stack_hci_client.models
3030
:param client: Client for service requests.
3131
:param config: Configuration of service client.
3232
:param serializer: An object model serializer.
@@ -49,7 +49,7 @@ def list_by_subscription(
4949
5050
:keyword callable cls: A custom type or function that will be passed the direct response
5151
:return: An iterator like instance of either ClusterList or the result of cls(response)
52-
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.ClusterList]
52+
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_stack_hci_client.models.ClusterList]
5353
:raises: ~azure.core.exceptions.HttpResponseError
5454
"""
5555
cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterList"]
@@ -97,7 +97,7 @@ async def get_next(next_link=None):
9797
response = pipeline_response.http_response
9898

9999
if response.status_code not in [200]:
100-
error = self._deserialize(_models.ErrorResponse, response)
100+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
101101
map_error(status_code=response.status_code, response=response, error_map=error_map)
102102
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
103103

@@ -119,7 +119,7 @@ def list_by_resource_group(
119119
:type resource_group_name: str
120120
:keyword callable cls: A custom type or function that will be passed the direct response
121121
:return: An iterator like instance of either ClusterList or the result of cls(response)
122-
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.azurestackhci.models.ClusterList]
122+
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure_stack_hci_client.models.ClusterList]
123123
:raises: ~azure.core.exceptions.HttpResponseError
124124
"""
125125
cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterList"]
@@ -168,7 +168,7 @@ async def get_next(next_link=None):
168168
response = pipeline_response.http_response
169169

170170
if response.status_code not in [200]:
171-
error = self._deserialize(_models.ErrorResponse, response)
171+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
172172
map_error(status_code=response.status_code, response=response, error_map=error_map)
173173
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
174174

@@ -193,7 +193,7 @@ async def get(
193193
:type cluster_name: str
194194
:keyword callable cls: A custom type or function that will be passed the direct response
195195
:return: Cluster, or the result of cls(response)
196-
:rtype: ~azure.mgmt.azurestackhci.models.Cluster
196+
:rtype: ~azure_stack_hci_client.models.Cluster
197197
:raises: ~azure.core.exceptions.HttpResponseError
198198
"""
199199
cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"]
@@ -227,7 +227,7 @@ async def get(
227227

228228
if response.status_code not in [200]:
229229
map_error(status_code=response.status_code, response=response, error_map=error_map)
230-
error = self._deserialize(_models.ErrorResponse, response)
230+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
231231
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
232232

233233
deserialized = self._deserialize('Cluster', pipeline_response)
@@ -252,10 +252,10 @@ async def create(
252252
:param cluster_name: The name of the cluster.
253253
:type cluster_name: str
254254
:param cluster: Details of the HCI cluster.
255-
:type cluster: ~azure.mgmt.azurestackhci.models.Cluster
255+
:type cluster: ~azure_stack_hci_client.models.Cluster
256256
:keyword callable cls: A custom type or function that will be passed the direct response
257257
:return: Cluster, or the result of cls(response)
258-
:rtype: ~azure.mgmt.azurestackhci.models.Cluster
258+
:rtype: ~azure_stack_hci_client.models.Cluster
259259
:raises: ~azure.core.exceptions.HttpResponseError
260260
"""
261261
cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"]
@@ -294,7 +294,7 @@ async def create(
294294

295295
if response.status_code not in [200]:
296296
map_error(status_code=response.status_code, response=response, error_map=error_map)
297-
error = self._deserialize(_models.ErrorResponse, response)
297+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
298298
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
299299

300300
deserialized = self._deserialize('Cluster', pipeline_response)
@@ -319,10 +319,10 @@ async def update(
319319
:param cluster_name: The name of the cluster.
320320
:type cluster_name: str
321321
:param cluster: Details of the HCI cluster.
322-
:type cluster: ~azure.mgmt.azurestackhci.models.ClusterUpdate
322+
:type cluster: ~azure_stack_hci_client.models.ClusterUpdate
323323
:keyword callable cls: A custom type or function that will be passed the direct response
324324
:return: Cluster, or the result of cls(response)
325-
:rtype: ~azure.mgmt.azurestackhci.models.Cluster
325+
:rtype: ~azure_stack_hci_client.models.Cluster
326326
:raises: ~azure.core.exceptions.HttpResponseError
327327
"""
328328
cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"]
@@ -361,7 +361,7 @@ async def update(
361361

362362
if response.status_code not in [200]:
363363
map_error(status_code=response.status_code, response=response, error_map=error_map)
364-
error = self._deserialize(_models.ErrorResponse, response)
364+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
365365
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
366366

367367
deserialized = self._deserialize('Cluster', pipeline_response)
@@ -420,7 +420,7 @@ async def delete(
420420

421421
if response.status_code not in [200, 204]:
422422
map_error(status_code=response.status_code, response=response, error_map=error_map)
423-
error = self._deserialize(_models.ErrorResponse, response)
423+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
424424
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
425425

426426
if cls:

sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/aio/operations/_operations.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Operations:
2525
instantiates it for you and attaches it as an attribute.
2626
2727
:ivar models: Alias to model classes used in this operation group.
28-
:type models: ~azure.mgmt.azurestackhci.models
28+
:type models: ~azure_stack_hci_client.models
2929
:param client: Client for service requests.
3030
:param config: Configuration of service client.
3131
:param serializer: An object model serializer.
@@ -48,7 +48,7 @@ async def list(
4848
4949
:keyword callable cls: A custom type or function that will be passed the direct response
5050
:return: AvailableOperations, or the result of cls(response)
51-
:rtype: ~azure.mgmt.azurestackhci.models.AvailableOperations
51+
:rtype: ~azure_stack_hci_client.models.AvailableOperations
5252
:raises: ~azure.core.exceptions.HttpResponseError
5353
"""
5454
cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"]
@@ -76,7 +76,7 @@ async def list(
7676

7777
if response.status_code not in [200]:
7878
map_error(status_code=response.status_code, response=response, error_map=error_map)
79-
error = self._deserialize(_models.ErrorResponse, response)
79+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
8080
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
8181

8282
deserialized = self._deserialize('AvailableOperations', pipeline_response)

sdk/azurestackhci/azure-mgmt-azurestackhci/azure/mgmt/azurestackhci/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
from ._models import TrackedResource # type: ignore
3737

3838
from ._azure_stack_hci_client_enums import (
39+
CreatedByType,
3940
ProvisioningState,
4041
Status,
4142
)
@@ -54,6 +55,7 @@
5455
'OperationDisplay',
5556
'Resource',
5657
'TrackedResource',
58+
'CreatedByType',
5759
'ProvisioningState',
5860
'Status',
5961
]

0 commit comments

Comments
 (0)