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) Python Code Generator.
5+ # Code generated by Microsoft (R) AutoRest Code Generator.
66# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77# --------------------------------------------------------------------------
88
99from copy import deepcopy
10- from typing import Any , TYPE_CHECKING
10+ from typing import Any , Optional , TYPE_CHECKING , cast
1111from typing_extensions import Self
1212
1313from azure .core .pipeline import policies
1414from azure .core .rest import HttpRequest , HttpResponse
15+ from azure .core .settings import settings
1516from azure .mgmt .core import ARMPipelineClient
1617from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
18+ from azure .mgmt .core .tools import get_arm_endpoints
1719
18- from ._configuration import FabricMgmtClientConfiguration
19- from ._serialization import Deserializer , Serializer
20+ from . import models as _models
21+ from ._configuration import MicrosoftFabricManagementServiceConfiguration
22+ from ._utils .serialization import Deserializer , Serializer
2023from .operations import FabricCapacitiesOperations , Operations
2124
2225if TYPE_CHECKING :
2326 from azure .core .credentials import TokenCredential
2427
2528
26- class FabricMgmtClient :
27- """FabricMgmtClient .
29+ class MicrosoftFabricManagementService :
30+ """Microsoft.Fabric Resource Provider management API .
2831
29- :ivar fabric_capacities: FabricCapacitiesOperations operations
30- :vartype fabric_capacities: azure.mgmt.fabric.operations.FabricCapacitiesOperations
3132 :ivar operations: Operations operations
3233 :vartype operations: azure.mgmt.fabric.operations.Operations
33- :param credential: Credential used to authenticate requests to the service. Required.
34+ :ivar fabric_capacities: FabricCapacitiesOperations operations
35+ :vartype fabric_capacities: azure.mgmt.fabric.operations.FabricCapacitiesOperations
36+ :param credential: Credential needed for the client to connect to Azure. Required.
3437 :type credential: ~azure.core.credentials.TokenCredential
3538 :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
3639 :type subscription_id: str
37- :param base_url: Service host . Default value is "https://management.azure.com" .
40+ :param base_url: Service URL . Default value is None .
3841 :type base_url: str
39- :keyword api_version: The API version to use for this operation . Default value is "2023-11-01".
40- Note that overriding this default value may result in unsupported behavior.
42+ :keyword api_version: Api Version . Default value is "2023-11-01". Note that overriding this
43+ default value may result in unsupported behavior.
4144 :paramtype api_version: str
4245 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
4346 Retry-After header is present.
4447 """
4548
4649 def __init__ (
47- self ,
48- credential : "TokenCredential" ,
49- subscription_id : str ,
50- base_url : str = "https://management.azure.com" ,
51- ** kwargs : Any
50+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
5251 ) -> None :
53- _endpoint = "{endpoint}"
54- self ._config = FabricMgmtClientConfiguration (
55- credential = credential , subscription_id = subscription_id , base_url = base_url , ** kwargs
52+ _cloud = kwargs .pop ("cloud_setting" , None ) or settings .current .azure_cloud # type: ignore
53+ _endpoints = get_arm_endpoints (_cloud )
54+ if not base_url :
55+ base_url = _endpoints ["resource_manager" ]
56+ credential_scopes = kwargs .pop ("credential_scopes" , _endpoints ["credential_scopes" ])
57+ self ._config = MicrosoftFabricManagementServiceConfiguration (
58+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
5659 )
60+
5761 _policies = kwargs .pop ("policies" , None )
5862 if _policies is None :
5963 _policies = [
@@ -72,23 +76,24 @@ def __init__(
7276 policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
7377 self ._config .http_logging_policy ,
7478 ]
75- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = _endpoint , policies = _policies , ** kwargs )
79+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = cast ( str , base_url ) , policies = _policies , ** kwargs )
7680
77- self ._serialize = Serializer ()
78- self ._deserialize = Deserializer ()
81+ client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
82+ self ._serialize = Serializer (client_models )
83+ self ._deserialize = Deserializer (client_models )
7984 self ._serialize .client_side_validation = False
85+ self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
8086 self .fabric_capacities = FabricCapacitiesOperations (
8187 self ._client , self ._config , self ._serialize , self ._deserialize
8288 )
83- self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
8489
85- def send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
90+ def _send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
8691 """Runs the network request through the client's chained policies.
8792
8893 >>> from azure.core.rest import HttpRequest
8994 >>> request = HttpRequest("GET", "https://www.example.org/")
9095 <HttpRequest [GET], url: 'https://www.example.org/'>
91- >>> response = client.send_request (request)
96+ >>> response = client._send_request (request)
9297 <HttpResponse: 200 OK>
9398
9499 For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@@ -101,11 +106,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
101106 """
102107
103108 request_copy = deepcopy (request )
104- path_format_arguments = {
105- "endpoint" : self ._serialize .url ("self._config.base_url" , self ._config .base_url , "str" , skip_quote = True ),
106- }
107-
108- request_copy .url = self ._client .format_url (request_copy .url , ** path_format_arguments )
109+ request_copy .url = self ._client .format_url (request_copy .url )
109110 return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
110111
111112 def close (self ) -> None :
0 commit comments