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
99from copy import deepcopy
1010from typing import Any , TYPE_CHECKING
11+ from typing_extensions import Self
1112
13+ from azure .core .pipeline import policies
1214from azure .core .rest import HttpRequest , HttpResponse
1315from azure .mgmt .core import ARMPipelineClient
16+ from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
1417
15- from . import models as _models
1618from ._configuration import ChaosManagementClientConfiguration
1719from ._serialization import Deserializer , Serializer
1820from .operations import (
1921 CapabilitiesOperations ,
2022 CapabilityTypesOperations ,
23+ ExperimentExecutionsOperations ,
2124 ExperimentsOperations ,
2225 OperationStatusesOperations ,
2326 Operations ,
2629)
2730
2831if TYPE_CHECKING :
29- # pylint: disable=unused-import,ungrouped-imports
3032 from azure .core .credentials import TokenCredential
3133
3234
33- class ChaosManagementClient : # pylint: disable=client-accepts-api-version-keyword, too-many-instance-attributes
35+ class ChaosManagementClient : # pylint: disable=too-many-instance-attributes
3436 """Chaos Management Client.
3537
3638 :ivar capabilities: CapabilitiesOperations operations
3739 :vartype capabilities: azure.mgmt.chaos.operations.CapabilitiesOperations
40+ :ivar operations: Operations operations
41+ :vartype operations: azure.mgmt.chaos.operations.Operations
42+ :ivar targets: TargetsOperations operations
43+ :vartype targets: azure.mgmt.chaos.operations.TargetsOperations
3844 :ivar capability_types: CapabilityTypesOperations operations
3945 :vartype capability_types: azure.mgmt.chaos.operations.CapabilityTypesOperations
4046 :ivar experiments: ExperimentsOperations operations
4147 :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
48+ :ivar experiment_executions: ExperimentExecutionsOperations operations
49+ :vartype experiment_executions: azure.mgmt.chaos.operations.ExperimentExecutionsOperations
4650 :ivar target_types: TargetTypesOperations operations
4751 :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.
52+ :ivar operation_statuses: OperationStatusesOperations operations
53+ :vartype operation_statuses : azure.mgmt.chaos.operations.OperationStatusesOperations
54+ :param credential: Credential used to authenticate requests to the service . Required.
5155 :type credential: ~azure.core.credentials.TokenCredential
52- :param subscription_id: GUID that represents an Azure subscription ID . Required.
56+ :param subscription_id: The ID of the target subscription. The value must be an UUID . Required.
5357 :type subscription_id: str
54- :param base_url: Service URL . Default value is "https://management.azure.com".
58+ :param base_url: Service host . Default value is "https://management.azure.com".
5559 :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.
60+ :keyword api_version: The API version to use for this operation . Default value is "2025 -01-01".
61+ Note that overriding this default value may result in unsupported behavior.
5862 :paramtype api_version: str
5963 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
6064 Retry-After header is present.
@@ -67,34 +71,55 @@ def __init__(
6771 base_url : str = "https://management.azure.com" ,
6872 ** kwargs : Any
6973 ) -> None :
74+ _endpoint = "{endpoint}"
7075 self ._config = ChaosManagementClientConfiguration (
71- credential = credential , subscription_id = subscription_id , ** kwargs
76+ credential = credential , subscription_id = subscription_id , base_url = base_url , ** kwargs
7277 )
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 )
78+ _policies = kwargs .pop ("policies" , None )
79+ if _policies is None :
80+ _policies = [
81+ policies .RequestIdPolicy (** kwargs ),
82+ self ._config .headers_policy ,
83+ self ._config .user_agent_policy ,
84+ self ._config .proxy_policy ,
85+ policies .ContentDecodePolicy (** kwargs ),
86+ ARMAutoResourceProviderRegistrationPolicy (),
87+ self ._config .redirect_policy ,
88+ self ._config .retry_policy ,
89+ self ._config .authentication_policy ,
90+ self ._config .custom_hook_policy ,
91+ self ._config .logging_policy ,
92+ policies .DistributedTracingPolicy (** kwargs ),
93+ policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
94+ self ._config .http_logging_policy ,
95+ ]
96+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = _endpoint , policies = _policies , ** kwargs )
97+
98+ self ._serialize = Serializer ()
99+ self ._deserialize = Deserializer ()
78100 self ._serialize .client_side_validation = False
79101 self .capabilities = CapabilitiesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
102+ self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
103+ self .targets = TargetsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
80104 self .capability_types = CapabilityTypesOperations (
81105 self ._client , self ._config , self ._serialize , self ._deserialize
82106 )
83107 self .experiments = ExperimentsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
84- self .operation_statuses = OperationStatusesOperations (
108+ self .experiment_executions = ExperimentExecutionsOperations (
85109 self ._client , self ._config , self ._serialize , self ._deserialize
86110 )
87- self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
88111 self .target_types = TargetTypesOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
89- self .targets = TargetsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
112+ self .operation_statuses = OperationStatusesOperations (
113+ self ._client , self ._config , self ._serialize , self ._deserialize
114+ )
90115
91- def _send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
116+ def send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
92117 """Runs the network request through the client's chained policies.
93118
94119 >>> from azure.core.rest import HttpRequest
95120 >>> request = HttpRequest("GET", "https://www.example.org/")
96121 <HttpRequest [GET], url: 'https://www.example.org/'>
97- >>> response = client._send_request (request)
122+ >>> response = client.send_request (request)
98123 <HttpResponse: 200 OK>
99124
100125 For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@@ -107,13 +132,17 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
107132 """
108133
109134 request_copy = deepcopy (request )
110- request_copy .url = self ._client .format_url (request_copy .url )
111- return self ._client .send_request (request_copy , ** kwargs )
135+ path_format_arguments = {
136+ "endpoint" : self ._serialize .url ("self._config.base_url" , self ._config .base_url , "str" , skip_quote = True ),
137+ }
138+
139+ request_copy .url = self ._client .format_url (request_copy .url , ** path_format_arguments )
140+ return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
112141
113142 def close (self ) -> None :
114143 self ._client .close ()
115144
116- def __enter__ (self ) -> "ChaosManagementClient" :
145+ def __enter__ (self ) -> Self :
117146 self ._client .__enter__ ()
118147 return self
119148
0 commit comments