Skip to content

Commit e0d8dea

Browse files
[AutoRelease] t2-chaos-2022-04-28-73429 (Azure#24219)
* code and test * Update CHANGELOG.md Co-authored-by: PythonSdkPipelines <PythonSdkPipelines> Co-authored-by: Jiefeng Chen <[email protected]>
1 parent 4cbc205 commit e0d8dea

30 files changed

Lines changed: 3365 additions & 3659 deletions

sdk/chaos/azure-mgmt-chaos/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.0.0b3 (2022-05-07)
4+
5+
**Features**
6+
7+
- Model ActionStatus has a new parameter end_time
8+
- Model ActionStatus has a new parameter start_time
9+
310
## 1.0.0b2 (2021-10-25)
411

512
**Features**
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/[email protected].2"
4+
"@autorest/python@5.13.0",
5+
"@autorest/[email protected].3"
66
],
7-
"commit": "1e00e8d52c5da01410e898db01c4954c7bd29ba5",
7+
"commit": "27428c65baa3593d019f7f77744fd122f06747ec",
88
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
9-
"autorest_command": "autorest specification/chaos/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/[email protected].2 --version=3.4.5",
9+
"autorest_command": "autorest specification/chaos/resource-manager/readme.md --multiapi --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/[email protected].3 --version=3.7.2",
1010
"readme": "specification/chaos/resource-manager/readme.md"
1111
}

sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/__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__ = ['ChaosManagementClient']
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/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_chaos_management_client.py

Lines changed: 58 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -6,99 +6,97 @@
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

11-
from azure.mgmt.core import ARMPipelineClient
1212
from msrest import Deserializer, Serializer
1313

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
14+
from azure.core.rest import HttpRequest, HttpResponse
15+
from azure.mgmt.core import ARMPipelineClient
2016

21-
from ._configuration import ChaosManagementClientConfiguration
22-
from .operations import CapabilitiesOperations
23-
from .operations import ExperimentsOperations
24-
from .operations import Operations
25-
from .operations import TargetsOperations
26-
from .operations import TargetTypesOperations
27-
from .operations import CapabilityTypesOperations
2817
from . import models
18+
from ._configuration import ChaosManagementClientConfiguration
19+
from .operations import CapabilitiesOperations, CapabilityTypesOperations, ExperimentsOperations, Operations, TargetTypesOperations, TargetsOperations
2920

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

31-
class ChaosManagementClient(object):
25+
class ChaosManagementClient:
3226
"""Chaos Management Client.
3327
3428
:ivar capabilities: CapabilitiesOperations operations
35-
:vartype capabilities: chaos_management_client.operations.CapabilitiesOperations
29+
:vartype capabilities: azure.mgmt.chaos.operations.CapabilitiesOperations
3630
:ivar experiments: ExperimentsOperations operations
37-
:vartype experiments: chaos_management_client.operations.ExperimentsOperations
31+
:vartype experiments: azure.mgmt.chaos.operations.ExperimentsOperations
3832
:ivar operations: Operations operations
39-
:vartype operations: chaos_management_client.operations.Operations
33+
:vartype operations: azure.mgmt.chaos.operations.Operations
4034
:ivar targets: TargetsOperations operations
41-
:vartype targets: chaos_management_client.operations.TargetsOperations
35+
:vartype targets: azure.mgmt.chaos.operations.TargetsOperations
4236
:ivar target_types: TargetTypesOperations operations
43-
:vartype target_types: chaos_management_client.operations.TargetTypesOperations
37+
:vartype target_types: azure.mgmt.chaos.operations.TargetTypesOperations
4438
:ivar capability_types: CapabilityTypesOperations operations
45-
:vartype capability_types: chaos_management_client.operations.CapabilityTypesOperations
39+
:vartype capability_types: azure.mgmt.chaos.operations.CapabilityTypesOperations
4640
:param credential: Credential needed for the client to connect to Azure.
4741
:type credential: ~azure.core.credentials.TokenCredential
4842
:param subscription_id: GUID that represents an Azure subscription ID.
4943
:type subscription_id: str
50-
:param str base_url: Service URL
51-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
44+
:param base_url: Service URL. Default value is "https://management.azure.com".
45+
:type base_url: str
46+
:keyword api_version: Api Version. Default value is "2021-09-15-preview". Note that overriding
47+
this default value may result in unsupported behavior.
48+
:paramtype api_version: str
49+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
50+
Retry-After header is present.
5251
"""
5352

5453
def __init__(
5554
self,
56-
credential, # type: "TokenCredential"
57-
subscription_id, # type: str
58-
base_url=None, # type: Optional[str]
59-
**kwargs # type: Any
60-
):
61-
# type: (...) -> None
62-
if not base_url:
63-
base_url = 'https://management.azure.com'
64-
self._config = ChaosManagementClientConfiguration(credential, subscription_id, **kwargs)
55+
credential: "TokenCredential",
56+
subscription_id: str,
57+
base_url: str = "https://management.azure.com",
58+
**kwargs: Any
59+
) -> None:
60+
self._config = ChaosManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
6561
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
6662

6763
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
6864
self._serialize = Serializer(client_models)
69-
self._serialize.client_side_validation = False
7065
self._deserialize = Deserializer(client_models)
66+
self._serialize.client_side_validation = False
67+
self.capabilities = CapabilitiesOperations(self._client, self._config, self._serialize, self._deserialize)
68+
self.experiments = ExperimentsOperations(self._client, self._config, self._serialize, self._deserialize)
69+
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
70+
self.targets = TargetsOperations(self._client, self._config, self._serialize, self._deserialize)
71+
self.target_types = TargetTypesOperations(self._client, self._config, self._serialize, self._deserialize)
72+
self.capability_types = CapabilityTypesOperations(self._client, self._config, self._serialize, self._deserialize)
73+
7174

72-
self.capabilities = CapabilitiesOperations(
73-
self._client, self._config, self._serialize, self._deserialize)
74-
self.experiments = ExperimentsOperations(
75-
self._client, self._config, self._serialize, self._deserialize)
76-
self.operations = Operations(
77-
self._client, self._config, self._serialize, self._deserialize)
78-
self.targets = TargetsOperations(
79-
self._client, self._config, self._serialize, self._deserialize)
80-
self.target_types = TargetTypesOperations(
81-
self._client, self._config, self._serialize, self._deserialize)
82-
self.capability_types = CapabilityTypesOperations(
83-
self._client, self._config, self._serialize, self._deserialize)
84-
85-
def _send_request(self, http_request, **kwargs):
86-
# type: (HttpRequest, Any) -> HttpResponse
75+
def _send_request(
76+
self,
77+
request: HttpRequest,
78+
**kwargs: Any
79+
) -> HttpResponse:
8780
"""Runs the network request through the client's chained policies.
8881
89-
:param http_request: The network request you want to make. Required.
90-
:type http_request: ~azure.core.pipeline.transport.HttpRequest
91-
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
82+
>>> from azure.core.rest import HttpRequest
83+
>>> request = HttpRequest("GET", "https://www.example.org/")
84+
<HttpRequest [GET], url: 'https://www.example.org/'>
85+
>>> response = client._send_request(request)
86+
<HttpResponse: 200 OK>
87+
88+
For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart
89+
90+
:param request: The network request you want to make. Required.
91+
:type request: ~azure.core.rest.HttpRequest
92+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
9293
:return: The response of your network call. Does not do error handling on your response.
93-
:rtype: ~azure.core.pipeline.transport.HttpResponse
94+
:rtype: ~azure.core.rest.HttpResponse
9495
"""
95-
path_format_arguments = {
96-
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'),
97-
}
98-
http_request.url = self._client.format_url(http_request.url, **path_format_arguments)
99-
stream = kwargs.pop("stream", True)
100-
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
101-
return pipeline_response.http_response
96+
97+
request_copy = deepcopy(request)
98+
request_copy.url = self._client.format_url(request_copy.url)
99+
return self._client.send_request(request_copy, **kwargs)
102100

103101
def close(self):
104102
# type: () -> None

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

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,20 @@
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 ChaosManagementClientConfiguration(Configuration):
22+
class ChaosManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
2523
"""Configuration for ChaosManagementClient.
2624
2725
Note that all parameters used to create this instance are saved as instance
@@ -31,24 +29,28 @@ class ChaosManagementClientConfiguration(Configuration):
3129
:type credential: ~azure.core.credentials.TokenCredential
3230
:param subscription_id: GUID that represents an Azure subscription ID.
3331
:type subscription_id: str
32+
:keyword api_version: Api Version. Default value is "2021-09-15-preview". Note that overriding
33+
this default value may result in unsupported behavior.
34+
:paramtype api_version: str
3435
"""
3536

3637
def __init__(
3738
self,
38-
credential, # type: "TokenCredential"
39-
subscription_id, # type: str
40-
**kwargs # type: Any
41-
):
42-
# type: (...) -> None
39+
credential: "TokenCredential",
40+
subscription_id: str,
41+
**kwargs: Any
42+
) -> None:
43+
super(ChaosManagementClientConfiguration, self).__init__(**kwargs)
44+
api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str
45+
4346
if credential is None:
4447
raise ValueError("Parameter 'credential' must not be None.")
4548
if subscription_id is None:
4649
raise ValueError("Parameter 'subscription_id' must not be None.")
47-
super(ChaosManagementClientConfiguration, self).__init__(**kwargs)
4850

4951
self.credential = credential
5052
self.subscription_id = subscription_id
51-
self.api_version = "2021-09-15-preview"
53+
self.api_version = api_version
5254
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
5355
kwargs.setdefault('sdk_moniker', 'mgmt-chaos/{}'.format(VERSION))
5456
self._configure(**kwargs)
@@ -68,4 +70,4 @@ def _configure(
6870
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
6971
self.authentication_policy = kwargs.get('authentication_policy')
7072
if self.credential and not self.authentication_policy:
71-
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
73+
self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)

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

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
"name": "ChaosManagementClient",
66
"filename": "_chaos_management_client",
77
"description": "Chaos Management Client.",
8-
"base_url": "\u0027https://management.azure.com\u0027",
9-
"custom_base_url": null,
8+
"host_value": "\"https://management.azure.com\"",
9+
"parameterized_host_template": null,
1010
"azure_arm": true,
1111
"has_lro_operations": true,
1212
"client_side_validation": false,
13-
"sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ChaosManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}",
14-
"async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ChaosManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}"
13+
"sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ChaosManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}",
14+
"async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ChaosManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}"
1515
},
1616
"global_parameters": {
1717
"sync": {
@@ -54,7 +54,7 @@
5454
"required": false
5555
},
5656
"base_url": {
57-
"signature": "base_url=None, # type: Optional[str]",
57+
"signature": "base_url=\"https://management.azure.com\", # type: str",
5858
"description": "Service URL",
5959
"docstring_type": "str",
6060
"required": false
@@ -74,7 +74,7 @@
7474
"required": false
7575
},
7676
"base_url": {
77-
"signature": "base_url: Optional[str] = None,",
77+
"signature": "base_url: str = \"https://management.azure.com\",",
7878
"description": "Service URL",
7979
"docstring_type": "str",
8080
"required": false
@@ -91,11 +91,10 @@
9191
"config": {
9292
"credential": true,
9393
"credential_scopes": ["https://management.azure.com/.default"],
94-
"credential_default_policy_type": "BearerTokenCredentialPolicy",
95-
"credential_default_policy_type_has_async_version": true,
96-
"credential_key_header_name": null,
97-
"sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
98-
"async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
94+
"credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)",
95+
"credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)",
96+
"sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
97+
"async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
9998
},
10099
"operation_groups": {
101100
"capabilities": "CapabilitiesOperations",

0 commit comments

Comments
 (0)