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
18
from . import models as _models
16
19
from ._configuration import ContainerInstanceManagementClientConfiguration
17
20
from ._serialization import Deserializer , Serializer
18
21
from .operations import (
22
+ ContainerGroupProfileOperations ,
23
+ ContainerGroupProfilesOperations ,
19
24
ContainerGroupsOperations ,
20
25
ContainersOperations ,
21
26
LocationOperations ,
28
33
from azure .core .credentials import TokenCredential
29
34
30
35
31
- class ContainerInstanceManagementClient : # pylint: disable=client-accepts-api-version-keyword
36
+ class ContainerInstanceManagementClient : # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
32
37
"""ContainerInstanceManagementClient.
33
38
34
39
:ivar container_groups: ContainerGroupsOperations operations
@@ -42,15 +47,20 @@ class ContainerInstanceManagementClient: # pylint: disable=client-accepts-api-v
42
47
:ivar subnet_service_association_link: SubnetServiceAssociationLinkOperations operations
43
48
:vartype subnet_service_association_link:
44
49
azure.mgmt.containerinstance.operations.SubnetServiceAssociationLinkOperations
50
+ :ivar container_group_profiles: ContainerGroupProfilesOperations operations
51
+ :vartype container_group_profiles:
52
+ azure.mgmt.containerinstance.operations.ContainerGroupProfilesOperations
53
+ :ivar container_group_profile: ContainerGroupProfileOperations operations
54
+ :vartype container_group_profile:
55
+ azure.mgmt.containerinstance.operations.ContainerGroupProfileOperations
45
56
:param credential: Credential needed for the client to connect to Azure. Required.
46
57
:type credential: ~azure.core.credentials.TokenCredential
47
- :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure
48
- subscription. The subscription ID forms part of the URI for every service call. Required.
58
+ :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
49
59
:type subscription_id: str
50
60
:param base_url: Service URL. Default value is "https://management.azure.com".
51
61
:type base_url: str
52
- :keyword api_version: Api Version. Default value is "2023 -05-01". Note that overriding this
53
- default value may result in unsupported behavior.
62
+ :keyword api_version: Api Version. Default value is "2024 -05-01-preview ". Note that overriding
63
+ this default value may result in unsupported behavior.
54
64
:paramtype api_version: str
55
65
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
56
66
Retry-After header is present.
@@ -66,7 +76,25 @@ def __init__(
66
76
self ._config = ContainerInstanceManagementClientConfiguration (
67
77
credential = credential , subscription_id = subscription_id , ** kwargs
68
78
)
69
- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
79
+ _policies = kwargs .pop ("policies" , None )
80
+ if _policies is None :
81
+ _policies = [
82
+ policies .RequestIdPolicy (** kwargs ),
83
+ self ._config .headers_policy ,
84
+ self ._config .user_agent_policy ,
85
+ self ._config .proxy_policy ,
86
+ policies .ContentDecodePolicy (** kwargs ),
87
+ ARMAutoResourceProviderRegistrationPolicy (),
88
+ self ._config .redirect_policy ,
89
+ self ._config .retry_policy ,
90
+ self ._config .authentication_policy ,
91
+ self ._config .custom_hook_policy ,
92
+ self ._config .logging_policy ,
93
+ policies .DistributedTracingPolicy (** kwargs ),
94
+ policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
95
+ self ._config .http_logging_policy ,
96
+ ]
97
+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , policies = _policies , ** kwargs )
70
98
71
99
client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
72
100
self ._serialize = Serializer (client_models )
@@ -81,8 +109,14 @@ def __init__(
81
109
self .subnet_service_association_link = SubnetServiceAssociationLinkOperations (
82
110
self ._client , self ._config , self ._serialize , self ._deserialize
83
111
)
112
+ self .container_group_profiles = ContainerGroupProfilesOperations (
113
+ self ._client , self ._config , self ._serialize , self ._deserialize
114
+ )
115
+ self .container_group_profile = ContainerGroupProfileOperations (
116
+ self ._client , self ._config , self ._serialize , self ._deserialize
117
+ )
84
118
85
- def _send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
119
+ def _send_request (self , request : HttpRequest , * , stream : bool = False , * *kwargs : Any ) -> HttpResponse :
86
120
"""Runs the network request through the client's chained policies.
87
121
88
122
>>> from azure.core.rest import HttpRequest
@@ -102,12 +136,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
102
136
103
137
request_copy = deepcopy (request )
104
138
request_copy .url = self ._client .format_url (request_copy .url )
105
- return self ._client .send_request (request_copy , ** kwargs )
139
+ return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
106
140
107
141
def close (self ) -> None :
108
142
self ._client .close ()
109
143
110
- def __enter__ (self ) -> "ContainerInstanceManagementClient" :
144
+ def __enter__ (self ) -> Self :
111
145
self ._client .__enter__ ()
112
146
return self
113
147
0 commit comments