Skip to content

Commit 443dfc4

Browse files
author
SDKAuto
committed
CodeGen from PR 13907 in Azure/azure-rest-api-specs
Merge 7d70d64bd69450d7cf36ed90c2c6cbda28a0edee into b601239
1 parent e558eaf commit 443dfc4

15 files changed

+246
-94
lines changed

sdk/portal/azure-mgmt-portal/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/[email protected]",
4+
"commit": "6f89ac3da9e4cf612545ccc3a36aed449cc41ba0",
5+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
6+
"autorest_command": "autorest specification/portal/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] --version=3.3.0",
7+
"readme": "specification/portal/resource-manager/readme.md"
8+
}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
{
2+
"chosen_version": "2020-09-01-preview",
3+
"total_api_version_list": ["2020-09-01-preview"],
4+
"client": {
5+
"name": "Portal",
6+
"filename": "_portal",
7+
"description": "Allows creation and deletion of Azure Shared Dashboards.",
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\": [\"PortalConfiguration\"]}}, \"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\": [\"PortalConfiguration\"]}}, \"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 Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).",
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 Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).",
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+
"dashboards": "DashboardsOperations",
103+
"tenant_configurations": "TenantConfigurationsOperations",
104+
"list_tenant_configuration_violations": "ListTenantConfigurationViolationsOperations"
105+
}
106+
}

sdk/portal/azure-mgmt-portal/azure/mgmt/portal/_portal.py

Lines changed: 19 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 PortalConfiguration
2122
from .operations import Operations
@@ -70,6 +71,24 @@ def __init__(
7071
self.list_tenant_configuration_violations = ListTenantConfigurationViolationsOperations(
7172
self._client, self._config, self._serialize, self._deserialize)
7273

74+
def _send_request(self, http_request, **kwargs):
75+
# type: (HttpRequest, Any) -> HttpResponse
76+
"""Runs the network request through the client's chained policies.
77+
78+
:param http_request: The network request you want to make. Required.
79+
:type http_request: ~azure.core.pipeline.transport.HttpRequest
80+
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
81+
:return: The response of your network call. Does not do error handling on your response.
82+
:rtype: ~azure.core.pipeline.transport.HttpResponse
83+
"""
84+
path_format_arguments = {
85+
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
86+
}
87+
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
88+
stream = kwargs.pop("stream", True)
89+
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
90+
return pipeline_response.http_response
91+
7392
def close(self):
7493
# type: () -> None
7594
self._client.close()

sdk/portal/azure-mgmt-portal/azure/mgmt/portal/aio/_portal.py

Lines changed: 18 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

@@ -67,6 +68,23 @@ def __init__(
6768
self.list_tenant_configuration_violations = ListTenantConfigurationViolationsOperations(
6869
self._client, self._config, self._serialize, self._deserialize)
6970

71+
async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse:
72+
"""Runs the network request through the client's chained policies.
73+
74+
:param http_request: The network request you want to make. Required.
75+
:type http_request: ~azure.core.pipeline.transport.HttpRequest
76+
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
77+
:return: The response of your network call. Does not do error handling on your response.
78+
:rtype: ~azure.core.pipeline.transport.AsyncHttpResponse
79+
"""
80+
path_format_arguments = {
81+
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
82+
}
83+
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
84+
stream = kwargs.pop("stream", True)
85+
pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs)
86+
return pipeline_response.http_response
87+
7088
async def close(self) -> None:
7189
await self._client.close()
7290

sdk/portal/azure-mgmt-portal/azure/mgmt/portal/aio/operations/_dashboards_operations.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ async def create_or_update(
9797

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

103103
if response.status_code == 200:
@@ -160,7 +160,7 @@ async def delete(
160160

161161
if response.status_code not in [200, 204]:
162162
map_error(status_code=response.status_code, response=response, error_map=error_map)
163-
error = self._deserialize(_models.ErrorResponse, response)
163+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
164164
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
165165

166166
if cls:
@@ -216,7 +216,7 @@ async def get(
216216

217217
if response.status_code not in [200, 404]:
218218
map_error(status_code=response.status_code, response=response, error_map=error_map)
219-
error = self._deserialize(_models.ErrorResponse, response)
219+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
220220
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
221221

222222
deserialized = None
@@ -285,7 +285,7 @@ async def update(
285285

286286
if response.status_code not in [200, 404]:
287287
map_error(status_code=response.status_code, response=response, error_map=error_map)
288-
error = self._deserialize(_models.ErrorResponse, response)
288+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
289289
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
290290

291291
deserialized = None
@@ -358,7 +358,7 @@ async def get_next(next_link=None):
358358
response = pipeline_response.http_response
359359

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

@@ -425,7 +425,7 @@ async def get_next(next_link=None):
425425
response = pipeline_response.http_response
426426

427427
if response.status_code not in [200]:
428-
error = self._deserialize(_models.ErrorResponse, response)
428+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
429429
map_error(status_code=response.status_code, response=response, error_map=error_map)
430430
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
431431

sdk/portal/azure-mgmt-portal/azure/mgmt/portal/aio/operations/_list_tenant_configuration_violations_operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ async def get_next(next_link=None):
9393
response = pipeline_response.http_response
9494

9595
if response.status_code not in [200]:
96-
error = self._deserialize(_models.ErrorResponse, response)
96+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
9797
map_error(status_code=response.status_code, response=response, error_map=error_map)
9898
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
9999

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ async def get_next(next_link=None):
9393
response = pipeline_response.http_response
9494

9595
if response.status_code not in [200]:
96-
error = self._deserialize(_models.ErrorResponse, response)
96+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
9797
map_error(status_code=response.status_code, response=response, error_map=error_map)
9898
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
9999

sdk/portal/azure-mgmt-portal/azure/mgmt/portal/aio/operations/_tenant_configurations_operations.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ async def get_next(next_link=None):
9393
response = pipeline_response.http_response
9494

9595
if response.status_code not in [200]:
96-
error = self._deserialize(_models.ErrorResponse, response)
96+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
9797
map_error(status_code=response.status_code, response=response, error_map=error_map)
9898
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
9999

@@ -147,7 +147,7 @@ async def get(
147147

148148
if response.status_code not in [200, 404]:
149149
map_error(status_code=response.status_code, response=response, error_map=error_map)
150-
error = self._deserialize(_models.ErrorResponse, response)
150+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
151151
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
152152

153153
deserialized = None
@@ -212,7 +212,7 @@ async def create(
212212

213213
if response.status_code not in [200, 201]:
214214
map_error(status_code=response.status_code, response=response, error_map=error_map)
215-
error = self._deserialize(_models.ErrorResponse, response)
215+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
216216
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
217217

218218
if response.status_code == 200:
@@ -270,7 +270,7 @@ async def delete(
270270

271271
if response.status_code not in [200, 204]:
272272
map_error(status_code=response.status_code, response=response, error_map=error_map)
273-
error = self._deserialize(_models.ErrorResponse, response)
273+
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response)
274274
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
275275

276276
if cls:

sdk/portal/azure-mgmt-portal/azure/mgmt/portal/models/_models.py

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,41 @@ def __init__(
4747
self.type = None
4848

4949

50-
class Configuration(Resource):
50+
class ProxyResource(Resource):
51+
"""The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location.
52+
53+
Variables are only populated by the server, and will be ignored when sending a request.
54+
55+
:ivar id: Fully qualified resource ID for the resource. Ex -
56+
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
57+
:vartype id: str
58+
:ivar name: The name of the resource.
59+
:vartype name: str
60+
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
61+
"Microsoft.Storage/storageAccounts".
62+
:vartype type: str
63+
"""
64+
65+
_validation = {
66+
'id': {'readonly': True},
67+
'name': {'readonly': True},
68+
'type': {'readonly': True},
69+
}
70+
71+
_attribute_map = {
72+
'id': {'key': 'id', 'type': 'str'},
73+
'name': {'key': 'name', 'type': 'str'},
74+
'type': {'key': 'type', 'type': 'str'},
75+
}
76+
77+
def __init__(
78+
self,
79+
**kwargs
80+
):
81+
super(ProxyResource, self).__init__(**kwargs)
82+
83+
84+
class Configuration(ProxyResource):
5185
"""Tenant configuration.
5286
5387
Variables are only populated by the server, and will be ignored when sending a request.
@@ -512,40 +546,6 @@ def __init__(
512546
self.metadata = kwargs.get('metadata', None)
513547

514548

515-
class ProxyResource(Resource):
516-
"""The resource model definition for an Azure Resource Manager proxy resource. It will have everything other than required location and tags.
517-
518-
Variables are only populated by the server, and will be ignored when sending a request.
519-
520-
:ivar id: Fully qualified resource ID for the resource. Ex -
521-
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
522-
:vartype id: str
523-
:ivar name: The name of the resource.
524-
:vartype name: str
525-
:ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or
526-
"Microsoft.Storage/storageAccounts".
527-
:vartype type: str
528-
"""
529-
530-
_validation = {
531-
'id': {'readonly': True},
532-
'name': {'readonly': True},
533-
'type': {'readonly': True},
534-
}
535-
536-
_attribute_map = {
537-
'id': {'key': 'id', 'type': 'str'},
538-
'name': {'key': 'name', 'type': 'str'},
539-
'type': {'key': 'type', 'type': 'str'},
540-
}
541-
542-
def __init__(
543-
self,
544-
**kwargs
545-
):
546-
super(ProxyResource, self).__init__(**kwargs)
547-
548-
549549
class ResourceProviderOperation(msrest.serialization.Model):
550550
"""Supported operations of this resource provider.
551551

0 commit comments

Comments
 (0)