Skip to content

Commit f311566

Browse files
author
SDKAuto
committed
CodeGen from PR 17681 in Azure/azure-rest-api-specs
Merge aeb36ab42b4dd6cf93a368470cda52495faa29d6 into 3f59f46
1 parent 0270426 commit f311566

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+7362
-2818
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"autorest": "3.4.5",
2+
"autorest": "3.7.2",
33
"use": [
4-
"@autorest/python@5.8.4",
5-
"@autorest/modelerfour@4.19.2"
4+
"@autorest/python@5.12.0",
5+
"@autorest/modelerfour@4.19.3"
66
],
7-
"commit": "e687b0f9c1856f7f20e1c0e1aca53b1e342cde3e",
7+
"commit": "3025415dd6fddb314748f848b04aaea203ca59e1",
88
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9-
"autorest_command": "autorest specification/extendedlocation/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.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5",
9+
"autorest_command": "autorest specification/extendedlocation/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2",
1010
"readme": "specification/extendedlocation/resource-manager/readme.md"
1111
}

sdk/extendedlocation/azure-mgmt-extendedlocation/azure/mgmt/extendedlocation/_configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from azure.core.configuration import Configuration
1414
from azure.core.pipeline import policies
15-
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
15+
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1616

1717
from ._version import VERSION
1818

@@ -68,4 +68,4 @@ def _configure(
6868
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
6969
self.authentication_policy = kwargs.get('authentication_policy')
7070
if self.credential and not self.authentication_policy:
71-
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
71+
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)

sdk/extendedlocation/azure-mgmt-extendedlocation/azure/mgmt/extendedlocation/_custom_locations.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
from typing import Any, Optional
2424

2525
from azure.core.credentials import TokenCredential
26-
from azure.core.pipeline.transport import HttpRequest, HttpResponse
2726

2827
class _SDKClient(object):
2928
def __init__(self, *args, **kwargs):
@@ -70,12 +69,10 @@ def __init__(
7069
credential, # type: "TokenCredential"
7170
subscription_id, # type: str
7271
api_version=None, # type: Optional[str]
73-
base_url=None, # type: Optional[str]
72+
base_url="https://management.azure.com", # type: str
7473
profile=KnownProfiles.default, # type: KnownProfiles
7574
**kwargs # type: Any
7675
):
77-
if not base_url:
78-
base_url = 'https://management.azure.com'
7976
self._config = CustomLocationsConfiguration(credential, subscription_id, **kwargs)
8077
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
8178
super(CustomLocations, self).__init__(
@@ -93,13 +90,17 @@ def models(cls, api_version=DEFAULT_API_VERSION):
9390
9491
* 2021-03-15-preview: :mod:`v2021_03_15_preview.models<azure.mgmt.extendedlocation.v2021_03_15_preview.models>`
9592
* 2021-08-15: :mod:`v2021_08_15.models<azure.mgmt.extendedlocation.v2021_08_15.models>`
93+
* 2021-08-31-preview: :mod:`v2021_08_31_preview.models<azure.mgmt.extendedlocation.v2021_08_31_preview.models>`
9694
"""
9795
if api_version == '2021-03-15-preview':
9896
from .v2021_03_15_preview import models
9997
return models
10098
elif api_version == '2021-08-15':
10199
from .v2021_08_15 import models
102100
return models
101+
elif api_version == '2021-08-31-preview':
102+
from .v2021_08_31_preview import models
103+
return models
103104
raise ValueError("API version {} is not available".format(api_version))
104105

105106
@property
@@ -108,16 +109,32 @@ def custom_locations(self):
108109
109110
* 2021-03-15-preview: :class:`CustomLocationsOperations<azure.mgmt.extendedlocation.v2021_03_15_preview.operations.CustomLocationsOperations>`
110111
* 2021-08-15: :class:`CustomLocationsOperations<azure.mgmt.extendedlocation.v2021_08_15.operations.CustomLocationsOperations>`
112+
* 2021-08-31-preview: :class:`CustomLocationsOperations<azure.mgmt.extendedlocation.v2021_08_31_preview.operations.CustomLocationsOperations>`
111113
"""
112114
api_version = self._get_api_version('custom_locations')
113115
if api_version == '2021-03-15-preview':
114116
from .v2021_03_15_preview.operations import CustomLocationsOperations as OperationClass
115117
elif api_version == '2021-08-15':
116118
from .v2021_08_15.operations import CustomLocationsOperations as OperationClass
119+
elif api_version == '2021-08-31-preview':
120+
from .v2021_08_31_preview.operations import CustomLocationsOperations as OperationClass
117121
else:
118122
raise ValueError("API version {} does not have operation group 'custom_locations'".format(api_version))
119123
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
120124

125+
@property
126+
def resource_sync_rules(self):
127+
"""Instance depends on the API version:
128+
129+
* 2021-08-31-preview: :class:`ResourceSyncRulesOperations<azure.mgmt.extendedlocation.v2021_08_31_preview.operations.ResourceSyncRulesOperations>`
130+
"""
131+
api_version = self._get_api_version('resource_sync_rules')
132+
if api_version == '2021-08-31-preview':
133+
from .v2021_08_31_preview.operations import ResourceSyncRulesOperations as OperationClass
134+
else:
135+
raise ValueError("API version {} does not have operation group 'resource_sync_rules'".format(api_version))
136+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
137+
121138
def close(self):
122139
self._client.close()
123140
def __enter__(self):

sdk/extendedlocation/azure-mgmt-extendedlocation/azure/mgmt/extendedlocation/aio/_configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from azure.core.configuration import Configuration
1414
from azure.core.pipeline import policies
15-
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
15+
from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
1616

1717
from .._version import VERSION
1818

@@ -64,4 +64,4 @@ def _configure(
6464
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
6565
self.authentication_policy = kwargs.get('authentication_policy')
6666
if self.credential and not self.authentication_policy:
67-
self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
67+
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)

sdk/extendedlocation/azure-mgmt-extendedlocation/azure/mgmt/extendedlocation/aio/_custom_locations.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
from typing import Any, Optional, TYPE_CHECKING
1313

14-
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
1514
from azure.mgmt.core import AsyncARMPipelineClient
1615
from azure.profiles import KnownProfiles, ProfileDefinition
1716
from azure.profiles.multiapiclient import MultiApiClientMixin
@@ -21,6 +20,7 @@
2120

2221
if TYPE_CHECKING:
2322
# pylint: disable=unused-import,ungrouped-imports
23+
from azure.core.credentials import TokenCredential
2424
from azure.core.credentials_async import AsyncTokenCredential
2525

2626
class _SDKClient(object):
@@ -68,12 +68,10 @@ def __init__(
6868
credential: "AsyncTokenCredential",
6969
subscription_id: str,
7070
api_version: Optional[str] = None,
71-
base_url: Optional[str] = None,
71+
base_url: str = "https://management.azure.com",
7272
profile: KnownProfiles = KnownProfiles.default,
7373
**kwargs # type: Any
7474
) -> None:
75-
if not base_url:
76-
base_url = 'https://management.azure.com'
7775
self._config = CustomLocationsConfiguration(credential, subscription_id, **kwargs)
7876
self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
7977
super(CustomLocations, self).__init__(
@@ -91,13 +89,17 @@ def models(cls, api_version=DEFAULT_API_VERSION):
9189
9290
* 2021-03-15-preview: :mod:`v2021_03_15_preview.models<azure.mgmt.extendedlocation.v2021_03_15_preview.models>`
9391
* 2021-08-15: :mod:`v2021_08_15.models<azure.mgmt.extendedlocation.v2021_08_15.models>`
92+
* 2021-08-31-preview: :mod:`v2021_08_31_preview.models<azure.mgmt.extendedlocation.v2021_08_31_preview.models>`
9493
"""
9594
if api_version == '2021-03-15-preview':
9695
from ..v2021_03_15_preview import models
9796
return models
9897
elif api_version == '2021-08-15':
9998
from ..v2021_08_15 import models
10099
return models
100+
elif api_version == '2021-08-31-preview':
101+
from ..v2021_08_31_preview import models
102+
return models
101103
raise ValueError("API version {} is not available".format(api_version))
102104

103105
@property
@@ -106,16 +108,32 @@ def custom_locations(self):
106108
107109
* 2021-03-15-preview: :class:`CustomLocationsOperations<azure.mgmt.extendedlocation.v2021_03_15_preview.aio.operations.CustomLocationsOperations>`
108110
* 2021-08-15: :class:`CustomLocationsOperations<azure.mgmt.extendedlocation.v2021_08_15.aio.operations.CustomLocationsOperations>`
111+
* 2021-08-31-preview: :class:`CustomLocationsOperations<azure.mgmt.extendedlocation.v2021_08_31_preview.aio.operations.CustomLocationsOperations>`
109112
"""
110113
api_version = self._get_api_version('custom_locations')
111114
if api_version == '2021-03-15-preview':
112115
from ..v2021_03_15_preview.aio.operations import CustomLocationsOperations as OperationClass
113116
elif api_version == '2021-08-15':
114117
from ..v2021_08_15.aio.operations import CustomLocationsOperations as OperationClass
118+
elif api_version == '2021-08-31-preview':
119+
from ..v2021_08_31_preview.aio.operations import CustomLocationsOperations as OperationClass
115120
else:
116121
raise ValueError("API version {} does not have operation group 'custom_locations'".format(api_version))
117122
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
118123

124+
@property
125+
def resource_sync_rules(self):
126+
"""Instance depends on the API version:
127+
128+
* 2021-08-31-preview: :class:`ResourceSyncRulesOperations<azure.mgmt.extendedlocation.v2021_08_31_preview.aio.operations.ResourceSyncRulesOperations>`
129+
"""
130+
api_version = self._get_api_version('resource_sync_rules')
131+
if api_version == '2021-08-31-preview':
132+
from ..v2021_08_31_preview.aio.operations import ResourceSyncRulesOperations as OperationClass
133+
else:
134+
raise ValueError("API version {} does not have operation group 'resource_sync_rules'".format(api_version))
135+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
136+
119137
async def close(self):
120138
await self._client.close()
121139
async def __aenter__(self):

sdk/extendedlocation/azure-mgmt-extendedlocation/azure/mgmt/extendedlocation/v2021_03_15_preview/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
__version__ = VERSION
1313
__all__ = ['CustomLocations']
1414

15-
try:
16-
from ._patch import patch_sdk # type: ignore
17-
patch_sdk()
18-
except ImportError:
19-
pass
15+
# `._patch.py` is used for handwritten extensions to the generated code
16+
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
17+
from ._patch import patch_sdk
18+
patch_sdk()

sdk/extendedlocation/azure-mgmt-extendedlocation/azure/mgmt/extendedlocation/v2021_03_15_preview/_configuration.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,16 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from typing import TYPE_CHECKING
9+
from typing import Any, TYPE_CHECKING
1010

1111
from azure.core.configuration import Configuration
1212
from azure.core.pipeline import policies
13-
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
13+
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1414

1515
from ._version import VERSION
1616

1717
if TYPE_CHECKING:
1818
# pylint: disable=unused-import,ungrouped-imports
19-
from typing import Any
20-
2119
from azure.core.credentials import TokenCredential
2220

2321

@@ -35,16 +33,15 @@ class CustomLocationsConfiguration(Configuration):
3533

3634
def __init__(
3735
self,
38-
credential, # type: "TokenCredential"
39-
subscription_id, # type: str
40-
**kwargs # type: Any
41-
):
42-
# type: (...) -> None
36+
credential: "TokenCredential",
37+
subscription_id: str,
38+
**kwargs: Any
39+
) -> None:
40+
super(CustomLocationsConfiguration, self).__init__(**kwargs)
4341
if credential is None:
4442
raise ValueError("Parameter 'credential' must not be None.")
4543
if subscription_id is None:
4644
raise ValueError("Parameter 'subscription_id' must not be None.")
47-
super(CustomLocationsConfiguration, self).__init__(**kwargs)
4845

4946
self.credential = credential
5047
self.subscription_id = subscription_id
@@ -68,4 +65,4 @@ def _configure(
6865
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
6966
self.authentication_policy = kwargs.get('authentication_policy')
7067
if self.credential and not self.authentication_policy:
71-
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
68+
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)

sdk/extendedlocation/azure-mgmt-extendedlocation/azure/mgmt/extendedlocation/v2021_03_15_preview/_custom_locations.py

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6,74 +6,79 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from typing import TYPE_CHECKING
9+
from copy import deepcopy
10+
from typing import Any, Optional, TYPE_CHECKING
1011

12+
from azure.core.rest import HttpRequest, HttpResponse
1113
from azure.mgmt.core import ARMPipelineClient
1214
from msrest import Deserializer, Serializer
1315

14-
if TYPE_CHECKING:
15-
# pylint: disable=unused-import,ungrouped-imports
16-
from typing import Any, Optional
17-
18-
from azure.core.credentials import TokenCredential
19-
from azure.core.pipeline.transport import HttpRequest, HttpResponse
20-
16+
from . import models
2117
from ._configuration import CustomLocationsConfiguration
2218
from .operations import CustomLocationsOperations
23-
from . import models
2419

20+
if TYPE_CHECKING:
21+
# pylint: disable=unused-import,ungrouped-imports
22+
from azure.core.credentials import TokenCredential
2523

26-
class CustomLocations(object):
24+
class CustomLocations:
2725
"""The customLocations Rest API spec.
2826
2927
:ivar custom_locations: CustomLocationsOperations operations
30-
:vartype custom_locations: azure.mgmt.extendedlocation.v2021_03_15_preview.operations.CustomLocationsOperations
28+
:vartype custom_locations:
29+
azure.mgmt.extendedlocation.v2021_03_15_preview.operations.CustomLocationsOperations
3130
:param credential: Credential needed for the client to connect to Azure.
3231
:type credential: ~azure.core.credentials.TokenCredential
3332
:param subscription_id: The ID of the target subscription.
3433
:type subscription_id: str
35-
:param str base_url: Service URL
36-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
34+
:param base_url: Service URL. Default value is 'https://management.azure.com'.
35+
:type base_url: str
36+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
37+
Retry-After header is present.
3738
"""
3839

3940
def __init__(
4041
self,
41-
credential, # type: "TokenCredential"
42-
subscription_id, # type: str
43-
base_url=None, # type: Optional[str]
44-
**kwargs # type: Any
45-
):
46-
# type: (...) -> None
47-
if not base_url:
48-
base_url = 'https://management.azure.com'
49-
self._config = CustomLocationsConfiguration(credential, subscription_id, **kwargs)
42+
credential: "TokenCredential",
43+
subscription_id: str,
44+
base_url: str = "https://management.azure.com",
45+
**kwargs: Any
46+
) -> None:
47+
self._config = CustomLocationsConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
5048
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
5149

5250
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
5351
self._serialize = Serializer(client_models)
54-
self._serialize.client_side_validation = False
5552
self._deserialize = Deserializer(client_models)
53+
self._serialize.client_side_validation = False
54+
self.custom_locations = CustomLocationsOperations(self._client, self._config, self._serialize, self._deserialize)
5655

57-
self.custom_locations = CustomLocationsOperations(
58-
self._client, self._config, self._serialize, self._deserialize)
5956

60-
def _send_request(self, http_request, **kwargs):
61-
# type: (HttpRequest, Any) -> HttpResponse
57+
def _send_request(
58+
self,
59+
request, # type: HttpRequest
60+
**kwargs: Any
61+
) -> HttpResponse:
6262
"""Runs the network request through the client's chained policies.
6363
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.
64+
>>> from azure.core.rest import HttpRequest
65+
>>> request = HttpRequest("GET", "https://www.example.org/")
66+
<HttpRequest [GET], url: 'https://www.example.org/'>
67+
>>> response = client._send_request(request)
68+
<HttpResponse: 200 OK>
69+
70+
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
71+
72+
:param request: The network request you want to make. Required.
73+
:type request: ~azure.core.rest.HttpRequest
74+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
6775
:return: The response of your network call. Does not do error handling on your response.
68-
:rtype: ~azure.core.pipeline.transport.HttpResponse
76+
:rtype: ~azure.core.rest.HttpResponse
6977
"""
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 = self._client._pipeline.run(http_request, stream=stream, **kwargs)
76-
return pipeline_response.http_response
78+
79+
request_copy = deepcopy(request)
80+
request_copy.url = self._client.format_url(request_copy.url)
81+
return self._client.send_request(request_copy, **kwargs)
7782

7883
def close(self):
7984
# type: () -> None

0 commit comments

Comments
 (0)