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 (
1924 GrafanaOperations ,
25+ IntegrationFabricsOperations ,
2026 ManagedPrivateEndpointsOperations ,
2127 Operations ,
2228 PrivateEndpointConnectionsOperations ,
2329 PrivateLinkResourcesOperations ,
2430)
2531
2632if TYPE_CHECKING :
27- # pylint: disable=unused-import,ungrouped-imports
2833 from azure .core .credentials import TokenCredential
2934
3035
31- class DashboardManagementClient : # pylint: disable=client-accepts-api-version-keyword
36+ class DashboardManagementClient :
3237 """The Microsoft.Dashboard Rest API spec.
3338
3439 :ivar operations: Operations operations
3540 :vartype operations: azure.mgmt.dashboard.operations.Operations
3641 :ivar grafana: GrafanaOperations operations
3742 :vartype grafana: azure.mgmt.dashboard.operations.GrafanaOperations
43+ :ivar integration_fabrics: IntegrationFabricsOperations operations
44+ :vartype integration_fabrics: azure.mgmt.dashboard.operations.IntegrationFabricsOperations
45+ :ivar managed_private_endpoints: ManagedPrivateEndpointsOperations operations
46+ :vartype managed_private_endpoints:
47+ azure.mgmt.dashboard.operations.ManagedPrivateEndpointsOperations
3848 :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations
3949 :vartype private_endpoint_connections:
4050 azure.mgmt.dashboard.operations.PrivateEndpointConnectionsOperations
4151 :ivar private_link_resources: PrivateLinkResourcesOperations operations
4252 :vartype private_link_resources: azure.mgmt.dashboard.operations.PrivateLinkResourcesOperations
43- :ivar managed_private_endpoints: ManagedPrivateEndpointsOperations operations
44- :vartype managed_private_endpoints:
45- azure.mgmt.dashboard.operations.ManagedPrivateEndpointsOperations
4653 :param credential: Credential needed for the client to connect to Azure. Required.
4754 :type credential: ~azure.core.credentials.TokenCredential
4855 :param subscription_id: The ID of the target subscription. Required.
4956 :type subscription_id: str
50- :param base_url: Service URL. Default value is "https://management.azure.com" .
57+ :param base_url: Service URL. Default value is None .
5158 :type base_url: str
52- :keyword api_version: Api Version. Default value is "2023-09 -01". Note that overriding this
59+ :keyword api_version: Api Version. Default value is "2024-10 -01". Note that overriding this
5360 default value may result in unsupported behavior.
5461 :paramtype api_version: str
5562 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
5663 Retry-After header is present.
5764 """
5865
5966 def __init__ (
60- self ,
61- credential : "TokenCredential" ,
62- subscription_id : str ,
63- base_url : str = "https://management.azure.com" ,
64- ** kwargs : Any
67+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
6568 ) -> None :
69+ _cloud = kwargs .pop ("cloud_setting" , None ) or settings .current .azure_cloud # type: ignore
70+ _endpoints = get_arm_endpoints (_cloud )
71+ if not base_url :
72+ base_url = _endpoints ["resource_manager" ]
73+ credential_scopes = kwargs .pop ("credential_scopes" , _endpoints ["credential_scopes" ])
6674 self ._config = DashboardManagementClientConfiguration (
67- credential = credential , subscription_id = subscription_id , ** kwargs
75+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
6876 )
69- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
77+
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 = cast (str , base_url ), policies = _policies , ** kwargs )
7097
7198 client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
7299 self ._serialize = Serializer (client_models )
73100 self ._deserialize = Deserializer (client_models )
74101 self ._serialize .client_side_validation = False
75102 self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
76103 self .grafana = GrafanaOperations (self ._client , self ._config , self ._serialize , self ._deserialize )
77- self .private_endpoint_connections = PrivateEndpointConnectionsOperations (
104+ self .integration_fabrics = IntegrationFabricsOperations (
78105 self ._client , self ._config , self ._serialize , self ._deserialize
79106 )
80- self .private_link_resources = PrivateLinkResourcesOperations (
107+ self .managed_private_endpoints = ManagedPrivateEndpointsOperations (
81108 self ._client , self ._config , self ._serialize , self ._deserialize
82109 )
83- self .managed_private_endpoints = ManagedPrivateEndpointsOperations (
110+ self .private_endpoint_connections = PrivateEndpointConnectionsOperations (
111+ self ._client , self ._config , self ._serialize , self ._deserialize
112+ )
113+ self .private_link_resources = PrivateLinkResourcesOperations (
84114 self ._client , self ._config , self ._serialize , self ._deserialize
85115 )
86116
87- def _send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
117+ def _send_request (self , request : HttpRequest , * , stream : bool = False , * *kwargs : Any ) -> HttpResponse :
88118 """Runs the network request through the client's chained policies.
89119
90120 >>> from azure.core.rest import HttpRequest
@@ -104,12 +134,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
104134
105135 request_copy = deepcopy (request )
106136 request_copy .url = self ._client .format_url (request_copy .url )
107- return self ._client .send_request (request_copy , ** kwargs )
137+ return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
108138
109139 def close (self ) -> None :
110140 self ._client .close ()
111141
112- def __enter__ (self ) -> "DashboardManagementClient" :
142+ def __enter__ (self ) -> Self :
113143 self ._client .__enter__ ()
114144 return self
115145
0 commit comments