7
7
# --------------------------------------------------------------------------
8
8
9
9
from copy import deepcopy
10
- from typing import Any , TYPE_CHECKING
10
+ from typing import Any , Optional , TYPE_CHECKING , cast
11
+ from typing_extensions import Self
11
12
13
+ from azure .core .pipeline import policies
12
14
from azure .core .rest import HttpRequest , HttpResponse
15
+ from azure .core .settings import settings
13
16
from azure .mgmt .core import ARMPipelineClient
17
+ from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
18
+ from azure .mgmt .core .tools import get_arm_endpoints
14
19
15
20
from . import models as _models
16
21
from ._configuration import DashboardManagementClientConfiguration
17
- from ._serialization import Deserializer , Serializer
22
+ from ._utils . serialization import Deserializer , Serializer
18
23
from .operations import (
24
+ DashboardsOperations ,
19
25
GrafanaOperations ,
26
+ IntegrationFabricsOperations ,
27
+ ManagedDashboardsOperations ,
20
28
ManagedPrivateEndpointsOperations ,
21
29
Operations ,
22
30
PrivateEndpointConnectionsOperations ,
23
31
PrivateLinkResourcesOperations ,
24
32
)
25
33
26
34
if TYPE_CHECKING :
27
- # pylint: disable=unused-import,ungrouped-imports
28
35
from azure .core .credentials import TokenCredential
29
36
30
37
31
- class DashboardManagementClient : # pylint: disable=client-accepts-api-version-keyword
38
+ class DashboardManagementClient : # pylint: disable=too-many-instance-attributes
32
39
"""The Microsoft.Dashboard Rest API spec.
33
40
34
41
:ivar operations: Operations operations
@@ -43,30 +50,56 @@ class DashboardManagementClient: # pylint: disable=client-accepts-api-version-k
43
50
:ivar managed_private_endpoints: ManagedPrivateEndpointsOperations operations
44
51
:vartype managed_private_endpoints:
45
52
azure.mgmt.dashboard.operations.ManagedPrivateEndpointsOperations
53
+ :ivar integration_fabrics: IntegrationFabricsOperations operations
54
+ :vartype integration_fabrics: azure.mgmt.dashboard.operations.IntegrationFabricsOperations
55
+ :ivar dashboards: DashboardsOperations operations
56
+ :vartype dashboards: azure.mgmt.dashboard.operations.DashboardsOperations
57
+ :ivar managed_dashboards: ManagedDashboardsOperations operations
58
+ :vartype managed_dashboards: azure.mgmt.dashboard.operations.ManagedDashboardsOperations
46
59
:param credential: Credential needed for the client to connect to Azure. Required.
47
60
:type credential: ~azure.core.credentials.TokenCredential
48
61
:param subscription_id: The ID of the target subscription. Required.
49
62
:type subscription_id: str
50
- :param base_url: Service URL. Default value is "https://management.azure.com" .
63
+ :param base_url: Service URL. Default value is None .
51
64
:type base_url: str
52
- :keyword api_version: Api Version. Default value is "2023-09 -01". Note that overriding this
53
- default value may result in unsupported behavior.
65
+ :keyword api_version: Api Version. Default value is "2024-11 -01-preview ". Note that overriding
66
+ this default value may result in unsupported behavior.
54
67
:paramtype api_version: str
55
68
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
56
69
Retry-After header is present.
57
70
"""
58
71
59
72
def __init__ (
60
- self ,
61
- credential : "TokenCredential" ,
62
- subscription_id : str ,
63
- base_url : str = "https://management.azure.com" ,
64
- ** kwargs : Any
73
+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
65
74
) -> None :
75
+ _cloud = kwargs .pop ("cloud_setting" , None ) or settings .current .azure_cloud # type: ignore
76
+ _endpoints = get_arm_endpoints (_cloud )
77
+ if not base_url :
78
+ base_url = _endpoints ["resource_manager" ]
79
+ credential_scopes = kwargs .pop ("credential_scopes" , _endpoints ["credential_scopes" ])
66
80
self ._config = DashboardManagementClientConfiguration (
67
- credential = credential , subscription_id = subscription_id , ** kwargs
81
+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
68
82
)
69
- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
83
+
84
+ _policies = kwargs .pop ("policies" , None )
85
+ if _policies is None :
86
+ _policies = [
87
+ policies .RequestIdPolicy (** kwargs ),
88
+ self ._config .headers_policy ,
89
+ self ._config .user_agent_policy ,
90
+ self ._config .proxy_policy ,
91
+ policies .ContentDecodePolicy (** kwargs ),
92
+ ARMAutoResourceProviderRegistrationPolicy (),
93
+ self ._config .redirect_policy ,
94
+ self ._config .retry_policy ,
95
+ self ._config .authentication_policy ,
96
+ self ._config .custom_hook_policy ,
97
+ self ._config .logging_policy ,
98
+ policies .DistributedTracingPolicy (** kwargs ),
99
+ policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
100
+ self ._config .http_logging_policy ,
101
+ ]
102
+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = cast (str , base_url ), policies = _policies , ** kwargs )
70
103
71
104
client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
72
105
self ._serialize = Serializer (client_models )
@@ -83,8 +116,15 @@ def __init__(
83
116
self .managed_private_endpoints = ManagedPrivateEndpointsOperations (
84
117
self ._client , self ._config , self ._serialize , self ._deserialize
85
118
)
119
+ self .integration_fabrics = IntegrationFabricsOperations (
120
+ self ._client , self ._config , self ._serialize , self ._deserialize
121
+ )
122
+ self .dashboards = DashboardsOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
123
+ self .managed_dashboards = ManagedDashboardsOperations (
124
+ self ._client , self ._config , self ._serialize , self ._deserialize
125
+ )
86
126
87
- def _send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
127
+ def _send_request (self , request : HttpRequest , * , stream : bool = False , * *kwargs : Any ) -> HttpResponse :
88
128
"""Runs the network request through the client's chained policies.
89
129
90
130
>>> from azure.core.rest import HttpRequest
@@ -104,12 +144,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
104
144
105
145
request_copy = deepcopy (request )
106
146
request_copy .url = self ._client .format_url (request_copy .url )
107
- return self ._client .send_request (request_copy , ** kwargs )
147
+ return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
108
148
109
149
def close (self ) -> None :
110
150
self ._client .close ()
111
151
112
- def __enter__ (self ) -> "DashboardManagementClient" :
152
+ def __enter__ (self ) -> Self :
113
153
self ._client .__enter__ ()
114
154
return self
115
155
0 commit comments