77# --------------------------------------------------------------------------
88
99from 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
1112
13+ from azure .core .pipeline import policies
1214from azure .core .rest import HttpRequest , HttpResponse
15+ from azure .core .settings import settings
1316from azure .mgmt .core import ARMPipelineClient
17+ from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
18+ from azure .mgmt .core .tools import get_arm_endpoints
1419
1520from . import models as _models
1621from ._configuration import DashboardManagementClientConfiguration
17- from ._serialization import Deserializer , Serializer
22+ from ._utils . serialization import Deserializer , Serializer
1823from .operations import (
24+ DashboardsOperations ,
1925 GrafanaOperations ,
26+ IntegrationFabricsOperations ,
27+ ManagedDashboardsOperations ,
2028 ManagedPrivateEndpointsOperations ,
2129 Operations ,
2230 PrivateEndpointConnectionsOperations ,
2331 PrivateLinkResourcesOperations ,
2432)
2533
2634if TYPE_CHECKING :
27- # pylint: disable=unused-import,ungrouped-imports
2835 from azure .core .credentials import TokenCredential
2936
3037
31- class DashboardManagementClient : # pylint: disable=client-accepts-api-version-keyword
38+ class DashboardManagementClient : # pylint: disable=too-many-instance-attributes
3239 """The Microsoft.Dashboard Rest API spec.
3340
3441 :ivar operations: Operations operations
@@ -43,30 +50,56 @@ class DashboardManagementClient: # pylint: disable=client-accepts-api-version-k
4350 :ivar managed_private_endpoints: ManagedPrivateEndpointsOperations operations
4451 :vartype managed_private_endpoints:
4552 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
4659 :param credential: Credential needed for the client to connect to Azure. Required.
4760 :type credential: ~azure.core.credentials.TokenCredential
4861 :param subscription_id: The ID of the target subscription. Required.
4962 :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 .
5164 :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.
5467 :paramtype api_version: str
5568 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
5669 Retry-After header is present.
5770 """
5871
5972 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
6574 ) -> 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" ])
6680 self ._config = DashboardManagementClientConfiguration (
67- credential = credential , subscription_id = subscription_id , ** kwargs
81+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
6882 )
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 )
70103
71104 client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
72105 self ._serialize = Serializer (client_models )
@@ -83,8 +116,15 @@ def __init__(
83116 self .managed_private_endpoints = ManagedPrivateEndpointsOperations (
84117 self ._client , self ._config , self ._serialize , self ._deserialize
85118 )
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+ )
86126
87- def _send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
127+ def _send_request (self , request : HttpRequest , * , stream : bool = False , * *kwargs : Any ) -> HttpResponse :
88128 """Runs the network request through the client's chained policies.
89129
90130 >>> from azure.core.rest import HttpRequest
@@ -104,12 +144,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
104144
105145 request_copy = deepcopy (request )
106146 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
108148
109149 def close (self ) -> None :
110150 self ._client .close ()
111151
112- def __enter__ (self ) -> "DashboardManagementClient" :
152+ def __enter__ (self ) -> Self :
113153 self ._client .__enter__ ()
114154 return self
115155
0 commit comments