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 TrustedSigningMgmtClientConfiguration
19- from ._serialization import Deserializer , Serializer
20+ from . import models as _models
21+ from ._configuration import CodeSigningManagementClientConfiguration
22+ from ._utils .serialization import Deserializer , Serializer
2023from .operations import CertificateProfilesOperations , CodeSigningAccountsOperations , Operations
2124
2225if TYPE_CHECKING :
23- # pylint: disable=unused-import,ungrouped-imports
2426 from azure .core .credentials import TokenCredential
2527
2628
27- class TrustedSigningMgmtClient : # pylint: disable=client-accepts-api-version-keyword
29+ class CodeSigningManagementClient :
2830 """Code Signing resource provider api.
2931
3032 :ivar operations: Operations operations
@@ -35,31 +37,31 @@ class TrustedSigningMgmtClient: # pylint: disable=client-accepts-api-version-ke
3537 :ivar certificate_profiles: CertificateProfilesOperations operations
3638 :vartype certificate_profiles:
3739 azure.mgmt.trustedsigning.operations.CertificateProfilesOperations
38- :param credential: Credential used to authenticate requests to the service . Required.
40+ :param credential: Credential needed for the client to connect to Azure . Required.
3941 :type credential: ~azure.core.credentials.TokenCredential
4042 :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
4143 :type subscription_id: str
42- :param base_url: Service host . Default value is "https://management.azure.com" .
44+ :param base_url: Service URL . Default value is None .
4345 :type base_url: str
44- :keyword api_version: The API version to use for this operation. Default value is
45- "2024-02-05-preview". Note that overriding this default value may result in unsupported
46- behavior.
46+ :keyword api_version: Api Version. Default value is "2024-09-30-preview". Note that overriding
47+ this default value may result in unsupported behavior.
4748 :paramtype api_version: str
4849 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
4950 Retry-After header is present.
5051 """
5152
5253 def __init__ (
53- self ,
54- credential : "TokenCredential" ,
55- subscription_id : str ,
56- base_url : str = "https://management.azure.com" ,
57- ** kwargs : Any
54+ self , credential : "TokenCredential" , subscription_id : str , base_url : Optional [str ] = None , ** kwargs : Any
5855 ) -> None :
59- _endpoint = "{endpoint}"
60- self ._config = TrustedSigningMgmtClientConfiguration (
61- credential = credential , subscription_id = subscription_id , base_url = base_url , ** kwargs
56+ _cloud = kwargs .pop ("cloud_setting" , None ) or settings .current .azure_cloud # type: ignore
57+ _endpoints = get_arm_endpoints (_cloud )
58+ if not base_url :
59+ base_url = _endpoints ["resource_manager" ]
60+ credential_scopes = kwargs .pop ("credential_scopes" , _endpoints ["credential_scopes" ])
61+ self ._config = CodeSigningManagementClientConfiguration (
62+ credential = credential , subscription_id = subscription_id , credential_scopes = credential_scopes , ** kwargs
6263 )
64+
6365 _policies = kwargs .pop ("policies" , None )
6466 if _policies is None :
6567 _policies = [
@@ -78,10 +80,11 @@ def __init__(
7880 policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
7981 self ._config .http_logging_policy ,
8082 ]
81- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = _endpoint , policies = _policies , ** kwargs )
83+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = cast ( str , base_url ) , policies = _policies , ** kwargs )
8284
83- self ._serialize = Serializer ()
84- self ._deserialize = Deserializer ()
85+ client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
86+ self ._serialize = Serializer (client_models )
87+ self ._deserialize = Deserializer (client_models )
8588 self ._serialize .client_side_validation = False
8689 self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
8790 self .code_signing_accounts = CodeSigningAccountsOperations (
@@ -91,13 +94,13 @@ def __init__(
9194 self ._client , self ._config , self ._serialize , self ._deserialize
9295 )
9396
94- def send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
97+ def _send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
9598 """Runs the network request through the client's chained policies.
9699
97100 >>> from azure.core.rest import HttpRequest
98101 >>> request = HttpRequest("GET", "https://www.example.org/")
99102 <HttpRequest [GET], url: 'https://www.example.org/'>
100- >>> response = client.send_request (request)
103+ >>> response = client._send_request (request)
101104 <HttpResponse: 200 OK>
102105
103106 For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@@ -110,11 +113,7 @@ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs:
110113 """
111114
112115 request_copy = deepcopy (request )
113- path_format_arguments = {
114- "endpoint" : self ._serialize .url ("self._config.base_url" , self ._config .base_url , "str" , skip_quote = True ),
115- }
116-
117- request_copy .url = self ._client .format_url (request_copy .url , ** path_format_arguments )
116+ request_copy .url = self ._client .format_url (request_copy .url )
118117 return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
119118
120119 def close (self ) -> None :
0 commit comments