Skip to content

Commit 3513d3a

Browse files
author
SDKAuto
committed
CodeGen from PR 32152 in Azure/azure-rest-api-specs
Merge 88c86a07729c466b1d4f1e6d1003cbe0ac65f90a into 39477c278ff6dee26d9b1d2fafef6fc281d98f25
1 parent a6359b6 commit 3513d3a

File tree

83 files changed

+14422
-5154
lines changed

Some content is hidden

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

83 files changed

+14422
-5154
lines changed

sdk/hybridconnectivity/azure-mgmt-hybridconnectivity/README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Microsoft Azure SDK for Python
22

33
This is the Microsoft Azure Hybridconnectivity Management Client Library.
4-
This package has been tested with Python 3.7+.
4+
This package has been tested with Python 3.8+.
55
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
66

77
## _Disclaimer_
@@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For
1212

1313
### Prerequisites
1414

15-
- Python 3.7+ is required to use this package.
15+
- Python 3.8+ is required to use this package.
1616
- [Azure subscription](https://azure.microsoft.com/free/)
1717

1818
### Install the package
@@ -59,6 +59,3 @@ Code samples for this package can be found at:
5959
If you encounter any bugs or have suggestions, please file an issue in the
6060
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
6161
section of the project.
62-
63-
64-
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-hybridconnectivity%2FREADME.png)
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
2-
"commit": "95c0363e4cae8756c6a33b58add67776db427bbc",
2+
"commit": "a1072d2084ad97e5cbace060e90fe9e5df4f979c",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4-
"autorest": "3.9.7",
5-
"use": [
6-
"@autorest/[email protected]",
7-
"@autorest/[email protected]"
8-
],
9-
"autorest_command": "autorest specification/hybridconnectivity/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/[email protected] --use=@autorest/[email protected] --version=3.9.7 --version-tolerant=False",
10-
"readme": "specification/hybridconnectivity/resource-manager/readme.md"
4+
"typespec_src": "specification/hybridconnectivity/HybridConnectivity.Management",
5+
"@azure-tools/typespec-python": "0.38.0"
116
}

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,31 @@
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
44
# Licensed under the MIT License. See License.txt in the project root for license information.
5-
# Code generated by Microsoft (R) AutoRest Code Generator.
5+
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
89

9-
from ._hybrid_connectivity_mgmt_client import HybridConnectivityMgmtClient
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._client import HybridConnectivityMgmtClient # type: ignore
1016
from ._version import VERSION
1117

1218
__version__ = VERSION
1319

1420
try:
1521
from ._patch import __all__ as _patch_all
16-
from ._patch import * # pylint: disable=unused-wildcard-import
22+
from ._patch import *
1723
except ImportError:
1824
_patch_all = []
1925
from ._patch import patch_sdk as _patch_sdk
2026

2127
__all__ = [
2228
"HybridConnectivityMgmtClient",
2329
]
24-
__all__.extend([p for p in _patch_all if p not in __all__])
30+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
2531

2632
_patch_sdk()
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) Python Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from copy import deepcopy
10+
from typing import Any, TYPE_CHECKING
11+
from typing_extensions import Self
12+
13+
from azure.core.pipeline import policies
14+
from azure.core.rest import HttpRequest, HttpResponse
15+
from azure.mgmt.core import ARMPipelineClient
16+
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
17+
18+
from ._configuration import HybridConnectivityMgmtClientConfiguration
19+
from ._serialization import Deserializer, Serializer
20+
from .operations import (
21+
EndpointsOperations,
22+
GenerateAwsTemplateOperations,
23+
InventoryOperations,
24+
Operations,
25+
PublicCloudConnectorsOperations,
26+
ServiceConfigurationsOperations,
27+
SolutionConfigurationsOperations,
28+
SolutionTypesOperations,
29+
)
30+
31+
if TYPE_CHECKING:
32+
from azure.core.credentials import TokenCredential
33+
34+
35+
class HybridConnectivityMgmtClient: # pylint: disable=too-many-instance-attributes
36+
"""REST API for public clouds.
37+
38+
:ivar operations: Operations operations
39+
:vartype operations: azure.mgmt.hybridconnectivity.operations.Operations
40+
:ivar endpoints: EndpointsOperations operations
41+
:vartype endpoints: azure.mgmt.hybridconnectivity.operations.EndpointsOperations
42+
:ivar service_configurations: ServiceConfigurationsOperations operations
43+
:vartype service_configurations:
44+
azure.mgmt.hybridconnectivity.operations.ServiceConfigurationsOperations
45+
:ivar generate_aws_template: GenerateAwsTemplateOperations operations
46+
:vartype generate_aws_template:
47+
azure.mgmt.hybridconnectivity.operations.GenerateAwsTemplateOperations
48+
:ivar public_cloud_connectors: PublicCloudConnectorsOperations operations
49+
:vartype public_cloud_connectors:
50+
azure.mgmt.hybridconnectivity.operations.PublicCloudConnectorsOperations
51+
:ivar solution_configurations: SolutionConfigurationsOperations operations
52+
:vartype solution_configurations:
53+
azure.mgmt.hybridconnectivity.operations.SolutionConfigurationsOperations
54+
:ivar inventory: InventoryOperations operations
55+
:vartype inventory: azure.mgmt.hybridconnectivity.operations.InventoryOperations
56+
:ivar solution_types: SolutionTypesOperations operations
57+
:vartype solution_types: azure.mgmt.hybridconnectivity.operations.SolutionTypesOperations
58+
:param credential: Credential used to authenticate requests to the service. Required.
59+
:type credential: ~azure.core.credentials.TokenCredential
60+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
61+
:type subscription_id: str
62+
:param base_url: Service host. Default value is "https://management.azure.com".
63+
:type base_url: str
64+
:keyword api_version: The API version to use for this operation. Default value is "2024-12-01".
65+
Note that overriding this default value may result in unsupported behavior.
66+
:paramtype api_version: str
67+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
68+
Retry-After header is present.
69+
"""
70+
71+
def __init__(
72+
self,
73+
credential: "TokenCredential",
74+
subscription_id: str,
75+
base_url: str = "https://management.azure.com",
76+
**kwargs: Any
77+
) -> None:
78+
_endpoint = "{endpoint}"
79+
self._config = HybridConnectivityMgmtClientConfiguration(
80+
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
81+
)
82+
_policies = kwargs.pop("policies", None)
83+
if _policies is None:
84+
_policies = [
85+
policies.RequestIdPolicy(**kwargs),
86+
self._config.headers_policy,
87+
self._config.user_agent_policy,
88+
self._config.proxy_policy,
89+
policies.ContentDecodePolicy(**kwargs),
90+
ARMAutoResourceProviderRegistrationPolicy(),
91+
self._config.redirect_policy,
92+
self._config.retry_policy,
93+
self._config.authentication_policy,
94+
self._config.custom_hook_policy,
95+
self._config.logging_policy,
96+
policies.DistributedTracingPolicy(**kwargs),
97+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
98+
self._config.http_logging_policy,
99+
]
100+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
101+
102+
self._serialize = Serializer()
103+
self._deserialize = Deserializer()
104+
self._serialize.client_side_validation = False
105+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
106+
self.endpoints = EndpointsOperations(self._client, self._config, self._serialize, self._deserialize)
107+
self.service_configurations = ServiceConfigurationsOperations(
108+
self._client, self._config, self._serialize, self._deserialize
109+
)
110+
self.generate_aws_template = GenerateAwsTemplateOperations(
111+
self._client, self._config, self._serialize, self._deserialize
112+
)
113+
self.public_cloud_connectors = PublicCloudConnectorsOperations(
114+
self._client, self._config, self._serialize, self._deserialize
115+
)
116+
self.solution_configurations = SolutionConfigurationsOperations(
117+
self._client, self._config, self._serialize, self._deserialize
118+
)
119+
self.inventory = InventoryOperations(self._client, self._config, self._serialize, self._deserialize)
120+
self.solution_types = SolutionTypesOperations(self._client, self._config, self._serialize, self._deserialize)
121+
122+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
123+
"""Runs the network request through the client's chained policies.
124+
125+
>>> from azure.core.rest import HttpRequest
126+
>>> request = HttpRequest("GET", "https://www.example.org/")
127+
<HttpRequest [GET], url: 'https://www.example.org/'>
128+
>>> response = client.send_request(request)
129+
<HttpResponse: 200 OK>
130+
131+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
132+
133+
:param request: The network request you want to make. Required.
134+
:type request: ~azure.core.rest.HttpRequest
135+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
136+
:return: The response of your network call. Does not do error handling on your response.
137+
:rtype: ~azure.core.rest.HttpResponse
138+
"""
139+
140+
request_copy = deepcopy(request)
141+
path_format_arguments = {
142+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
143+
}
144+
145+
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
146+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
147+
148+
def close(self) -> None:
149+
self._client.close()
150+
151+
def __enter__(self) -> Self:
152+
self._client.__enter__()
153+
return self
154+
155+
def __exit__(self, *exc_details: Any) -> None:
156+
self._client.__exit__(*exc_details)

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

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,59 @@
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
44
# Licensed under the MIT License. See License.txt in the project root for license information.
5-
# Code generated by Microsoft (R) AutoRest Code Generator.
5+
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

99
from typing import Any, TYPE_CHECKING
1010

11-
from azure.core.configuration import Configuration
1211
from azure.core.pipeline import policies
1312
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
1413

1514
from ._version import VERSION
1615

1716
if TYPE_CHECKING:
18-
# pylint: disable=unused-import,ungrouped-imports
1917
from azure.core.credentials import TokenCredential
2018

2119

22-
class HybridConnectivityMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
20+
class HybridConnectivityMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long
2321
"""Configuration for HybridConnectivityMgmtClient.
2422
2523
Note that all parameters used to create this instance are saved as instance
2624
attributes.
2725
28-
:param credential: Credential needed for the client to connect to Azure. Required.
26+
:param credential: Credential used to authenticate requests to the service. Required.
2927
:type credential: ~azure.core.credentials.TokenCredential
30-
:keyword api_version: Api Version. Default value is "2023-03-15". Note that overriding this
31-
default value may result in unsupported behavior.
28+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
29+
:type subscription_id: str
30+
:param base_url: Service host. Default value is "https://management.azure.com".
31+
:type base_url: str
32+
:keyword api_version: The API version to use for this operation. Default value is "2024-12-01".
33+
Note that overriding this default value may result in unsupported behavior.
3234
:paramtype api_version: str
3335
"""
3436

35-
def __init__(self, credential: "TokenCredential", **kwargs: Any) -> None:
36-
super(HybridConnectivityMgmtClientConfiguration, self).__init__(**kwargs)
37-
api_version: str = kwargs.pop("api_version", "2023-03-15")
37+
def __init__(
38+
self,
39+
credential: "TokenCredential",
40+
subscription_id: str,
41+
base_url: str = "https://management.azure.com",
42+
**kwargs: Any
43+
) -> None:
44+
api_version: str = kwargs.pop("api_version", "2024-12-01")
3845

3946
if credential is None:
4047
raise ValueError("Parameter 'credential' must not be None.")
48+
if subscription_id is None:
49+
raise ValueError("Parameter 'subscription_id' must not be None.")
4150

4251
self.credential = credential
52+
self.subscription_id = subscription_id
53+
self.base_url = base_url
4354
self.api_version = api_version
4455
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
4556
kwargs.setdefault("sdk_moniker", "mgmt-hybridconnectivity/{}".format(VERSION))
57+
self.polling_interval = kwargs.get("polling_interval", 30)
4658
self._configure(**kwargs)
4759

4860
def _configure(self, **kwargs: Any) -> None:
@@ -51,9 +63,9 @@ def _configure(self, **kwargs: Any) -> None:
5163
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
5264
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
5365
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
54-
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
5566
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
5667
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
68+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
5769
self.authentication_policy = kwargs.get("authentication_policy")
5870
if self.credential and not self.authentication_policy:
5971
self.authentication_policy = ARMChallengeAuthenticationPolicy(

0 commit comments

Comments
 (0)