2
2
# --------------------------------------------------------------------------
3
3
# Copyright (c) Microsoft Corporation. All rights reserved.
4
4
# Licensed under the MIT License. See License.txt in the project root for license information.
5
- # Code generated by Microsoft (R) AutoRest Code Generator.
5
+ # Code generated by Microsoft (R) Python Code Generator.
6
6
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
# --------------------------------------------------------------------------
8
8
9
9
from copy import deepcopy
10
10
from typing import Any , TYPE_CHECKING
11
+ from typing_extensions import Self
11
12
13
+ from azure .core .pipeline import policies
12
14
from azure .core .rest import HttpRequest , HttpResponse
13
15
from azure .mgmt .core import ARMPipelineClient
16
+ from azure .mgmt .core .policies import ARMAutoResourceProviderRegistrationPolicy
14
17
15
- from . import models as _models
16
18
from ._configuration import WorkloadsSapVirtualInstanceMgmtClientConfiguration
17
19
from ._serialization import Deserializer , Serializer
18
20
from .operations import (
19
21
Operations ,
20
22
SAPApplicationServerInstancesOperations ,
21
- SAPCentralInstancesOperations ,
23
+ SAPCentralServerInstancesOperations ,
22
24
SAPDatabaseInstancesOperations ,
23
25
SAPVirtualInstancesOperations ,
24
- WorkloadsSapVirtualInstanceMgmtClientOperationsMixin ,
25
26
)
26
27
27
28
if TYPE_CHECKING :
28
- # pylint: disable=unused-import,ungrouped-imports
29
29
from azure .core .credentials import TokenCredential
30
30
31
31
32
- class WorkloadsSapVirtualInstanceMgmtClient (
33
- WorkloadsSapVirtualInstanceMgmtClientOperationsMixin
34
- ): # pylint: disable=client-accepts-api-version-keyword
32
+ class WorkloadsSapVirtualInstanceMgmtClient :
35
33
"""Workloads client provides access to various workload operations.
36
34
35
+ :ivar operations: Operations operations
36
+ :vartype operations: azure.mgmt.workloadssapvirtualinstance.operations.Operations
37
37
:ivar sap_virtual_instances: SAPVirtualInstancesOperations operations
38
38
:vartype sap_virtual_instances:
39
39
azure.mgmt.workloadssapvirtualinstance.operations.SAPVirtualInstancesOperations
40
- :ivar sap_central_instances: SAPCentralInstancesOperations operations
41
- :vartype sap_central_instances :
42
- azure.mgmt.workloadssapvirtualinstance.operations.SAPCentralInstancesOperations
40
+ :ivar sap_central_server_instances: SAPCentralServerInstancesOperations operations
41
+ :vartype sap_central_server_instances :
42
+ azure.mgmt.workloadssapvirtualinstance.operations.SAPCentralServerInstancesOperations
43
43
:ivar sap_database_instances: SAPDatabaseInstancesOperations operations
44
44
:vartype sap_database_instances:
45
45
azure.mgmt.workloadssapvirtualinstance.operations.SAPDatabaseInstancesOperations
46
46
:ivar sap_application_server_instances: SAPApplicationServerInstancesOperations operations
47
47
:vartype sap_application_server_instances:
48
48
azure.mgmt.workloadssapvirtualinstance.operations.SAPApplicationServerInstancesOperations
49
- :ivar operations: Operations operations
50
- :vartype operations: azure.mgmt.workloadssapvirtualinstance.operations.Operations
51
- :param credential: Credential needed for the client to connect to Azure. Required.
49
+ :param credential: Credential used to authenticate requests to the service. Required.
52
50
:type credential: ~azure.core.credentials.TokenCredential
53
- :param subscription_id: The ID of the target subscription. Required.
51
+ :param subscription_id: The ID of the target subscription. The value must be an UUID. Required.
54
52
:type subscription_id: str
55
- :param base_url: Service URL . Default value is "https://management.azure.com".
53
+ :param base_url: Service host . Default value is "https://management.azure.com".
56
54
:type base_url: str
57
- :keyword api_version: Api Version . Default value is "2023-10 -01-preview". Note that overriding
58
- this default value may result in unsupported behavior.
55
+ :keyword api_version: The API version to use for this operation . Default value is "2024-09 -01".
56
+ Note that overriding this default value may result in unsupported behavior.
59
57
:paramtype api_version: str
60
58
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
61
59
Retry-After header is present.
@@ -68,19 +66,38 @@ def __init__(
68
66
base_url : str = "https://management.azure.com" ,
69
67
** kwargs : Any
70
68
) -> None :
69
+ _endpoint = "{endpoint}"
71
70
self ._config = WorkloadsSapVirtualInstanceMgmtClientConfiguration (
72
- credential = credential , subscription_id = subscription_id , ** kwargs
71
+ credential = credential , subscription_id = subscription_id , base_url = base_url , ** kwargs
73
72
)
74
- self ._client : ARMPipelineClient = ARMPipelineClient (base_url = base_url , config = self ._config , ** kwargs )
75
-
76
- client_models = {k : v for k , v in _models .__dict__ .items () if isinstance (v , type )}
77
- self ._serialize = Serializer (client_models )
78
- self ._deserialize = Deserializer (client_models )
73
+ _policies = kwargs .pop ("policies" , None )
74
+ if _policies is None :
75
+ _policies = [
76
+ policies .RequestIdPolicy (** kwargs ),
77
+ self ._config .headers_policy ,
78
+ self ._config .user_agent_policy ,
79
+ self ._config .proxy_policy ,
80
+ policies .ContentDecodePolicy (** kwargs ),
81
+ ARMAutoResourceProviderRegistrationPolicy (),
82
+ self ._config .redirect_policy ,
83
+ self ._config .retry_policy ,
84
+ self ._config .authentication_policy ,
85
+ self ._config .custom_hook_policy ,
86
+ self ._config .logging_policy ,
87
+ policies .DistributedTracingPolicy (** kwargs ),
88
+ policies .SensitiveHeaderCleanupPolicy (** kwargs ) if self ._config .redirect_policy else None ,
89
+ self ._config .http_logging_policy ,
90
+ ]
91
+ self ._client : ARMPipelineClient = ARMPipelineClient (base_url = _endpoint , policies = _policies , ** kwargs )
92
+
93
+ self ._serialize = Serializer ()
94
+ self ._deserialize = Deserializer ()
79
95
self ._serialize .client_side_validation = False
96
+ self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
80
97
self .sap_virtual_instances = SAPVirtualInstancesOperations (
81
98
self ._client , self ._config , self ._serialize , self ._deserialize
82
99
)
83
- self .sap_central_instances = SAPCentralInstancesOperations (
100
+ self .sap_central_server_instances = SAPCentralServerInstancesOperations (
84
101
self ._client , self ._config , self ._serialize , self ._deserialize
85
102
)
86
103
self .sap_database_instances = SAPDatabaseInstancesOperations (
@@ -89,15 +106,14 @@ def __init__(
89
106
self .sap_application_server_instances = SAPApplicationServerInstancesOperations (
90
107
self ._client , self ._config , self ._serialize , self ._deserialize
91
108
)
92
- self .operations = Operations (self ._client , self ._config , self ._serialize , self ._deserialize )
93
109
94
- def _send_request (self , request : HttpRequest , ** kwargs : Any ) -> HttpResponse :
110
+ def send_request (self , request : HttpRequest , * , stream : bool = False , ** kwargs : Any ) -> HttpResponse :
95
111
"""Runs the network request through the client's chained policies.
96
112
97
113
>>> from azure.core.rest import HttpRequest
98
114
>>> request = HttpRequest("GET", "https://www.example.org/")
99
115
<HttpRequest [GET], url: 'https://www.example.org/'>
100
- >>> response = client._send_request (request)
116
+ >>> response = client.send_request (request)
101
117
<HttpResponse: 200 OK>
102
118
103
119
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@@ -110,13 +126,17 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
110
126
"""
111
127
112
128
request_copy = deepcopy (request )
113
- request_copy .url = self ._client .format_url (request_copy .url )
114
- return self ._client .send_request (request_copy , ** kwargs )
129
+ path_format_arguments = {
130
+ "endpoint" : self ._serialize .url ("self._config.base_url" , self ._config .base_url , "str" , skip_quote = True ),
131
+ }
132
+
133
+ request_copy .url = self ._client .format_url (request_copy .url , ** path_format_arguments )
134
+ return self ._client .send_request (request_copy , stream = stream , ** kwargs ) # type: ignore
115
135
116
136
def close (self ) -> None :
117
137
self ._client .close ()
118
138
119
- def __enter__ (self ) -> "WorkloadsSapVirtualInstanceMgmtClient" :
139
+ def __enter__ (self ) -> Self :
120
140
self ._client .__enter__ ()
121
141
return self
122
142
0 commit comments