2
2
# --------------------------------------------------------------------------
3
3
# Copyright (c) Microsoft Corporation. All rights reserved.
4
4
# 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.
6
6
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
# --------------------------------------------------------------------------
8
8
9
9
from copy import deepcopy
10
10
from typing import Any , TYPE_CHECKING
11
+ from typing_extensions import Self
11
12
13
+ from azure .core .pipeline import policies
12
14
from azure .core .rest import HttpRequest , HttpResponse
13
15
from azure .mgmt .core import ARMPipelineClient
16
+ from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
14
17
15
- from . import models as _models
16
18
from ._configuration import ChaosManagementClientConfiguration
17
19
from ._serialization import Deserializer , Serializer
18
20
from .operations import (
19
21
CapabilitiesOperations ,
20
22
CapabilityTypesOperations ,
23
+ ExperimentExecutionsOperations ,
21
24
ExperimentsOperations ,
22
25
OperationStatusesOperations ,
23
26
Operations ,
27
+ PrivateAccessesOperations ,
28
+ PrivateEndpointConnectionsOperations ,
24
29
TargetTypesOperations ,
25
30
TargetsOperations ,
26
31
)
27
32
28
33
if TYPE_CHECKING :
29
- # pylint: disable=unused-import,ungrouped-imports
30
34
from azure .core .credentials import TokenCredential
31
35
32
36
33
- class ChaosManagementClient : # pylint: disable=client-accepts-api-version-keyword, too-many-instance-attributes
37
+ class ChaosManagementClient : # pylint: disable=too-many-instance-attributes
34
38
"""Chaos Management Client.
35
39
36
40
:ivar capabilities: CapabilitiesOperations operations
37
41
: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
38
46
:ivar capability_types: CapabilityTypesOperations operations
39
47
:vartype capability_types: azure.mgmt.chaos.operations.CapabilityTypesOperations
40
48
:ivar experiments: ExperimentsOperations operations
41
49
: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
46
57
:ivar target_types: TargetTypesOperations operations
47
58
: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.
51
62
: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.
53
64
: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".
55
66
: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.
58
70
:paramtype api_version: str
59
71
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
60
72
Retry-After header is present.
@@ -67,34 +79,61 @@ def __init__(
67
79
base_url : str = "https://management.azure.com" ,
68
80
** kwargs : Any
69
81
) -> None :
82
+ _endpoint = "{endpoint}"
70
83
self ._config = ChaosManagementClientConfiguration (
71
- credential = credential , subscription_id = subscription_id , ** kwargs
84
+ credential = credential , subscription_id = subscription_id , base_url = base_url , ** kwargs
72
85
)
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 ()
78
108
self ._serialize .client_side_validation = False
79
109
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 )
80
112
self .capability_types = CapabilityTypesOperations (
81
113
self ._client , self ._config , self ._serialize , self ._deserialize
82
114
)
83
115
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 (
85
123
self ._client , self ._config , self ._serialize , self ._deserialize
86
124
)
87
- self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
88
125
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
+ )
90
129
91
- def _send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
130
+ def send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
92
131
"""Runs the network request through the client's chained policies.
93
132
94
133
>>> from azure.core.rest import HttpRequest
95
134
>>> request = HttpRequest("GET", "https://www.example.org/")
96
135
<HttpRequest [GET], url: 'https://www.example.org/'>
97
- >>> response = client._send_request (request)
136
+ >>> response = client.send_request (request)
98
137
<HttpResponse: 200 OK>
99
138
100
139
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:
107
146
"""
108
147
109
148
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
112
155
113
156
def close (self ) -> None :
114
157
self ._client .close ()
115
158
116
- def __enter__ (self ) -> "ChaosManagementClient" :
159
+ def __enter__ (self ) -> Self :
117
160
self ._client .__enter__ ()
118
161
return self
119
162
0 commit comments