Skip to content

Commit 8b302fb

Browse files
azure-sdkmsyyc
andauthored
[AutoRelease] t2-resourcegraph-2022-08-30-79632(Do not merge) (Azure#25953)
* code and test * Update CHANGELOG.md * Update _version.py Co-authored-by: PythonSdkPipelines <PythonSdkPipelines> Co-authored-by: Yuchao Yan <yuchaoyan@microsoft.com>
1 parent d8c47ab commit 8b302fb

28 files changed

+4369
-1592
lines changed

sdk/resources/azure-mgmt-resourcegraph/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Release History
22

3+
## 8.1.0b2 (2022-08-30)
4+
5+
### Other Changes
6+
7+
- Regular update
8+
39
## 8.1.0b1 (2021-04-25)
410

511
**Features**
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
{
2-
"autorest": "3.3.0",
3-
"use": "@autorest/python@5.6.6",
4-
"commit": "a144e3b668c2712808ddf0025005cc13becad93a",
2+
"autorest": "3.8.4",
3+
"use": [
4+
"@autorest/python@6.0.1",
5+
"@autorest/modelerfour@4.23.5"
6+
],
7+
"commit": "ee364f685feedb2ad905c682b57117f9006f541f",
58
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
6-
"autorest_command": "autorest specification/resourcegraph/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",
9+
"autorest_command": "autorest specification/resourcegraph/resource-manager/readme.md --models-mode=msrest --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --tag=package-preview-2021-03 --use=@autorest/python@6.0.1 --use=@autorest/modelerfour@4.23.5 --version=3.8.4 --version-tolerant=False",
710
"readme": "specification/resourcegraph/resource-manager/readme.md"
811
}

sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/__init__.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@
1010
from ._version import VERSION
1111

1212
__version__ = VERSION
13-
__all__ = ['ResourceGraphClient']
1413

1514
try:
16-
from ._patch import patch_sdk # type: ignore
17-
patch_sdk()
15+
from ._patch import __all__ as _patch_all
16+
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
1817
except ImportError:
19-
pass
18+
_patch_all = []
19+
from ._patch import patch_sdk as _patch_sdk
20+
21+
__all__ = ["ResourceGraphClient"]
22+
__all__.extend([p for p in _patch_all if p not in __all__])
23+
24+
_patch_sdk()

sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/_configuration.py

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,59 +6,53 @@
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

24-
class ResourceGraphClientConfiguration(Configuration):
22+
class ResourceGraphClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
2523
"""Configuration for ResourceGraphClient.
2624
2725
Note that all parameters used to create this instance are saved as instance
2826
attributes.
2927
30-
:param credential: Credential needed for the client to connect to Azure.
28+
:param credential: Credential needed for the client to connect to Azure. Required.
3129
:type credential: ~azure.core.credentials.TokenCredential
3230
"""
3331

34-
def __init__(
35-
self,
36-
credential, # type: "TokenCredential"
37-
**kwargs # type: Any
38-
):
39-
# type: (...) -> None
32+
def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None:
33+
super(ResourceGraphClientConfiguration, self).__init__(**kwargs)
4034
if credential is None:
4135
raise ValueError("Parameter 'credential' must not be None.")
42-
super(ResourceGraphClientConfiguration, self).__init__(**kwargs)
4336

4437
self.credential = credential
45-
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
46-
kwargs.setdefault('sdk_moniker', 'mgmt-resourcegraph/{}'.format(VERSION))
38+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
39+
kwargs.setdefault("sdk_moniker", "mgmt-resourcegraph/{}".format(VERSION))
4740
self._configure(**kwargs)
4841

4942
def _configure(
50-
self,
51-
**kwargs # type: Any
43+
self, **kwargs # type: Any
5244
):
5345
# type: (...) -> None
54-
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
55-
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
56-
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
57-
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
58-
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
59-
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
60-
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
61-
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
62-
self.authentication_policy = kwargs.get('authentication_policy')
46+
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
47+
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
48+
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
49+
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
50+
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
51+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
52+
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
53+
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
54+
self.authentication_policy = kwargs.get("authentication_policy")
6355
if self.credential and not self.authentication_policy:
64-
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
56+
self.authentication_policy = ARMChallengeAuthenticationPolicy(
57+
self.credential, *self.credential_scopes, **kwargs
58+
)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# ------------------------------------
2+
# Copyright (c) Microsoft Corporation.
3+
# Licensed under the MIT License.
4+
# ------------------------------------
5+
"""Customize generated code here.
6+
7+
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
8+
"""
9+
from typing import List
10+
11+
__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
12+
13+
14+
def patch_sdk():
15+
"""Do not remove from this file.
16+
17+
`patch_sdk` is a last resort escape hatch that allows you to do customizations
18+
you can't accomplish using the techniques described in
19+
https://aka.ms/azsdk/python/dpcodegen/python/customize
20+
"""

sdk/resources/azure-mgmt-resourcegraph/azure/mgmt/resourcegraph/_resource_graph_client.py

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,68 +6,66 @@
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, TYPE_CHECKING
1011

12+
from azure.core.rest import HttpRequest, HttpResponse
1113
from azure.mgmt.core import ARMPipelineClient
12-
from msrest import Deserializer, Serializer
14+
15+
from . import models
16+
from ._configuration import ResourceGraphClientConfiguration
17+
from ._serialization import Deserializer, Serializer
18+
from .operations import Operations, ResourceGraphClientOperationsMixin
1319

1420
if TYPE_CHECKING:
1521
# pylint: disable=unused-import,ungrouped-imports
16-
from typing import Any, Optional
17-
1822
from azure.core.credentials import TokenCredential
19-
from azure.core.pipeline.transport import HttpRequest, HttpResponse
20-
21-
from ._configuration import ResourceGraphClientConfiguration
22-
from .operations import ResourceGraphClientOperationsMixin
23-
from .operations import Operations
24-
from . import models
2523

2624

27-
class ResourceGraphClient(ResourceGraphClientOperationsMixin):
25+
class ResourceGraphClient(ResourceGraphClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword
2826
"""Azure Resource Graph API Reference.
2927
3028
:ivar operations: Operations operations
3129
:vartype operations: azure.mgmt.resourcegraph.operations.Operations
32-
:param credential: Credential needed for the client to connect to Azure.
30+
:param credential: Credential needed for the client to connect to Azure. Required.
3331
:type credential: ~azure.core.credentials.TokenCredential
34-
:param str base_url: Service URL
32+
:param base_url: Service URL. Default value is "https://management.azure.com".
33+
:type base_url: str
3534
"""
3635

3736
def __init__(
38-
self,
39-
credential, # type: "TokenCredential"
40-
base_url=None, # type: Optional[str]
41-
**kwargs # type: Any
42-
):
43-
# type: (...) -> None
44-
if not base_url:
45-
base_url = 'https://management.azure.com'
46-
self._config = ResourceGraphClientConfiguration(credential, **kwargs)
37+
self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any
38+
) -> None:
39+
self._config = ResourceGraphClientConfiguration(credential=credential, **kwargs)
4740
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
4841

4942
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
5043
self._serialize = Serializer(client_models)
51-
self._serialize.client_side_validation = False
5244
self._deserialize = Deserializer(client_models)
45+
self._serialize.client_side_validation = False
46+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
5347

54-
self.operations = Operations(
55-
self._client, self._config, self._serialize, self._deserialize)
56-
57-
def _send_request(self, http_request, **kwargs):
58-
# type: (HttpRequest, Any) -> HttpResponse
48+
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
5949
"""Runs the network request through the client's chained policies.
6050
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.
51+
>>> from azure.core.rest import HttpRequest
52+
>>> request = HttpRequest("GET", "https://www.example.org/")
53+
<HttpRequest [GET], url: 'https://www.example.org/'>
54+
>>> response = client._send_request(request)
55+
<HttpResponse: 200 OK>
56+
57+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
58+
59+
:param request: The network request you want to make. Required.
60+
:type request: ~azure.core.rest.HttpRequest
61+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
6462
:return: The response of your network call. Does not do error handling on your response.
65-
:rtype: ~azure.core.pipeline.transport.HttpResponse
63+
:rtype: ~azure.core.rest.HttpResponse
6664
"""
67-
http_request.url = self._client.format_url(http_request.url)
68-
stream = kwargs.pop("stream", True)
69-
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
70-
return pipeline_response.http_response
65+
66+
request_copy = deepcopy(request)
67+
request_copy.url = self._client.format_url(request_copy.url)
68+
return self._client.send_request(request_copy, **kwargs)
7169

7270
def close(self):
7371
# type: () -> None

0 commit comments

Comments
 (0)