baiducloud-python-sdk-snic 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- baiducloud_python_sdk_snic/__init__.py +5 -0
- baiducloud_python_sdk_snic/api/__init__.py +0 -0
- baiducloud_python_sdk_snic/api/snic_client.py +309 -0
- baiducloud_python_sdk_snic/models/__init__.py +19 -0
- baiducloud_python_sdk_snic/models/billing.py +68 -0
- baiducloud_python_sdk_snic/models/create_snic_request.py +153 -0
- baiducloud_python_sdk_snic/models/create_snic_response.py +69 -0
- baiducloud_python_sdk_snic/models/delete_snic_request.py +64 -0
- baiducloud_python_sdk_snic/models/describe_snic_request.py +58 -0
- baiducloud_python_sdk_snic/models/describe_snic_response.py +155 -0
- baiducloud_python_sdk_snic/models/endpoint.py +142 -0
- baiducloud_python_sdk_snic/models/list_snic_request.py +102 -0
- baiducloud_python_sdk_snic/models/list_snic_response.py +94 -0
- baiducloud_python_sdk_snic/models/query_available_public_services_response.py +61 -0
- baiducloud_python_sdk_snic/models/reservation.py +66 -0
- baiducloud_python_sdk_snic/models/tag_model.py +66 -0
- baiducloud_python_sdk_snic/models/update_snic_esg_request.py +72 -0
- baiducloud_python_sdk_snic/models/update_snic_request.py +80 -0
- baiducloud_python_sdk_snic/models/update_snic_sg_request.py +72 -0
- baiducloud_python_sdk_snic-0.0.1.dist-info/LICENSE +177 -0
- baiducloud_python_sdk_snic-0.0.1.dist-info/METADATA +76 -0
- baiducloud_python_sdk_snic-0.0.1.dist-info/RECORD +24 -0
- baiducloud_python_sdk_snic-0.0.1.dist-info/WHEEL +5 -0
- baiducloud_python_sdk_snic-0.0.1.dist-info/top_level.txt +1 -0
|
File without changes
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Example for snic client.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import copy
|
|
6
|
+
import logging
|
|
7
|
+
|
|
8
|
+
from baiducloud_python_sdk_core import utils, bce_base_client
|
|
9
|
+
from baiducloud_python_sdk_core.auth import bce_v1_signer
|
|
10
|
+
from baiducloud_python_sdk_core.bce_base_client import BceBaseClient
|
|
11
|
+
from baiducloud_python_sdk_core.http import bce_http_client
|
|
12
|
+
from baiducloud_python_sdk_core.http import handler
|
|
13
|
+
from baiducloud_python_sdk_core.http import http_methods
|
|
14
|
+
from baiducloud_python_sdk_snic.models.create_snic_response import CreateSnicResponse
|
|
15
|
+
from baiducloud_python_sdk_snic.models.describe_snic_response import DescribeSnicResponse
|
|
16
|
+
from baiducloud_python_sdk_snic.models.list_snic_response import ListSnicResponse
|
|
17
|
+
from baiducloud_python_sdk_snic.models.query_available_public_services_response import (
|
|
18
|
+
QueryAvailablePublicServicesResponse,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
_logger = logging.getLogger(__name__)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class SnicClient(BceBaseClient):
|
|
25
|
+
"""
|
|
26
|
+
snic base sdk client
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
VERSION_V1 = b'/v1'
|
|
30
|
+
|
|
31
|
+
CONSTANT_ENDPOINT = b'endpoint'
|
|
32
|
+
|
|
33
|
+
CONSTANT_PUBLIC_SERVICE = b'publicService'
|
|
34
|
+
|
|
35
|
+
def __init__(self, config=None):
|
|
36
|
+
"""
|
|
37
|
+
Initialize the snic client.
|
|
38
|
+
|
|
39
|
+
:param config: Client configuration
|
|
40
|
+
:type config: baidubce.BceClientConfiguration
|
|
41
|
+
"""
|
|
42
|
+
bce_base_client.BceBaseClient.__init__(self, config)
|
|
43
|
+
|
|
44
|
+
def create_snic(self, request, config=None):
|
|
45
|
+
"""
|
|
46
|
+
create_snic
|
|
47
|
+
|
|
48
|
+
:param request: Request entity containing all parameters
|
|
49
|
+
:type request: SnicClientRequest
|
|
50
|
+
:param config: Optional request configuration override
|
|
51
|
+
:type config: baiducloud_python_sdk_core.BceClientConfiguration
|
|
52
|
+
|
|
53
|
+
:return: API response containing CreateSnicResponse data
|
|
54
|
+
:rtype: CreateSnicResponse
|
|
55
|
+
|
|
56
|
+
:raises BceClientError: Client error (network failure, invalid parameters, etc.)
|
|
57
|
+
:raises BceServerError: Server error (4xx/5xx HTTP status codes)
|
|
58
|
+
"""
|
|
59
|
+
path = utils.append_uri(SnicClient.VERSION_V1, SnicClient.CONSTANT_ENDPOINT)
|
|
60
|
+
headers = None
|
|
61
|
+
params = {}
|
|
62
|
+
if request.client_token is not None:
|
|
63
|
+
params['clientToken'] = request.client_token
|
|
64
|
+
merged_config = self._create_request_with_host(request, config)
|
|
65
|
+
return self._send_request(
|
|
66
|
+
http_methods.POST,
|
|
67
|
+
path=path,
|
|
68
|
+
body=request.to_json_string(),
|
|
69
|
+
params=params,
|
|
70
|
+
config=merged_config,
|
|
71
|
+
model=CreateSnicResponse,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
def delete_snic(self, request, config=None):
|
|
75
|
+
"""
|
|
76
|
+
delete_snic
|
|
77
|
+
|
|
78
|
+
:param request: Request entity containing all parameters
|
|
79
|
+
:type request: SnicClientRequest
|
|
80
|
+
:param config: Optional request configuration override
|
|
81
|
+
:type config: baiducloud_python_sdk_core.BceClientConfiguration
|
|
82
|
+
|
|
83
|
+
:return: API response
|
|
84
|
+
:rtype: baiducloud_python_sdk_core.bce_response.BceResponse
|
|
85
|
+
|
|
86
|
+
:raises BceClientError: Client error (network failure, invalid parameters, etc.)
|
|
87
|
+
:raises BceServerError: Server error (4xx/5xx HTTP status codes)
|
|
88
|
+
"""
|
|
89
|
+
path = utils.append_uri(SnicClient.VERSION_V1, SnicClient.CONSTANT_ENDPOINT, request.endpoint_id)
|
|
90
|
+
headers = None
|
|
91
|
+
params = {}
|
|
92
|
+
if request.client_token is not None:
|
|
93
|
+
params['clientToken'] = request.client_token
|
|
94
|
+
merged_config = self._create_request_with_host(request, config)
|
|
95
|
+
return self._send_request(http_methods.DELETE, path=path, params=params, config=merged_config)
|
|
96
|
+
|
|
97
|
+
def describe_snic(self, request, config=None):
|
|
98
|
+
"""
|
|
99
|
+
describe_snic
|
|
100
|
+
|
|
101
|
+
:param request: Request entity containing all parameters
|
|
102
|
+
:type request: SnicClientRequest
|
|
103
|
+
:param config: Optional request configuration override
|
|
104
|
+
:type config: baiducloud_python_sdk_core.BceClientConfiguration
|
|
105
|
+
|
|
106
|
+
:return: API response containing DescribeSnicResponse data
|
|
107
|
+
:rtype: DescribeSnicResponse
|
|
108
|
+
|
|
109
|
+
:raises BceClientError: Client error (network failure, invalid parameters, etc.)
|
|
110
|
+
:raises BceServerError: Server error (4xx/5xx HTTP status codes)
|
|
111
|
+
"""
|
|
112
|
+
path = utils.append_uri(SnicClient.VERSION_V1, SnicClient.CONSTANT_ENDPOINT, request.endpoint_id)
|
|
113
|
+
headers = None
|
|
114
|
+
merged_config = self._create_request_with_host(request, config)
|
|
115
|
+
return self._send_request(http_methods.GET, path=path, config=merged_config, model=DescribeSnicResponse)
|
|
116
|
+
|
|
117
|
+
def list_snic(self, request, config=None):
|
|
118
|
+
"""
|
|
119
|
+
list_snic
|
|
120
|
+
|
|
121
|
+
:param request: Request entity containing all parameters
|
|
122
|
+
:type request: SnicClientRequest
|
|
123
|
+
:param config: Optional request configuration override
|
|
124
|
+
:type config: baiducloud_python_sdk_core.BceClientConfiguration
|
|
125
|
+
|
|
126
|
+
:return: API response containing ListSnicResponse data
|
|
127
|
+
:rtype: ListSnicResponse
|
|
128
|
+
|
|
129
|
+
:raises BceClientError: Client error (network failure, invalid parameters, etc.)
|
|
130
|
+
:raises BceServerError: Server error (4xx/5xx HTTP status codes)
|
|
131
|
+
"""
|
|
132
|
+
path = utils.append_uri(SnicClient.VERSION_V1, SnicClient.CONSTANT_ENDPOINT)
|
|
133
|
+
headers = None
|
|
134
|
+
params = {}
|
|
135
|
+
if request.vpc_id is not None:
|
|
136
|
+
params['vpcId'] = request.vpc_id
|
|
137
|
+
if request.name is not None:
|
|
138
|
+
params['name'] = request.name
|
|
139
|
+
if request.ip_address is not None:
|
|
140
|
+
params['ipAddress'] = request.ip_address
|
|
141
|
+
if request.status is not None:
|
|
142
|
+
params['status'] = request.status
|
|
143
|
+
if request.subnet_id is not None:
|
|
144
|
+
params['subnetId'] = request.subnet_id
|
|
145
|
+
if request.service is not None:
|
|
146
|
+
params['service'] = request.service
|
|
147
|
+
if request.marker is not None:
|
|
148
|
+
params['marker'] = request.marker
|
|
149
|
+
if request.max_keys is not None:
|
|
150
|
+
params['maxKeys'] = request.max_keys
|
|
151
|
+
merged_config = self._create_request_with_host(request, config)
|
|
152
|
+
return self._send_request(
|
|
153
|
+
http_methods.GET, path=path, params=params, config=merged_config, model=ListSnicResponse
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
def query_available_public_services(self, config=None):
|
|
157
|
+
"""
|
|
158
|
+
query_available_public_services
|
|
159
|
+
:param config: Optional request configuration override
|
|
160
|
+
:type config: baiducloud_python_sdk_core.BceClientConfiguration
|
|
161
|
+
|
|
162
|
+
:return: API response containing QueryAvailablePublicServicesResponse data
|
|
163
|
+
:rtype: QueryAvailablePublicServicesResponse
|
|
164
|
+
|
|
165
|
+
:raises BceClientError: Client error (network failure, invalid parameters, etc.)
|
|
166
|
+
:raises BceServerError: Server error (4xx/5xx HTTP status codes)
|
|
167
|
+
"""
|
|
168
|
+
path = utils.append_uri(
|
|
169
|
+
SnicClient.VERSION_V1, SnicClient.CONSTANT_ENDPOINT, SnicClient.CONSTANT_PUBLIC_SERVICE
|
|
170
|
+
)
|
|
171
|
+
headers = None
|
|
172
|
+
return self._send_request(
|
|
173
|
+
http_methods.GET, path=path, config=config, model=QueryAvailablePublicServicesResponse
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
def update_snic(self, request, config=None):
|
|
177
|
+
"""
|
|
178
|
+
update_snic
|
|
179
|
+
|
|
180
|
+
:param request: Request entity containing all parameters
|
|
181
|
+
:type request: SnicClientRequest
|
|
182
|
+
:param config: Optional request configuration override
|
|
183
|
+
:type config: baiducloud_python_sdk_core.BceClientConfiguration
|
|
184
|
+
|
|
185
|
+
:return: API response
|
|
186
|
+
:rtype: baiducloud_python_sdk_core.bce_response.BceResponse
|
|
187
|
+
|
|
188
|
+
:raises BceClientError: Client error (network failure, invalid parameters, etc.)
|
|
189
|
+
:raises BceServerError: Server error (4xx/5xx HTTP status codes)
|
|
190
|
+
"""
|
|
191
|
+
path = utils.append_uri(SnicClient.VERSION_V1, SnicClient.CONSTANT_ENDPOINT, request.endpoint_id)
|
|
192
|
+
headers = None
|
|
193
|
+
params = {}
|
|
194
|
+
if request.client_token is not None:
|
|
195
|
+
params['clientToken'] = request.client_token
|
|
196
|
+
merged_config = self._create_request_with_host(request, config)
|
|
197
|
+
return self._send_request(
|
|
198
|
+
http_methods.PUT, path=path, body=request.to_json_string(), params=params, config=merged_config
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
def update_snic_esg(self, request, config=None):
|
|
202
|
+
"""
|
|
203
|
+
update_snic_esg
|
|
204
|
+
|
|
205
|
+
:param request: Request entity containing all parameters
|
|
206
|
+
:type request: SnicClientRequest
|
|
207
|
+
:param config: Optional request configuration override
|
|
208
|
+
:type config: baiducloud_python_sdk_core.BceClientConfiguration
|
|
209
|
+
|
|
210
|
+
:return: API response
|
|
211
|
+
:rtype: baiducloud_python_sdk_core.bce_response.BceResponse
|
|
212
|
+
|
|
213
|
+
:raises BceClientError: Client error (network failure, invalid parameters, etc.)
|
|
214
|
+
:raises BceServerError: Server error (4xx/5xx HTTP status codes)
|
|
215
|
+
"""
|
|
216
|
+
path = utils.append_uri(SnicClient.VERSION_V1, SnicClient.CONSTANT_ENDPOINT, request.endpoint_id)
|
|
217
|
+
headers = None
|
|
218
|
+
params = {}
|
|
219
|
+
params['bindEsg'] = None
|
|
220
|
+
if request.client_token is not None:
|
|
221
|
+
params['clientToken'] = request.client_token
|
|
222
|
+
merged_config = self._create_request_with_host(request, config)
|
|
223
|
+
return self._send_request(
|
|
224
|
+
http_methods.PUT, path=path, body=request.to_json_string(), params=params, config=merged_config
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
def update_snic_sg(self, request, config=None):
|
|
228
|
+
"""
|
|
229
|
+
update_snic_sg
|
|
230
|
+
|
|
231
|
+
:param request: Request entity containing all parameters
|
|
232
|
+
:type request: SnicClientRequest
|
|
233
|
+
:param config: Optional request configuration override
|
|
234
|
+
:type config: baiducloud_python_sdk_core.BceClientConfiguration
|
|
235
|
+
|
|
236
|
+
:return: API response
|
|
237
|
+
:rtype: baiducloud_python_sdk_core.bce_response.BceResponse
|
|
238
|
+
|
|
239
|
+
:raises BceClientError: Client error (network failure, invalid parameters, etc.)
|
|
240
|
+
:raises BceServerError: Server error (4xx/5xx HTTP status codes)
|
|
241
|
+
"""
|
|
242
|
+
path = utils.append_uri(SnicClient.VERSION_V1, SnicClient.CONSTANT_ENDPOINT, request.endpoint_id)
|
|
243
|
+
headers = None
|
|
244
|
+
params = {}
|
|
245
|
+
params['bindSg'] = None
|
|
246
|
+
if request.client_token is not None:
|
|
247
|
+
params['clientToken'] = request.client_token
|
|
248
|
+
merged_config = self._create_request_with_host(request, config)
|
|
249
|
+
return self._send_request(
|
|
250
|
+
http_methods.PUT, path=path, body=request.to_json_string(), params=params, config=merged_config
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
def _merge_config(self, config=None):
|
|
254
|
+
"""
|
|
255
|
+
:param config:
|
|
256
|
+
:type config: baiducloud_python_sdk_core.BceClientConfiguration
|
|
257
|
+
"""
|
|
258
|
+
if config is None:
|
|
259
|
+
return self.config
|
|
260
|
+
else:
|
|
261
|
+
new_config = copy.copy(self.config)
|
|
262
|
+
new_config.merge_non_none_values(config)
|
|
263
|
+
return new_config
|
|
264
|
+
|
|
265
|
+
def _send_request(
|
|
266
|
+
self, http_method, path, body=None, headers=None, params=None, config=None, body_parser=None, model=None
|
|
267
|
+
):
|
|
268
|
+
"""
|
|
269
|
+
Send an HTTP request to the service endpoint.
|
|
270
|
+
|
|
271
|
+
:param http_method: HTTP method (GET, POST, PUT, DELETE, etc.)
|
|
272
|
+
:type http_method: bytes
|
|
273
|
+
:param path: Request path
|
|
274
|
+
:type path: bytes
|
|
275
|
+
:param body: Optional request body
|
|
276
|
+
:type body: str or bytes
|
|
277
|
+
:param headers: Optional HTTP headers
|
|
278
|
+
:type headers: dict
|
|
279
|
+
:param params: Optional query parameters
|
|
280
|
+
:type params: dict
|
|
281
|
+
:param config: Optional request configuration override
|
|
282
|
+
:type config: baiducloud_python_sdk_core.BceClientConfiguration
|
|
283
|
+
:param body_parser: Optional custom body parser function
|
|
284
|
+
:type body_parser: callable
|
|
285
|
+
:param model: Optional response model class for deserialization
|
|
286
|
+
:type model: class
|
|
287
|
+
|
|
288
|
+
:return: API response
|
|
289
|
+
:rtype: baiducloud_python_sdk_core.bce_response.BceResponse
|
|
290
|
+
|
|
291
|
+
:raises BceClientError: Client error (network connection failure, SSL errors, etc.)
|
|
292
|
+
:raises BceServerError: Server returned error response
|
|
293
|
+
"""
|
|
294
|
+
config = self._merge_config(config)
|
|
295
|
+
if body_parser is None:
|
|
296
|
+
body_parser = handler.parse_json
|
|
297
|
+
if headers is None:
|
|
298
|
+
headers = {b'Accept': b'*/*', b'Content-Type': b'application/json;charset=utf-8'}
|
|
299
|
+
return bce_http_client.send_request(
|
|
300
|
+
config,
|
|
301
|
+
bce_v1_signer.sign,
|
|
302
|
+
[handler.parse_error, body_parser],
|
|
303
|
+
http_method,
|
|
304
|
+
path,
|
|
305
|
+
body,
|
|
306
|
+
headers,
|
|
307
|
+
params,
|
|
308
|
+
model=model,
|
|
309
|
+
)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Models for snic SDK.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from .billing import Billing
|
|
6
|
+
from .create_snic_request import CreateSnicRequest
|
|
7
|
+
from .create_snic_response import CreateSnicResponse
|
|
8
|
+
from .describe_snic_response import DescribeSnicResponse
|
|
9
|
+
from .endpoint import Endpoint
|
|
10
|
+
from .list_snic_response import ListSnicResponse
|
|
11
|
+
from .query_available_public_services_response import QueryAvailablePublicServicesResponse
|
|
12
|
+
from .reservation import Reservation
|
|
13
|
+
from .tag_model import TagModel
|
|
14
|
+
from .update_snic_esg_request import UpdateSnicEsgRequest
|
|
15
|
+
from .update_snic_request import UpdateSnicRequest
|
|
16
|
+
from .update_snic_sg_request import UpdateSnicSgRequest
|
|
17
|
+
from .delete_snic_request import DeleteSnicRequest
|
|
18
|
+
from .list_snic_request import ListSnicRequest
|
|
19
|
+
from .describe_snic_request import DescribeSnicRequest
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Billing information
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from baiducloud_python_sdk_core.abstract_model import AbstractModel
|
|
6
|
+
|
|
7
|
+
from baiducloud_python_sdk_snic.models.reservation import Reservation
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Billing(AbstractModel):
|
|
11
|
+
"""
|
|
12
|
+
Billing
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(self, payment_timing=None, reservation=None):
|
|
16
|
+
"""
|
|
17
|
+
Initialize Billing instance.
|
|
18
|
+
|
|
19
|
+
:param payment_timing: 付款时间,预支付(Prepaid)和后支付(Postpaid),创建订单需要设置,续费订单无需设置
|
|
20
|
+
:type payment_timing: str (optional)
|
|
21
|
+
|
|
22
|
+
:param reservation: reservation attribute
|
|
23
|
+
:type reservation: Reservation (optional)
|
|
24
|
+
"""
|
|
25
|
+
super().__init__()
|
|
26
|
+
self.payment_timing = payment_timing
|
|
27
|
+
self.reservation = reservation
|
|
28
|
+
|
|
29
|
+
def to_dict(self):
|
|
30
|
+
"""
|
|
31
|
+
Convert the model instance to a dictionary representation.
|
|
32
|
+
|
|
33
|
+
Nested model objects are recursively converted to dictionaries.
|
|
34
|
+
|
|
35
|
+
:return: Dictionary representation of the model
|
|
36
|
+
:rtype: dict
|
|
37
|
+
"""
|
|
38
|
+
_map = super().to_dict()
|
|
39
|
+
if _map is not None:
|
|
40
|
+
return _map
|
|
41
|
+
result = dict()
|
|
42
|
+
if self.payment_timing is not None:
|
|
43
|
+
result['paymentTiming'] = self.payment_timing
|
|
44
|
+
if self.reservation is not None:
|
|
45
|
+
result['reservation'] = self.reservation.to_dict()
|
|
46
|
+
return result
|
|
47
|
+
|
|
48
|
+
def from_dict(self, m):
|
|
49
|
+
"""
|
|
50
|
+
Populate the model instance from a dictionary.
|
|
51
|
+
|
|
52
|
+
Nested dictionaries are recursively converted to model objects.
|
|
53
|
+
|
|
54
|
+
:param m: Dictionary containing model data
|
|
55
|
+
:type m: dict
|
|
56
|
+
|
|
57
|
+
:return: Self reference for method chaining
|
|
58
|
+
:rtype: Billing
|
|
59
|
+
|
|
60
|
+
:raises TypeError: If input is not a dictionary type
|
|
61
|
+
:raises ValueError: If nested model conversion fails
|
|
62
|
+
"""
|
|
63
|
+
m = m or dict()
|
|
64
|
+
if m.get('paymentTiming') is not None:
|
|
65
|
+
self.payment_timing = m.get('paymentTiming')
|
|
66
|
+
if m.get('reservation') is not None:
|
|
67
|
+
self.reservation = Reservation().from_dict(m.get('reservation'))
|
|
68
|
+
return self
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Request entity for CreateSnicRequest information.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from baiducloud_python_sdk_core.abstract_model import AbstractModel
|
|
6
|
+
from baiducloud_python_sdk_snic.models.billing import Billing
|
|
7
|
+
from baiducloud_python_sdk_snic.models.tag_model import TagModel
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class CreateSnicRequest(AbstractModel):
|
|
11
|
+
"""
|
|
12
|
+
Request entity for CreateSnicRequest operation.
|
|
13
|
+
|
|
14
|
+
This class encapsulates all parameters for the API request.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
def __init__(
|
|
18
|
+
self,
|
|
19
|
+
vpc_id,
|
|
20
|
+
name,
|
|
21
|
+
subnet_id,
|
|
22
|
+
service,
|
|
23
|
+
bandwidth,
|
|
24
|
+
billing,
|
|
25
|
+
client_token=None,
|
|
26
|
+
description=None,
|
|
27
|
+
ip_address=None,
|
|
28
|
+
tags=None,
|
|
29
|
+
resource_group_id=None,
|
|
30
|
+
):
|
|
31
|
+
"""
|
|
32
|
+
Initialize CreateSnicRequest request entity.
|
|
33
|
+
|
|
34
|
+
:param client_token: client_token parameter
|
|
35
|
+
:type client_token: str (optional)
|
|
36
|
+
|
|
37
|
+
:param vpc_id: 所属vpc的id
|
|
38
|
+
:type vpc_id: str (required)
|
|
39
|
+
|
|
40
|
+
:param name: 服务网卡的名称,大小写字母、数字以及-_/.特殊字符、中文,必须以字母开头,长度1-65
|
|
41
|
+
:type name: str (required)
|
|
42
|
+
|
|
43
|
+
:param subnet_id: 所在子网的id
|
|
44
|
+
:type subnet_id: str (required)
|
|
45
|
+
|
|
46
|
+
:param service: 挂载的服务域名
|
|
47
|
+
:type service: str (required)
|
|
48
|
+
|
|
49
|
+
:param description: 服务网卡描述
|
|
50
|
+
:type description: str (optional)
|
|
51
|
+
|
|
52
|
+
:param ip_address: 指定服务网卡ip地址,不传自动分配ip地址
|
|
53
|
+
:type ip_address: str (optional)
|
|
54
|
+
|
|
55
|
+
:param bandwidth: 指定服务网卡带宽
|
|
56
|
+
:type bandwidth: int (required)
|
|
57
|
+
|
|
58
|
+
:param billing: billing parameter
|
|
59
|
+
:type billing: Billing (required)
|
|
60
|
+
|
|
61
|
+
:param tags: 标签
|
|
62
|
+
:type tags: List[TagModel] (optional)
|
|
63
|
+
|
|
64
|
+
:param resource_group_id: 资源组
|
|
65
|
+
:type resource_group_id: str (optional)
|
|
66
|
+
"""
|
|
67
|
+
super().__init__()
|
|
68
|
+
self.client_token = client_token
|
|
69
|
+
self.vpc_id = vpc_id
|
|
70
|
+
self.name = name
|
|
71
|
+
self.subnet_id = subnet_id
|
|
72
|
+
self.service = service
|
|
73
|
+
self.description = description
|
|
74
|
+
self.ip_address = ip_address
|
|
75
|
+
self.bandwidth = bandwidth
|
|
76
|
+
self.billing = billing
|
|
77
|
+
self.tags = tags
|
|
78
|
+
self.resource_group_id = resource_group_id
|
|
79
|
+
|
|
80
|
+
def to_dict(self):
|
|
81
|
+
"""
|
|
82
|
+
Convert the request entity to a dictionary representation.
|
|
83
|
+
|
|
84
|
+
Nested model objects are recursively converted to dictionaries.
|
|
85
|
+
|
|
86
|
+
:return: Dictionary representation of the request
|
|
87
|
+
:rtype: dict
|
|
88
|
+
"""
|
|
89
|
+
_map = super().to_dict()
|
|
90
|
+
if _map is not None:
|
|
91
|
+
return _map
|
|
92
|
+
result = dict()
|
|
93
|
+
if self.vpc_id is not None:
|
|
94
|
+
result['vpcId'] = self.vpc_id
|
|
95
|
+
if self.name is not None:
|
|
96
|
+
result['name'] = self.name
|
|
97
|
+
if self.subnet_id is not None:
|
|
98
|
+
result['subnetId'] = self.subnet_id
|
|
99
|
+
if self.service is not None:
|
|
100
|
+
result['service'] = self.service
|
|
101
|
+
if self.description is not None:
|
|
102
|
+
result['description'] = self.description
|
|
103
|
+
if self.ip_address is not None:
|
|
104
|
+
result['ipAddress'] = self.ip_address
|
|
105
|
+
if self.bandwidth is not None:
|
|
106
|
+
result['bandwidth'] = self.bandwidth
|
|
107
|
+
if self.billing is not None:
|
|
108
|
+
result['billing'] = self.billing.to_dict()
|
|
109
|
+
if self.tags is not None:
|
|
110
|
+
result['tags'] = [i.to_dict() for i in self.tags]
|
|
111
|
+
if self.resource_group_id is not None:
|
|
112
|
+
result['resourceGroupId'] = self.resource_group_id
|
|
113
|
+
return result
|
|
114
|
+
|
|
115
|
+
def from_dict(self, m):
|
|
116
|
+
"""
|
|
117
|
+
Populate the request entity from a dictionary.
|
|
118
|
+
|
|
119
|
+
Nested dictionaries are recursively converted to model objects.
|
|
120
|
+
|
|
121
|
+
:param m: Dictionary containing request data
|
|
122
|
+
:type m: dict
|
|
123
|
+
|
|
124
|
+
:return: Self reference for method chaining
|
|
125
|
+
:rtype: CreateSnicRequest
|
|
126
|
+
|
|
127
|
+
:raises TypeError: If input is not a dictionary or field type mismatch
|
|
128
|
+
:raises ValueError: If nested model conversion fails
|
|
129
|
+
"""
|
|
130
|
+
m = m or dict()
|
|
131
|
+
if m.get('clientToken') is not None:
|
|
132
|
+
self.client_token = m.get('clientToken')
|
|
133
|
+
if m.get('vpcId') is not None:
|
|
134
|
+
self.vpc_id = m.get('vpcId')
|
|
135
|
+
if m.get('name') is not None:
|
|
136
|
+
self.name = m.get('name')
|
|
137
|
+
if m.get('subnetId') is not None:
|
|
138
|
+
self.subnet_id = m.get('subnetId')
|
|
139
|
+
if m.get('service') is not None:
|
|
140
|
+
self.service = m.get('service')
|
|
141
|
+
if m.get('description') is not None:
|
|
142
|
+
self.description = m.get('description')
|
|
143
|
+
if m.get('ipAddress') is not None:
|
|
144
|
+
self.ip_address = m.get('ipAddress')
|
|
145
|
+
if m.get('bandwidth') is not None:
|
|
146
|
+
self.bandwidth = m.get('bandwidth')
|
|
147
|
+
if m.get('billing') is not None:
|
|
148
|
+
self.billing = Billing().from_dict(m.get('billing'))
|
|
149
|
+
if m.get('tags') is not None:
|
|
150
|
+
self.tags = [TagModel().from_dict(i) for i in m.get('tags')]
|
|
151
|
+
if m.get('resourceGroupId') is not None:
|
|
152
|
+
self.resource_group_id = m.get('resourceGroupId')
|
|
153
|
+
return self
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Request entity for CreateSnicResponse information.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from baiducloud_python_sdk_core.bce_response import BceResponse
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class CreateSnicResponse(BceResponse):
|
|
9
|
+
"""
|
|
10
|
+
CreateSnicResponse
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
def __init__(self, id=None, ip_address=None):
|
|
14
|
+
"""
|
|
15
|
+
Initialize CreateSnicResponse response.
|
|
16
|
+
|
|
17
|
+
:param id: 服务网卡的id
|
|
18
|
+
:type id: str (optional)
|
|
19
|
+
|
|
20
|
+
:param ip_address: ip地址
|
|
21
|
+
:type ip_address: str (optional)
|
|
22
|
+
"""
|
|
23
|
+
super().__init__()
|
|
24
|
+
self.id = id
|
|
25
|
+
self.ip_address = ip_address
|
|
26
|
+
|
|
27
|
+
def to_dict(self):
|
|
28
|
+
"""
|
|
29
|
+
Convert the response instance to a dictionary representation.
|
|
30
|
+
|
|
31
|
+
Includes metadata from the parent BceResponse class.
|
|
32
|
+
Nested model objects are recursively converted to dictionaries.
|
|
33
|
+
|
|
34
|
+
:return: Dictionary representation of the response
|
|
35
|
+
:rtype: dict
|
|
36
|
+
"""
|
|
37
|
+
_map = super().to_dict()
|
|
38
|
+
if _map is not None:
|
|
39
|
+
return _map
|
|
40
|
+
result = dict()
|
|
41
|
+
if self.metadata is not None:
|
|
42
|
+
result['metadata'] = dict(self.metadata)
|
|
43
|
+
if self.id is not None:
|
|
44
|
+
result['id'] = self.id
|
|
45
|
+
if self.ip_address is not None:
|
|
46
|
+
result['ipAddress'] = self.ip_address
|
|
47
|
+
return result
|
|
48
|
+
|
|
49
|
+
def from_dict(self, m):
|
|
50
|
+
"""
|
|
51
|
+
Populate the response instance from a dictionary.
|
|
52
|
+
|
|
53
|
+
Nested dictionaries are recursively converted to model objects.
|
|
54
|
+
|
|
55
|
+
:param m: Dictionary containing response data
|
|
56
|
+
:type m: dict
|
|
57
|
+
|
|
58
|
+
:return: Self reference for method chaining
|
|
59
|
+
:rtype: CreateSnicResponse
|
|
60
|
+
|
|
61
|
+
:raises TypeError: If input is not a dictionary or field type mismatch
|
|
62
|
+
:raises ValueError: If nested model conversion fails
|
|
63
|
+
"""
|
|
64
|
+
m = m or dict()
|
|
65
|
+
if m.get('id') is not None:
|
|
66
|
+
self.id = m.get('id')
|
|
67
|
+
if m.get('ipAddress') is not None:
|
|
68
|
+
self.ip_address = m.get('ipAddress')
|
|
69
|
+
return self
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Request entity for DeleteSnicRequest information.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from baiducloud_python_sdk_core.abstract_model import AbstractModel
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class DeleteSnicRequest(AbstractModel):
|
|
9
|
+
"""
|
|
10
|
+
Request entity for DeleteSnicRequest operation.
|
|
11
|
+
|
|
12
|
+
This class encapsulates all parameters for the API request.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
def __init__(self, endpoint_id, client_token=None):
|
|
16
|
+
"""
|
|
17
|
+
Initialize DeleteSnicRequest request entity.
|
|
18
|
+
|
|
19
|
+
:param endpoint_id: endpoint_id parameter
|
|
20
|
+
:type endpoint_id: str (required)
|
|
21
|
+
|
|
22
|
+
:param client_token: client_token parameter
|
|
23
|
+
:type client_token: str (optional)
|
|
24
|
+
"""
|
|
25
|
+
super().__init__()
|
|
26
|
+
self.endpoint_id = endpoint_id
|
|
27
|
+
self.client_token = client_token
|
|
28
|
+
|
|
29
|
+
def to_dict(self):
|
|
30
|
+
"""
|
|
31
|
+
Convert the request entity to a dictionary representation.
|
|
32
|
+
|
|
33
|
+
Nested model objects are recursively converted to dictionaries.
|
|
34
|
+
|
|
35
|
+
:return: Dictionary representation of the request
|
|
36
|
+
:rtype: dict
|
|
37
|
+
"""
|
|
38
|
+
_map = super().to_dict()
|
|
39
|
+
if _map is not None:
|
|
40
|
+
return _map
|
|
41
|
+
result = dict()
|
|
42
|
+
return result
|
|
43
|
+
|
|
44
|
+
def from_dict(self, m):
|
|
45
|
+
"""
|
|
46
|
+
Populate the request entity from a dictionary.
|
|
47
|
+
|
|
48
|
+
Nested dictionaries are recursively converted to model objects.
|
|
49
|
+
|
|
50
|
+
:param m: Dictionary containing request data
|
|
51
|
+
:type m: dict
|
|
52
|
+
|
|
53
|
+
:return: Self reference for method chaining
|
|
54
|
+
:rtype: DeleteSnicRequest
|
|
55
|
+
|
|
56
|
+
:raises TypeError: If input is not a dictionary or field type mismatch
|
|
57
|
+
:raises ValueError: If nested model conversion fails
|
|
58
|
+
"""
|
|
59
|
+
m = m or dict()
|
|
60
|
+
if m.get('endpointId') is not None:
|
|
61
|
+
self.endpoint_id = m.get('endpointId')
|
|
62
|
+
if m.get('clientToken') is not None:
|
|
63
|
+
self.client_token = m.get('clientToken')
|
|
64
|
+
return self
|