Skip to content

Commit e42d19e

Browse files
author
SDKAuto
committed
CodeGen from PR 3611 in test-repo-billy/azure-rest-api-specs
Merge c069ab2cc6da69d96bd7a4803569969b2c72a37b into 8d0e2cf50583eb8def697c1a7f30b51ebe10a01c
1 parent 0239dc2 commit e42d19e

File tree

95 files changed

+15877
-9812
lines changed

Some content is hidden

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

95 files changed

+15877
-9812
lines changed

sdk/chaos/azure-mgmt-chaos/_meta.json

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
{
2-
"commit": "50f502f5099796ba92f63384884574d46333cec2",
3-
"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/chaos/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/chaos/resource-manager/readme.md"
2+
"commit": "58d7c9f2eabf5132fd6bd04bcddbf3681e73208f",
3+
"repository_url": "https://github.com/test-repo-billy/azure-rest-api-specs",
4+
"typespec_src": "specification/chaos/Chaos.Management",
5+
"@azure-tools/typespec-python": "0.38.1"
116
}

sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/__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 ._chaos_management_client import ChaosManagementClient
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 ChaosManagementClient # 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
"ChaosManagementClient",
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()

sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_chaos_management_client.py renamed to sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_client.py

Lines changed: 72 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,71 @@
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 copy import deepcopy
1010
from typing import Any, TYPE_CHECKING
11+
from typing_extensions import Self
1112

13+
from azure.core.pipeline import policies
1214
from azure.core.rest import HttpRequest, HttpResponse
1315
from azure.mgmt.core import ARMPipelineClient
16+
from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy
1417

15-
from . import models as _models
1618
from ._configuration import ChaosManagementClientConfiguration
1719
from ._serialization import Deserializer, Serializer
1820
from .operations import (
1921
CapabilitiesOperations,
2022
CapabilityTypesOperations,
23+
ExperimentExecutionsOperations,
2124
ExperimentsOperations,
2225
OperationStatusesOperations,
2326
Operations,
27+
PrivateAccessesOperations,
28+
PrivateEndpointConnectionsOperations,
2429
TargetTypesOperations,
2530
TargetsOperations,
2631
)
2732

2833
if TYPE_CHECKING:
29-
# pylint: disable=unused-import,ungrouped-imports
3034
from azure.core.credentials import TokenCredential
3135

3236

33-
class ChaosManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
37+
class ChaosManagementClient: # pylint: disable=too-many-instance-attributes
3438
"""Chaos Management Client.
3539
3640
:ivar capabilities: CapabilitiesOperations operations
3741
:vartype capabilities: azure.mgmt.chaos.operations.CapabilitiesOperations
42+
:ivar operations: Operations operations
43+
:vartype operations: azure.mgmt.chaos.operations.Operations
44+
:ivar targets: TargetsOperations operations
45+
:vartype targets: azure.mgmt.chaos.operations.TargetsOperations
3846
:ivar capability_types: CapabilityTypesOperations operations
3947
:vartype capability_types: azure.mgmt.chaos.operations.CapabilityTypesOperations
4048
:ivar experiments: ExperimentsOperations operations
4149
:vartype experiments: azure.mgmt.chaos.operations.ExperimentsOperations
42-
:ivar operation_statuses: OperationStatusesOperations operations
43-
:vartype operation_statuses: azure.mgmt.chaos.operations.OperationStatusesOperations
44-
:ivar operations: Operations operations
45-
:vartype operations: azure.mgmt.chaos.operations.Operations
50+
:ivar experiment_executions: ExperimentExecutionsOperations operations
51+
:vartype experiment_executions: azure.mgmt.chaos.operations.ExperimentExecutionsOperations
52+
:ivar private_accesses: PrivateAccessesOperations operations
53+
:vartype private_accesses: azure.mgmt.chaos.operations.PrivateAccessesOperations
54+
:ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
55+
:vartype private_endpoint_connections:
56+
azure.mgmt.chaos.operations.PrivateEndpointConnectionsOperations
4657
:ivar target_types: TargetTypesOperations operations
4758
:vartype target_types: azure.mgmt.chaos.operations.TargetTypesOperations
48-
:ivar targets: TargetsOperations operations
49-
:vartype targets: azure.mgmt.chaos.operations.TargetsOperations
50-
:param credential: Credential needed for the client to connect to Azure. Required.
59+
:ivar operation_statuses: OperationStatusesOperations operations
60+
:vartype operation_statuses: azure.mgmt.chaos.operations.OperationStatusesOperations
61+
:param credential: Credential used to authenticate requests to the service. Required.
5162
:type credential: ~azure.core.credentials.TokenCredential
52-
:param subscription_id: GUID that represents an Azure subscription ID. Required.
63+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
5364
:type subscription_id: str
54-
:param base_url: Service URL. Default value is "https://management.azure.com".
65+
:param base_url: Service host. Default value is "https://management.azure.com".
5566
:type base_url: str
56-
:keyword api_version: Api Version. Default value is "2024-01-01". Note that overriding this
57-
default value may result in unsupported behavior.
67+
:keyword api_version: The API version to use for this operation. Default value is
68+
"2024-11-01-preview". Note that overriding this default value may result in unsupported
69+
behavior.
5870
:paramtype api_version: str
5971
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
6072
Retry-After header is present.
@@ -67,34 +79,61 @@ def __init__(
6779
base_url: str = "https://management.azure.com",
6880
**kwargs: Any
6981
) -> None:
82+
_endpoint = "{endpoint}"
7083
self._config = ChaosManagementClientConfiguration(
71-
credential=credential, subscription_id=subscription_id, **kwargs
84+
credential=credential, subscription_id=subscription_id, base_url=base_url, **kwargs
7285
)
73-
self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
74-
75-
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
76-
self._serialize = Serializer(client_models)
77-
self._deserialize = Deserializer(client_models)
86+
_policies = kwargs.pop("policies", None)
87+
if _policies is None:
88+
_policies = [
89+
policies.RequestIdPolicy(**kwargs),
90+
self._config.headers_policy,
91+
self._config.user_agent_policy,
92+
self._config.proxy_policy,
93+
policies.ContentDecodePolicy(**kwargs),
94+
ARMAutoResourceProviderRegistrationPolicy(),
95+
self._config.redirect_policy,
96+
self._config.retry_policy,
97+
self._config.authentication_policy,
98+
self._config.custom_hook_policy,
99+
self._config.logging_policy,
100+
policies.DistributedTracingPolicy(**kwargs),
101+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
102+
self._config.http_logging_policy,
103+
]
104+
self._client: ARMPipelineClient = ARMPipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
105+
106+
self._serialize = Serializer()
107+
self._deserialize = Deserializer()
78108
self._serialize.client_side_validation = False
79109
self.capabilities = CapabilitiesOperations(self._client, self._config, self._serialize, self._deserialize)
110+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
111+
self.targets = TargetsOperations(self._client, self._config, self._serialize, self._deserialize)
80112
self.capability_types = CapabilityTypesOperations(
81113
self._client, self._config, self._serialize, self._deserialize
82114
)
83115
self.experiments = ExperimentsOperations(self._client, self._config, self._serialize, self._deserialize)
84-
self.operation_statuses = OperationStatusesOperations(
116+
self.experiment_executions = ExperimentExecutionsOperations(
117+
self._client, self._config, self._serialize, self._deserialize
118+
)
119+
self.private_accesses = PrivateAccessesOperations(
120+
self._client, self._config, self._serialize, self._deserialize
121+
)
122+
self.private_endpoint_connections = PrivateEndpointConnectionsOperations(
85123
self._client, self._config, self._serialize, self._deserialize
86124
)
87-
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
88125
self.target_types = TargetTypesOperations(self._client, self._config, self._serialize, self._deserialize)
89-
self.targets = TargetsOperations(self._client, self._config, self._serialize, self._deserialize)
126+
self.operation_statuses = OperationStatusesOperations(
127+
self._client, self._config, self._serialize, self._deserialize
128+
)
90129

91-
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
130+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
92131
"""Runs the network request through the client's chained policies.
93132
94133
>>> from azure.core.rest import HttpRequest
95134
>>> request = HttpRequest("GET", "https://www.example.org/")
96135
<HttpRequest [GET], url: 'https://www.example.org/'>
97-
>>> response = client._send_request(request)
136+
>>> response = client.send_request(request)
98137
<HttpResponse: 200 OK>
99138
100139
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@@ -107,13 +146,17 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
107146
"""
108147

109148
request_copy = deepcopy(request)
110-
request_copy.url = self._client.format_url(request_copy.url)
111-
return self._client.send_request(request_copy, **kwargs)
149+
path_format_arguments = {
150+
"endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True),
151+
}
152+
153+
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
154+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
112155

113156
def close(self) -> None:
114157
self._client.close()
115158

116-
def __enter__(self) -> "ChaosManagementClient":
159+
def __enter__(self) -> Self:
117160
self._client.__enter__()
118161
return self
119162

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

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,47 @@
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 ChaosManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
20+
class ChaosManagementClientConfiguration: # pylint: disable=too-many-instance-attributes
2321
"""Configuration for ChaosManagementClient.
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-
:param subscription_id: GUID that represents an Azure subscription ID. Required.
28+
:param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
3129
:type subscription_id: str
32-
:keyword api_version: Api Version. Default value is "2024-01-01". Note that overriding this
33-
default value may result in unsupported behavior.
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
33+
"2024-11-01-preview". Note that overriding this default value may result in unsupported
34+
behavior.
3435
:paramtype api_version: str
3536
"""
3637

37-
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
38-
super(ChaosManagementClientConfiguration, self).__init__(**kwargs)
39-
api_version: str = kwargs.pop("api_version", "2024-01-01")
38+
def __init__(
39+
self,
40+
credential: "TokenCredential",
41+
subscription_id: str,
42+
base_url: str = "https://management.azure.com",
43+
**kwargs: Any
44+
) -> None:
45+
api_version: str = kwargs.pop("api_version", "2024-11-01-preview")
4046

4147
if credential is None:
4248
raise ValueError("Parameter 'credential' must not be None.")
@@ -45,9 +51,11 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
4551

4652
self.credential = credential
4753
self.subscription_id = subscription_id
54+
self.base_url = base_url
4855
self.api_version = api_version
4956
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
5057
kwargs.setdefault("sdk_moniker", "mgmt-chaos/{}".format(VERSION))
58+
self.polling_interval = kwargs.get("polling_interval", 30)
5159
self._configure(**kwargs)
5260

5361
def _configure(self, **kwargs: Any) -> None:
@@ -56,9 +64,9 @@ def _configure(self, **kwargs: Any) -> None:
5664
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
5765
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
5866
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
59-
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6067
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
6168
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
69+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
6270
self.authentication_policy = kwargs.get("authentication_policy")
6371
if self.credential and not self.authentication_policy:
6472
self.authentication_policy = ARMChallengeAuthenticationPolicy(

0 commit comments

Comments
 (0)