Skip to content

Commit 2185de2

Browse files
[AutoRelease] t2-hanaonazure-2022-10-31-93569(Do not merge) (Azure#27186)
* code and test * Update CHANGELOG.md * Update _version.py * Update CHANGELOG.md Co-authored-by: PythonSdkPipelines <PythonSdkPipelines> Co-authored-by: zhenbiao wei <424401670@qq.com>
1 parent 149bcf7 commit 2185de2

37 files changed

+5160
-2183
lines changed

sdk/hanaonazure/azure-mgmt-hanaonazure/CHANGELOG.md

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

3+
## 1.1.0b1 (2022-10-31)
4+
5+
### Other Changes
6+
7+
- Added generated samples in github repo
8+
- Drop support for python<3.7.0
9+
310
## 1.0.0 (2021-04-12)
411

512
**Breaking changes**
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
{
2-
"autorest": "3.0.6369",
3-
"use": "@autorest/python@5.6.2",
4-
"commit": "58f2489b1dc4752b6470d45e30ed1bd2469741f3",
2+
"commit": "5fc05d0f0b15cbf16de942cadce464b495c66a58",
53
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
6-
"autorest_command": "autorest specification/hanaonazure/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.2 --version=3.0.6369",
4+
"autorest": "3.9.2",
5+
"use": [
6+
"@autorest/python@6.2.1",
7+
"@autorest/modelerfour@4.24.3"
8+
],
9+
"autorest_command": "autorest specification/hanaonazure/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False",
710
"readme": "specification/hanaonazure/resource-manager/readme.md"
811
}

sdk/hanaonazure/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/__init__.py

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

1212
__version__ = VERSION
13-
__all__ = ['HanaManagementClient']
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__ = [
22+
"HanaManagementClient",
23+
]
24+
__all__.extend([p for p in _patch_all if p not in __all__])
25+
26+
_patch_sdk()

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

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

9-
from typing import TYPE_CHECKING
9+
import sys
10+
from typing import Any, TYPE_CHECKING
1011

1112
from azure.core.configuration import Configuration
1213
from azure.core.pipeline import policies
13-
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
14+
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1415

1516
from ._version import VERSION
1617

18+
if sys.version_info >= (3, 8):
19+
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
20+
else:
21+
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
22+
1723
if TYPE_CHECKING:
1824
# pylint: disable=unused-import,ungrouped-imports
19-
from typing import Any
20-
2125
from azure.core.credentials import TokenCredential
2226

2327

24-
class HanaManagementClientConfiguration(Configuration):
28+
class HanaManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
2529
"""Configuration for HanaManagementClient.
2630
2731
Note that all parameters used to create this instance are saved as instance
2832
attributes.
2933
30-
:param credential: Credential needed for the client to connect to Azure.
34+
:param credential: Credential needed for the client to connect to Azure. Required.
3135
:type credential: ~azure.core.credentials.TokenCredential
32-
:param subscription_id: Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
36+
:param subscription_id: Subscription ID which uniquely identify Microsoft Azure subscription.
37+
The subscription ID forms part of the URI for every service call. Required.
3338
:type subscription_id: str
39+
:keyword api_version: Api Version. Default value is "2020-02-07-preview". Note that overriding
40+
this default value may result in unsupported behavior.
41+
:paramtype api_version: str
3442
"""
3543

36-
def __init__(
37-
self,
38-
credential, # type: "TokenCredential"
39-
subscription_id, # type: str
40-
**kwargs # type: Any
41-
):
42-
# type: (...) -> None
44+
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
45+
super(HanaManagementClientConfiguration, self).__init__(**kwargs)
46+
api_version = kwargs.pop("api_version", "2020-02-07-preview") # type: Literal["2020-02-07-preview"]
47+
4348
if credential is None:
4449
raise ValueError("Parameter 'credential' must not be None.")
4550
if subscription_id is None:
4651
raise ValueError("Parameter 'subscription_id' must not be None.")
47-
super(HanaManagementClientConfiguration, self).__init__(**kwargs)
4852

4953
self.credential = credential
5054
self.subscription_id = subscription_id
51-
self.api_version = "2020-02-07-preview"
52-
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
53-
kwargs.setdefault('sdk_moniker', 'mgmt-hanaonazure/{}'.format(VERSION))
55+
self.api_version = api_version
56+
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
57+
kwargs.setdefault("sdk_moniker", "mgmt-hanaonazure/{}".format(VERSION))
5458
self._configure(**kwargs)
5559

5660
def _configure(
57-
self,
58-
**kwargs # type: Any
61+
self, **kwargs # type: Any
5962
):
6063
# type: (...) -> None
61-
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
62-
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
63-
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
64-
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
65-
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
66-
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
67-
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
68-
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
69-
self.authentication_policy = kwargs.get('authentication_policy')
64+
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
65+
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
66+
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
67+
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
68+
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
69+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
70+
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
71+
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
72+
self.authentication_policy = kwargs.get("authentication_policy")
7073
if self.credential and not self.authentication_policy:
71-
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
74+
self.authentication_policy = ARMChallengeAuthenticationPolicy(
75+
self.credential, *self.credential_scopes, **kwargs
76+
)

sdk/hanaonazure/azure-mgmt-hanaonazure/azure/mgmt/hanaonazure/_hana_management_client.py

Lines changed: 54 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,23 @@
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 HanaManagementClientConfiguration
17+
from ._serialization import Deserializer, Serializer
18+
from .operations import Operations, ProviderInstancesOperations, SapMonitorsOperations
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
1923

20-
from ._configuration import HanaManagementClientConfiguration
21-
from .operations import Operations
22-
from .operations import SapMonitorsOperations
23-
from .operations import ProviderInstancesOperations
24-
from . import models
2524

26-
27-
class HanaManagementClient(object):
25+
class HanaManagementClient: # pylint: disable=client-accepts-api-version-keyword
2826
"""HANA on Azure Client.
2927
3028
:ivar operations: Operations operations
@@ -33,38 +31,63 @@ class HanaManagementClient(object):
3331
:vartype sap_monitors: azure.mgmt.hanaonazure.operations.SapMonitorsOperations
3432
:ivar provider_instances: ProviderInstancesOperations operations
3533
:vartype provider_instances: azure.mgmt.hanaonazure.operations.ProviderInstancesOperations
36-
:param credential: Credential needed for the client to connect to Azure.
34+
:param credential: Credential needed for the client to connect to Azure. Required.
3735
:type credential: ~azure.core.credentials.TokenCredential
38-
:param subscription_id: Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
36+
:param subscription_id: Subscription ID which uniquely identify Microsoft Azure subscription.
37+
The subscription ID forms part of the URI for every service call. Required.
3938
:type subscription_id: str
40-
:param str base_url: Service URL
41-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
39+
:param base_url: Service URL. Default value is "https://management.azure.com".
40+
:type base_url: str
41+
:keyword api_version: Api Version. Default value is "2020-02-07-preview". Note that overriding
42+
this default value may result in unsupported behavior.
43+
:paramtype api_version: str
44+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
45+
Retry-After header is present.
4246
"""
4347

4448
def __init__(
4549
self,
46-
credential, # type: "TokenCredential"
47-
subscription_id, # type: str
48-
base_url=None, # type: Optional[str]
49-
**kwargs # type: Any
50-
):
51-
# type: (...) -> None
52-
if not base_url:
53-
base_url = 'https://management.azure.com'
54-
self._config = HanaManagementClientConfiguration(credential, subscription_id, **kwargs)
50+
credential: "TokenCredential",
51+
subscription_id: str,
52+
base_url: str = "https://management.azure.com",
53+
**kwargs: Any
54+
) -> None:
55+
self._config = HanaManagementClientConfiguration(
56+
credential=credential, subscription_id=subscription_id, **kwargs
57+
)
5558
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
5659

5760
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
5861
self._serialize = Serializer(client_models)
59-
self._serialize.client_side_validation = False
6062
self._deserialize = Deserializer(client_models)
61-
62-
self.operations = Operations(
63-
self._client, self._config, self._serialize, self._deserialize)
64-
self.sap_monitors = SapMonitorsOperations(
65-
self._client, self._config, self._serialize, self._deserialize)
63+
self._serialize.client_side_validation = False
64+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
65+
self.sap_monitors = SapMonitorsOperations(self._client, self._config, self._serialize, self._deserialize)
6666
self.provider_instances = ProviderInstancesOperations(
67-
self._client, self._config, self._serialize, self._deserialize)
67+
self._client, self._config, self._serialize, self._deserialize
68+
)
69+
70+
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
71+
"""Runs the network request through the client's chained policies.
72+
73+
>>> from azure.core.rest import HttpRequest
74+
>>> request = HttpRequest("GET", "https://www.example.org/")
75+
<HttpRequest [GET], url: 'https://www.example.org/'>
76+
>>> response = client._send_request(request)
77+
<HttpResponse: 200 OK>
78+
79+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
80+
81+
:param request: The network request you want to make. Required.
82+
:type request: ~azure.core.rest.HttpRequest
83+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
84+
:return: The response of your network call. Does not do error handling on your response.
85+
:rtype: ~azure.core.rest.HttpResponse
86+
"""
87+
88+
request_copy = deepcopy(request)
89+
request_copy.url = self._client.format_url(request_copy.url)
90+
return self._client.send_request(request_copy, **kwargs)
6891

6992
def close(self):
7093
# type: () -> None

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

Lines changed: 0 additions & 111 deletions
This file was deleted.

0 commit comments

Comments
 (0)