stackit-runcommand 0.0.1a0__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.
@@ -0,0 +1,1345 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ STACKIT Run Commands Service API
5
+
6
+ API endpoints for the STACKIT Run Commands Service API
7
+
8
+ The version of the OpenAPI document: 1.0
9
+ Contact: support@stackit.de
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501 docstring might be too long
14
+
15
+ from typing import Any, Dict, List, Optional, Tuple, Union
16
+
17
+ from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call
18
+ from stackit.core.configuration import Configuration
19
+ from typing_extensions import Annotated
20
+
21
+ from stackit.runcommand.api_client import ApiClient, RequestSerialized
22
+ from stackit.runcommand.api_response import ApiResponse
23
+ from stackit.runcommand.models.command_details import CommandDetails
24
+ from stackit.runcommand.models.command_template_response import CommandTemplateResponse
25
+ from stackit.runcommand.models.command_template_schema import CommandTemplateSchema
26
+ from stackit.runcommand.models.create_command_payload import CreateCommandPayload
27
+ from stackit.runcommand.models.get_commands_response import GetCommandsResponse
28
+ from stackit.runcommand.models.new_command_response import NewCommandResponse
29
+ from stackit.runcommand.rest import RESTResponseType
30
+
31
+
32
+ class DefaultApi:
33
+ """NOTE: This class is auto generated by OpenAPI Generator
34
+ Ref: https://openapi-generator.tech
35
+
36
+ Do not edit the class manually.
37
+ """
38
+
39
+ def __init__(self, configuration: Configuration = None) -> None:
40
+ if configuration is None:
41
+ configuration = Configuration()
42
+ self.configuration = configuration
43
+ self.api_client = ApiClient(self.configuration)
44
+
45
+ @validate_call
46
+ def create_command(
47
+ self,
48
+ project_id: Annotated[StrictStr, Field(description="ID of the project")],
49
+ server_id: Annotated[StrictStr, Field(description="Server ID of the machine")],
50
+ create_command_payload: Annotated[Optional[CreateCommandPayload], Field(description="Command to post")] = None,
51
+ _request_timeout: Union[
52
+ None,
53
+ Annotated[StrictFloat, Field(gt=0)],
54
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
55
+ ] = None,
56
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
57
+ _content_type: Optional[StrictStr] = None,
58
+ _headers: Optional[Dict[StrictStr, Any]] = None,
59
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
60
+ ) -> NewCommandResponse:
61
+ """create_command
62
+
63
+ Creates a new command for execution
64
+
65
+ :param project_id: ID of the project (required)
66
+ :type project_id: str
67
+ :param server_id: Server ID of the machine (required)
68
+ :type server_id: str
69
+ :param create_command_payload: Command to post
70
+ :type create_command_payload: CreateCommandPayload
71
+ :param _request_timeout: timeout setting for this request. If one
72
+ number provided, it will be total request
73
+ timeout. It can also be a pair (tuple) of
74
+ (connection, read) timeouts.
75
+ :type _request_timeout: int, tuple(int, int), optional
76
+ :param _request_auth: set to override the auth_settings for an a single
77
+ request; this effectively ignores the
78
+ authentication in the spec for a single request.
79
+ :type _request_auth: dict, optional
80
+ :param _content_type: force content-type for the request.
81
+ :type _content_type: str, Optional
82
+ :param _headers: set to override the headers for a single
83
+ request; this effectively ignores the headers
84
+ in the spec for a single request.
85
+ :type _headers: dict, optional
86
+ :param _host_index: set to override the host_index for a single
87
+ request; this effectively ignores the host_index
88
+ in the spec for a single request.
89
+ :type _host_index: int, optional
90
+ :return: Returns the result object.
91
+ """ # noqa: E501 docstring might be too long
92
+
93
+ _param = self._create_command_serialize(
94
+ project_id=project_id,
95
+ server_id=server_id,
96
+ create_command_payload=create_command_payload,
97
+ _request_auth=_request_auth,
98
+ _content_type=_content_type,
99
+ _headers=_headers,
100
+ _host_index=_host_index,
101
+ )
102
+
103
+ _response_types_map: Dict[str, Optional[str]] = {
104
+ "200": "NewCommandResponse",
105
+ "400": "ErrorResponse",
106
+ "401": "ErrorResponse",
107
+ "404": "ErrorResponse",
108
+ }
109
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
110
+ response_data.read()
111
+ return self.api_client.response_deserialize(
112
+ response_data=response_data,
113
+ response_types_map=_response_types_map,
114
+ ).data
115
+
116
+ @validate_call
117
+ def create_command_with_http_info(
118
+ self,
119
+ project_id: Annotated[StrictStr, Field(description="ID of the project")],
120
+ server_id: Annotated[StrictStr, Field(description="Server ID of the machine")],
121
+ create_command_payload: Annotated[Optional[CreateCommandPayload], Field(description="Command to post")] = None,
122
+ _request_timeout: Union[
123
+ None,
124
+ Annotated[StrictFloat, Field(gt=0)],
125
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
126
+ ] = None,
127
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
128
+ _content_type: Optional[StrictStr] = None,
129
+ _headers: Optional[Dict[StrictStr, Any]] = None,
130
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
131
+ ) -> ApiResponse[NewCommandResponse]:
132
+ """create_command
133
+
134
+ Creates a new command for execution
135
+
136
+ :param project_id: ID of the project (required)
137
+ :type project_id: str
138
+ :param server_id: Server ID of the machine (required)
139
+ :type server_id: str
140
+ :param create_command_payload: Command to post
141
+ :type create_command_payload: CreateCommandPayload
142
+ :param _request_timeout: timeout setting for this request. If one
143
+ number provided, it will be total request
144
+ timeout. It can also be a pair (tuple) of
145
+ (connection, read) timeouts.
146
+ :type _request_timeout: int, tuple(int, int), optional
147
+ :param _request_auth: set to override the auth_settings for an a single
148
+ request; this effectively ignores the
149
+ authentication in the spec for a single request.
150
+ :type _request_auth: dict, optional
151
+ :param _content_type: force content-type for the request.
152
+ :type _content_type: str, Optional
153
+ :param _headers: set to override the headers for a single
154
+ request; this effectively ignores the headers
155
+ in the spec for a single request.
156
+ :type _headers: dict, optional
157
+ :param _host_index: set to override the host_index for a single
158
+ request; this effectively ignores the host_index
159
+ in the spec for a single request.
160
+ :type _host_index: int, optional
161
+ :return: Returns the result object.
162
+ """ # noqa: E501 docstring might be too long
163
+
164
+ _param = self._create_command_serialize(
165
+ project_id=project_id,
166
+ server_id=server_id,
167
+ create_command_payload=create_command_payload,
168
+ _request_auth=_request_auth,
169
+ _content_type=_content_type,
170
+ _headers=_headers,
171
+ _host_index=_host_index,
172
+ )
173
+
174
+ _response_types_map: Dict[str, Optional[str]] = {
175
+ "200": "NewCommandResponse",
176
+ "400": "ErrorResponse",
177
+ "401": "ErrorResponse",
178
+ "404": "ErrorResponse",
179
+ }
180
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
181
+ response_data.read()
182
+ return self.api_client.response_deserialize(
183
+ response_data=response_data,
184
+ response_types_map=_response_types_map,
185
+ )
186
+
187
+ @validate_call
188
+ def create_command_without_preload_content(
189
+ self,
190
+ project_id: Annotated[StrictStr, Field(description="ID of the project")],
191
+ server_id: Annotated[StrictStr, Field(description="Server ID of the machine")],
192
+ create_command_payload: Annotated[Optional[CreateCommandPayload], Field(description="Command to post")] = None,
193
+ _request_timeout: Union[
194
+ None,
195
+ Annotated[StrictFloat, Field(gt=0)],
196
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
197
+ ] = None,
198
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
199
+ _content_type: Optional[StrictStr] = None,
200
+ _headers: Optional[Dict[StrictStr, Any]] = None,
201
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
202
+ ) -> RESTResponseType:
203
+ """create_command
204
+
205
+ Creates a new command for execution
206
+
207
+ :param project_id: ID of the project (required)
208
+ :type project_id: str
209
+ :param server_id: Server ID of the machine (required)
210
+ :type server_id: str
211
+ :param create_command_payload: Command to post
212
+ :type create_command_payload: CreateCommandPayload
213
+ :param _request_timeout: timeout setting for this request. If one
214
+ number provided, it will be total request
215
+ timeout. It can also be a pair (tuple) of
216
+ (connection, read) timeouts.
217
+ :type _request_timeout: int, tuple(int, int), optional
218
+ :param _request_auth: set to override the auth_settings for an a single
219
+ request; this effectively ignores the
220
+ authentication in the spec for a single request.
221
+ :type _request_auth: dict, optional
222
+ :param _content_type: force content-type for the request.
223
+ :type _content_type: str, Optional
224
+ :param _headers: set to override the headers for a single
225
+ request; this effectively ignores the headers
226
+ in the spec for a single request.
227
+ :type _headers: dict, optional
228
+ :param _host_index: set to override the host_index for a single
229
+ request; this effectively ignores the host_index
230
+ in the spec for a single request.
231
+ :type _host_index: int, optional
232
+ :return: Returns the result object.
233
+ """ # noqa: E501 docstring might be too long
234
+
235
+ _param = self._create_command_serialize(
236
+ project_id=project_id,
237
+ server_id=server_id,
238
+ create_command_payload=create_command_payload,
239
+ _request_auth=_request_auth,
240
+ _content_type=_content_type,
241
+ _headers=_headers,
242
+ _host_index=_host_index,
243
+ )
244
+
245
+ _response_types_map: Dict[str, Optional[str]] = {
246
+ "200": "NewCommandResponse",
247
+ "400": "ErrorResponse",
248
+ "401": "ErrorResponse",
249
+ "404": "ErrorResponse",
250
+ }
251
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
252
+ return response_data.response
253
+
254
+ def _create_command_serialize(
255
+ self,
256
+ project_id,
257
+ server_id,
258
+ create_command_payload,
259
+ _request_auth,
260
+ _content_type,
261
+ _headers,
262
+ _host_index,
263
+ ) -> RequestSerialized:
264
+
265
+ _host = None
266
+
267
+ _collection_formats: Dict[str, str] = {}
268
+
269
+ _path_params: Dict[str, str] = {}
270
+ _query_params: List[Tuple[str, str]] = []
271
+ _header_params: Dict[str, Optional[str]] = _headers or {}
272
+ _form_params: List[Tuple[str, str]] = []
273
+ _files: Dict[str, Union[str, bytes]] = {}
274
+ _body_params: Optional[bytes] = None
275
+
276
+ # process the path parameters
277
+ if project_id is not None:
278
+ _path_params["projectId"] = project_id
279
+ if server_id is not None:
280
+ _path_params["serverId"] = server_id
281
+ # process the query parameters
282
+ # process the header parameters
283
+ # process the form parameters
284
+ # process the body parameter
285
+ if create_command_payload is not None:
286
+ _body_params = create_command_payload
287
+
288
+ # set the HTTP header `Accept`
289
+ if "Accept" not in _header_params:
290
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
291
+
292
+ # set the HTTP header `Content-Type`
293
+ if _content_type:
294
+ _header_params["Content-Type"] = _content_type
295
+ else:
296
+ _default_content_type = self.api_client.select_header_content_type(["application/json"])
297
+ if _default_content_type is not None:
298
+ _header_params["Content-Type"] = _default_content_type
299
+
300
+ # authentication setting
301
+ _auth_settings: List[str] = []
302
+
303
+ return self.api_client.param_serialize(
304
+ method="POST",
305
+ resource_path="/v1/projects/{projectId}/servers/{serverId}/commands",
306
+ path_params=_path_params,
307
+ query_params=_query_params,
308
+ header_params=_header_params,
309
+ body=_body_params,
310
+ post_params=_form_params,
311
+ files=_files,
312
+ auth_settings=_auth_settings,
313
+ collection_formats=_collection_formats,
314
+ _host=_host,
315
+ _request_auth=_request_auth,
316
+ )
317
+
318
+ @validate_call
319
+ def get_command(
320
+ self,
321
+ project_id: Annotated[StrictStr, Field(description="ID of the project")],
322
+ server_id: Annotated[StrictStr, Field(description="Server ID of the machine")],
323
+ command_id: Annotated[StrictStr, Field(description="ID of the command")],
324
+ _request_timeout: Union[
325
+ None,
326
+ Annotated[StrictFloat, Field(gt=0)],
327
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
328
+ ] = None,
329
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
330
+ _content_type: Optional[StrictStr] = None,
331
+ _headers: Optional[Dict[StrictStr, Any]] = None,
332
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
333
+ ) -> CommandDetails:
334
+ """get_command
335
+
336
+ Returns details about a command
337
+
338
+ :param project_id: ID of the project (required)
339
+ :type project_id: str
340
+ :param server_id: Server ID of the machine (required)
341
+ :type server_id: str
342
+ :param command_id: ID of the command (required)
343
+ :type command_id: str
344
+ :param _request_timeout: timeout setting for this request. If one
345
+ number provided, it will be total request
346
+ timeout. It can also be a pair (tuple) of
347
+ (connection, read) timeouts.
348
+ :type _request_timeout: int, tuple(int, int), optional
349
+ :param _request_auth: set to override the auth_settings for an a single
350
+ request; this effectively ignores the
351
+ authentication in the spec for a single request.
352
+ :type _request_auth: dict, optional
353
+ :param _content_type: force content-type for the request.
354
+ :type _content_type: str, Optional
355
+ :param _headers: set to override the headers for a single
356
+ request; this effectively ignores the headers
357
+ in the spec for a single request.
358
+ :type _headers: dict, optional
359
+ :param _host_index: set to override the host_index for a single
360
+ request; this effectively ignores the host_index
361
+ in the spec for a single request.
362
+ :type _host_index: int, optional
363
+ :return: Returns the result object.
364
+ """ # noqa: E501 docstring might be too long
365
+
366
+ _param = self._get_command_serialize(
367
+ project_id=project_id,
368
+ server_id=server_id,
369
+ command_id=command_id,
370
+ _request_auth=_request_auth,
371
+ _content_type=_content_type,
372
+ _headers=_headers,
373
+ _host_index=_host_index,
374
+ )
375
+
376
+ _response_types_map: Dict[str, Optional[str]] = {
377
+ "200": "CommandDetails",
378
+ "400": "ErrorResponse",
379
+ "401": "ErrorResponse",
380
+ "404": "ErrorResponse",
381
+ }
382
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
383
+ response_data.read()
384
+ return self.api_client.response_deserialize(
385
+ response_data=response_data,
386
+ response_types_map=_response_types_map,
387
+ ).data
388
+
389
+ @validate_call
390
+ def get_command_with_http_info(
391
+ self,
392
+ project_id: Annotated[StrictStr, Field(description="ID of the project")],
393
+ server_id: Annotated[StrictStr, Field(description="Server ID of the machine")],
394
+ command_id: Annotated[StrictStr, Field(description="ID of the command")],
395
+ _request_timeout: Union[
396
+ None,
397
+ Annotated[StrictFloat, Field(gt=0)],
398
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
399
+ ] = None,
400
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
401
+ _content_type: Optional[StrictStr] = None,
402
+ _headers: Optional[Dict[StrictStr, Any]] = None,
403
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
404
+ ) -> ApiResponse[CommandDetails]:
405
+ """get_command
406
+
407
+ Returns details about a command
408
+
409
+ :param project_id: ID of the project (required)
410
+ :type project_id: str
411
+ :param server_id: Server ID of the machine (required)
412
+ :type server_id: str
413
+ :param command_id: ID of the command (required)
414
+ :type command_id: str
415
+ :param _request_timeout: timeout setting for this request. If one
416
+ number provided, it will be total request
417
+ timeout. It can also be a pair (tuple) of
418
+ (connection, read) timeouts.
419
+ :type _request_timeout: int, tuple(int, int), optional
420
+ :param _request_auth: set to override the auth_settings for an a single
421
+ request; this effectively ignores the
422
+ authentication in the spec for a single request.
423
+ :type _request_auth: dict, optional
424
+ :param _content_type: force content-type for the request.
425
+ :type _content_type: str, Optional
426
+ :param _headers: set to override the headers for a single
427
+ request; this effectively ignores the headers
428
+ in the spec for a single request.
429
+ :type _headers: dict, optional
430
+ :param _host_index: set to override the host_index for a single
431
+ request; this effectively ignores the host_index
432
+ in the spec for a single request.
433
+ :type _host_index: int, optional
434
+ :return: Returns the result object.
435
+ """ # noqa: E501 docstring might be too long
436
+
437
+ _param = self._get_command_serialize(
438
+ project_id=project_id,
439
+ server_id=server_id,
440
+ command_id=command_id,
441
+ _request_auth=_request_auth,
442
+ _content_type=_content_type,
443
+ _headers=_headers,
444
+ _host_index=_host_index,
445
+ )
446
+
447
+ _response_types_map: Dict[str, Optional[str]] = {
448
+ "200": "CommandDetails",
449
+ "400": "ErrorResponse",
450
+ "401": "ErrorResponse",
451
+ "404": "ErrorResponse",
452
+ }
453
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
454
+ response_data.read()
455
+ return self.api_client.response_deserialize(
456
+ response_data=response_data,
457
+ response_types_map=_response_types_map,
458
+ )
459
+
460
+ @validate_call
461
+ def get_command_without_preload_content(
462
+ self,
463
+ project_id: Annotated[StrictStr, Field(description="ID of the project")],
464
+ server_id: Annotated[StrictStr, Field(description="Server ID of the machine")],
465
+ command_id: Annotated[StrictStr, Field(description="ID of the command")],
466
+ _request_timeout: Union[
467
+ None,
468
+ Annotated[StrictFloat, Field(gt=0)],
469
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
470
+ ] = None,
471
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
472
+ _content_type: Optional[StrictStr] = None,
473
+ _headers: Optional[Dict[StrictStr, Any]] = None,
474
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
475
+ ) -> RESTResponseType:
476
+ """get_command
477
+
478
+ Returns details about a command
479
+
480
+ :param project_id: ID of the project (required)
481
+ :type project_id: str
482
+ :param server_id: Server ID of the machine (required)
483
+ :type server_id: str
484
+ :param command_id: ID of the command (required)
485
+ :type command_id: str
486
+ :param _request_timeout: timeout setting for this request. If one
487
+ number provided, it will be total request
488
+ timeout. It can also be a pair (tuple) of
489
+ (connection, read) timeouts.
490
+ :type _request_timeout: int, tuple(int, int), optional
491
+ :param _request_auth: set to override the auth_settings for an a single
492
+ request; this effectively ignores the
493
+ authentication in the spec for a single request.
494
+ :type _request_auth: dict, optional
495
+ :param _content_type: force content-type for the request.
496
+ :type _content_type: str, Optional
497
+ :param _headers: set to override the headers for a single
498
+ request; this effectively ignores the headers
499
+ in the spec for a single request.
500
+ :type _headers: dict, optional
501
+ :param _host_index: set to override the host_index for a single
502
+ request; this effectively ignores the host_index
503
+ in the spec for a single request.
504
+ :type _host_index: int, optional
505
+ :return: Returns the result object.
506
+ """ # noqa: E501 docstring might be too long
507
+
508
+ _param = self._get_command_serialize(
509
+ project_id=project_id,
510
+ server_id=server_id,
511
+ command_id=command_id,
512
+ _request_auth=_request_auth,
513
+ _content_type=_content_type,
514
+ _headers=_headers,
515
+ _host_index=_host_index,
516
+ )
517
+
518
+ _response_types_map: Dict[str, Optional[str]] = {
519
+ "200": "CommandDetails",
520
+ "400": "ErrorResponse",
521
+ "401": "ErrorResponse",
522
+ "404": "ErrorResponse",
523
+ }
524
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
525
+ return response_data.response
526
+
527
+ def _get_command_serialize(
528
+ self,
529
+ project_id,
530
+ server_id,
531
+ command_id,
532
+ _request_auth,
533
+ _content_type,
534
+ _headers,
535
+ _host_index,
536
+ ) -> RequestSerialized:
537
+
538
+ _host = None
539
+
540
+ _collection_formats: Dict[str, str] = {}
541
+
542
+ _path_params: Dict[str, str] = {}
543
+ _query_params: List[Tuple[str, str]] = []
544
+ _header_params: Dict[str, Optional[str]] = _headers or {}
545
+ _form_params: List[Tuple[str, str]] = []
546
+ _files: Dict[str, Union[str, bytes]] = {}
547
+ _body_params: Optional[bytes] = None
548
+
549
+ # process the path parameters
550
+ if project_id is not None:
551
+ _path_params["projectId"] = project_id
552
+ if server_id is not None:
553
+ _path_params["serverId"] = server_id
554
+ if command_id is not None:
555
+ _path_params["commandId"] = command_id
556
+ # process the query parameters
557
+ # process the header parameters
558
+ # process the form parameters
559
+ # process the body parameter
560
+
561
+ # set the HTTP header `Accept`
562
+ if "Accept" not in _header_params:
563
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
564
+
565
+ # authentication setting
566
+ _auth_settings: List[str] = []
567
+
568
+ return self.api_client.param_serialize(
569
+ method="GET",
570
+ resource_path="/v1/projects/{projectId}/servers/{serverId}/commands/{commandId}",
571
+ path_params=_path_params,
572
+ query_params=_query_params,
573
+ header_params=_header_params,
574
+ body=_body_params,
575
+ post_params=_form_params,
576
+ files=_files,
577
+ auth_settings=_auth_settings,
578
+ collection_formats=_collection_formats,
579
+ _host=_host,
580
+ _request_auth=_request_auth,
581
+ )
582
+
583
+ @validate_call
584
+ def get_command_template(
585
+ self,
586
+ project_id: Annotated[StrictStr, Field(description="ID of the project")],
587
+ server_id: Annotated[StrictStr, Field(description="Server ID of the machine")],
588
+ command_template_name: Annotated[StrictStr, Field(description="Name of the template")],
589
+ _request_timeout: Union[
590
+ None,
591
+ Annotated[StrictFloat, Field(gt=0)],
592
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
593
+ ] = None,
594
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
595
+ _content_type: Optional[StrictStr] = None,
596
+ _headers: Optional[Dict[StrictStr, Any]] = None,
597
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
598
+ ) -> CommandTemplateSchema:
599
+ """get_command_template
600
+
601
+ Returns details about a command template
602
+
603
+ :param project_id: ID of the project (required)
604
+ :type project_id: str
605
+ :param server_id: Server ID of the machine (required)
606
+ :type server_id: str
607
+ :param command_template_name: Name of the template (required)
608
+ :type command_template_name: str
609
+ :param _request_timeout: timeout setting for this request. If one
610
+ number provided, it will be total request
611
+ timeout. It can also be a pair (tuple) of
612
+ (connection, read) timeouts.
613
+ :type _request_timeout: int, tuple(int, int), optional
614
+ :param _request_auth: set to override the auth_settings for an a single
615
+ request; this effectively ignores the
616
+ authentication in the spec for a single request.
617
+ :type _request_auth: dict, optional
618
+ :param _content_type: force content-type for the request.
619
+ :type _content_type: str, Optional
620
+ :param _headers: set to override the headers for a single
621
+ request; this effectively ignores the headers
622
+ in the spec for a single request.
623
+ :type _headers: dict, optional
624
+ :param _host_index: set to override the host_index for a single
625
+ request; this effectively ignores the host_index
626
+ in the spec for a single request.
627
+ :type _host_index: int, optional
628
+ :return: Returns the result object.
629
+ """ # noqa: E501 docstring might be too long
630
+
631
+ _param = self._get_command_template_serialize(
632
+ project_id=project_id,
633
+ server_id=server_id,
634
+ command_template_name=command_template_name,
635
+ _request_auth=_request_auth,
636
+ _content_type=_content_type,
637
+ _headers=_headers,
638
+ _host_index=_host_index,
639
+ )
640
+
641
+ _response_types_map: Dict[str, Optional[str]] = {
642
+ "200": "CommandTemplateSchema",
643
+ "400": "ErrorResponse",
644
+ "401": "ErrorResponse",
645
+ "404": "ErrorResponse",
646
+ }
647
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
648
+ response_data.read()
649
+ return self.api_client.response_deserialize(
650
+ response_data=response_data,
651
+ response_types_map=_response_types_map,
652
+ ).data
653
+
654
+ @validate_call
655
+ def get_command_template_with_http_info(
656
+ self,
657
+ project_id: Annotated[StrictStr, Field(description="ID of the project")],
658
+ server_id: Annotated[StrictStr, Field(description="Server ID of the machine")],
659
+ command_template_name: Annotated[StrictStr, Field(description="Name of the template")],
660
+ _request_timeout: Union[
661
+ None,
662
+ Annotated[StrictFloat, Field(gt=0)],
663
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
664
+ ] = None,
665
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
666
+ _content_type: Optional[StrictStr] = None,
667
+ _headers: Optional[Dict[StrictStr, Any]] = None,
668
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
669
+ ) -> ApiResponse[CommandTemplateSchema]:
670
+ """get_command_template
671
+
672
+ Returns details about a command template
673
+
674
+ :param project_id: ID of the project (required)
675
+ :type project_id: str
676
+ :param server_id: Server ID of the machine (required)
677
+ :type server_id: str
678
+ :param command_template_name: Name of the template (required)
679
+ :type command_template_name: str
680
+ :param _request_timeout: timeout setting for this request. If one
681
+ number provided, it will be total request
682
+ timeout. It can also be a pair (tuple) of
683
+ (connection, read) timeouts.
684
+ :type _request_timeout: int, tuple(int, int), optional
685
+ :param _request_auth: set to override the auth_settings for an a single
686
+ request; this effectively ignores the
687
+ authentication in the spec for a single request.
688
+ :type _request_auth: dict, optional
689
+ :param _content_type: force content-type for the request.
690
+ :type _content_type: str, Optional
691
+ :param _headers: set to override the headers for a single
692
+ request; this effectively ignores the headers
693
+ in the spec for a single request.
694
+ :type _headers: dict, optional
695
+ :param _host_index: set to override the host_index for a single
696
+ request; this effectively ignores the host_index
697
+ in the spec for a single request.
698
+ :type _host_index: int, optional
699
+ :return: Returns the result object.
700
+ """ # noqa: E501 docstring might be too long
701
+
702
+ _param = self._get_command_template_serialize(
703
+ project_id=project_id,
704
+ server_id=server_id,
705
+ command_template_name=command_template_name,
706
+ _request_auth=_request_auth,
707
+ _content_type=_content_type,
708
+ _headers=_headers,
709
+ _host_index=_host_index,
710
+ )
711
+
712
+ _response_types_map: Dict[str, Optional[str]] = {
713
+ "200": "CommandTemplateSchema",
714
+ "400": "ErrorResponse",
715
+ "401": "ErrorResponse",
716
+ "404": "ErrorResponse",
717
+ }
718
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
719
+ response_data.read()
720
+ return self.api_client.response_deserialize(
721
+ response_data=response_data,
722
+ response_types_map=_response_types_map,
723
+ )
724
+
725
+ @validate_call
726
+ def get_command_template_without_preload_content(
727
+ self,
728
+ project_id: Annotated[StrictStr, Field(description="ID of the project")],
729
+ server_id: Annotated[StrictStr, Field(description="Server ID of the machine")],
730
+ command_template_name: Annotated[StrictStr, Field(description="Name of the template")],
731
+ _request_timeout: Union[
732
+ None,
733
+ Annotated[StrictFloat, Field(gt=0)],
734
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
735
+ ] = None,
736
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
737
+ _content_type: Optional[StrictStr] = None,
738
+ _headers: Optional[Dict[StrictStr, Any]] = None,
739
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
740
+ ) -> RESTResponseType:
741
+ """get_command_template
742
+
743
+ Returns details about a command template
744
+
745
+ :param project_id: ID of the project (required)
746
+ :type project_id: str
747
+ :param server_id: Server ID of the machine (required)
748
+ :type server_id: str
749
+ :param command_template_name: Name of the template (required)
750
+ :type command_template_name: str
751
+ :param _request_timeout: timeout setting for this request. If one
752
+ number provided, it will be total request
753
+ timeout. It can also be a pair (tuple) of
754
+ (connection, read) timeouts.
755
+ :type _request_timeout: int, tuple(int, int), optional
756
+ :param _request_auth: set to override the auth_settings for an a single
757
+ request; this effectively ignores the
758
+ authentication in the spec for a single request.
759
+ :type _request_auth: dict, optional
760
+ :param _content_type: force content-type for the request.
761
+ :type _content_type: str, Optional
762
+ :param _headers: set to override the headers for a single
763
+ request; this effectively ignores the headers
764
+ in the spec for a single request.
765
+ :type _headers: dict, optional
766
+ :param _host_index: set to override the host_index for a single
767
+ request; this effectively ignores the host_index
768
+ in the spec for a single request.
769
+ :type _host_index: int, optional
770
+ :return: Returns the result object.
771
+ """ # noqa: E501 docstring might be too long
772
+
773
+ _param = self._get_command_template_serialize(
774
+ project_id=project_id,
775
+ server_id=server_id,
776
+ command_template_name=command_template_name,
777
+ _request_auth=_request_auth,
778
+ _content_type=_content_type,
779
+ _headers=_headers,
780
+ _host_index=_host_index,
781
+ )
782
+
783
+ _response_types_map: Dict[str, Optional[str]] = {
784
+ "200": "CommandTemplateSchema",
785
+ "400": "ErrorResponse",
786
+ "401": "ErrorResponse",
787
+ "404": "ErrorResponse",
788
+ }
789
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
790
+ return response_data.response
791
+
792
+ def _get_command_template_serialize(
793
+ self,
794
+ project_id,
795
+ server_id,
796
+ command_template_name,
797
+ _request_auth,
798
+ _content_type,
799
+ _headers,
800
+ _host_index,
801
+ ) -> RequestSerialized:
802
+
803
+ _host = None
804
+
805
+ _collection_formats: Dict[str, str] = {}
806
+
807
+ _path_params: Dict[str, str] = {}
808
+ _query_params: List[Tuple[str, str]] = []
809
+ _header_params: Dict[str, Optional[str]] = _headers or {}
810
+ _form_params: List[Tuple[str, str]] = []
811
+ _files: Dict[str, Union[str, bytes]] = {}
812
+ _body_params: Optional[bytes] = None
813
+
814
+ # process the path parameters
815
+ if project_id is not None:
816
+ _path_params["projectId"] = project_id
817
+ if server_id is not None:
818
+ _path_params["serverId"] = server_id
819
+ if command_template_name is not None:
820
+ _path_params["commandTemplateName"] = command_template_name
821
+ # process the query parameters
822
+ # process the header parameters
823
+ # process the form parameters
824
+ # process the body parameter
825
+
826
+ # set the HTTP header `Accept`
827
+ if "Accept" not in _header_params:
828
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
829
+
830
+ # authentication setting
831
+ _auth_settings: List[str] = []
832
+
833
+ return self.api_client.param_serialize(
834
+ method="GET",
835
+ resource_path="/v1/projects/{projectId}/servers/{serverId}/command-templates/{commandTemplateName}",
836
+ path_params=_path_params,
837
+ query_params=_query_params,
838
+ header_params=_header_params,
839
+ body=_body_params,
840
+ post_params=_form_params,
841
+ files=_files,
842
+ auth_settings=_auth_settings,
843
+ collection_formats=_collection_formats,
844
+ _host=_host,
845
+ _request_auth=_request_auth,
846
+ )
847
+
848
+ @validate_call
849
+ def list_command_templates(
850
+ self,
851
+ os_type: Annotated[
852
+ Optional[StrictStr],
853
+ Field(
854
+ description="The type of the Operating System (windows or linux). If not provided will return data for all OS types."
855
+ ),
856
+ ] = None,
857
+ _request_timeout: Union[
858
+ None,
859
+ Annotated[StrictFloat, Field(gt=0)],
860
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
861
+ ] = None,
862
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
863
+ _content_type: Optional[StrictStr] = None,
864
+ _headers: Optional[Dict[StrictStr, Any]] = None,
865
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
866
+ ) -> CommandTemplateResponse:
867
+ """list_command_templates
868
+
869
+ Returns a list of command templates
870
+
871
+ :param os_type: The type of the Operating System (windows or linux). If not provided will return data for all OS types.
872
+ :type os_type: str
873
+ :param _request_timeout: timeout setting for this request. If one
874
+ number provided, it will be total request
875
+ timeout. It can also be a pair (tuple) of
876
+ (connection, read) timeouts.
877
+ :type _request_timeout: int, tuple(int, int), optional
878
+ :param _request_auth: set to override the auth_settings for an a single
879
+ request; this effectively ignores the
880
+ authentication in the spec for a single request.
881
+ :type _request_auth: dict, optional
882
+ :param _content_type: force content-type for the request.
883
+ :type _content_type: str, Optional
884
+ :param _headers: set to override the headers for a single
885
+ request; this effectively ignores the headers
886
+ in the spec for a single request.
887
+ :type _headers: dict, optional
888
+ :param _host_index: set to override the host_index for a single
889
+ request; this effectively ignores the host_index
890
+ in the spec for a single request.
891
+ :type _host_index: int, optional
892
+ :return: Returns the result object.
893
+ """ # noqa: E501 docstring might be too long
894
+
895
+ _param = self._list_command_templates_serialize(
896
+ os_type=os_type,
897
+ _request_auth=_request_auth,
898
+ _content_type=_content_type,
899
+ _headers=_headers,
900
+ _host_index=_host_index,
901
+ )
902
+
903
+ _response_types_map: Dict[str, Optional[str]] = {
904
+ "200": "CommandTemplateResponse",
905
+ "400": "ErrorResponse",
906
+ "401": "ErrorResponse",
907
+ }
908
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
909
+ response_data.read()
910
+ return self.api_client.response_deserialize(
911
+ response_data=response_data,
912
+ response_types_map=_response_types_map,
913
+ ).data
914
+
915
+ @validate_call
916
+ def list_command_templates_with_http_info(
917
+ self,
918
+ os_type: Annotated[
919
+ Optional[StrictStr],
920
+ Field(
921
+ description="The type of the Operating System (windows or linux). If not provided will return data for all OS types."
922
+ ),
923
+ ] = None,
924
+ _request_timeout: Union[
925
+ None,
926
+ Annotated[StrictFloat, Field(gt=0)],
927
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
928
+ ] = None,
929
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
930
+ _content_type: Optional[StrictStr] = None,
931
+ _headers: Optional[Dict[StrictStr, Any]] = None,
932
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
933
+ ) -> ApiResponse[CommandTemplateResponse]:
934
+ """list_command_templates
935
+
936
+ Returns a list of command templates
937
+
938
+ :param os_type: The type of the Operating System (windows or linux). If not provided will return data for all OS types.
939
+ :type os_type: str
940
+ :param _request_timeout: timeout setting for this request. If one
941
+ number provided, it will be total request
942
+ timeout. It can also be a pair (tuple) of
943
+ (connection, read) timeouts.
944
+ :type _request_timeout: int, tuple(int, int), optional
945
+ :param _request_auth: set to override the auth_settings for an a single
946
+ request; this effectively ignores the
947
+ authentication in the spec for a single request.
948
+ :type _request_auth: dict, optional
949
+ :param _content_type: force content-type for the request.
950
+ :type _content_type: str, Optional
951
+ :param _headers: set to override the headers for a single
952
+ request; this effectively ignores the headers
953
+ in the spec for a single request.
954
+ :type _headers: dict, optional
955
+ :param _host_index: set to override the host_index for a single
956
+ request; this effectively ignores the host_index
957
+ in the spec for a single request.
958
+ :type _host_index: int, optional
959
+ :return: Returns the result object.
960
+ """ # noqa: E501 docstring might be too long
961
+
962
+ _param = self._list_command_templates_serialize(
963
+ os_type=os_type,
964
+ _request_auth=_request_auth,
965
+ _content_type=_content_type,
966
+ _headers=_headers,
967
+ _host_index=_host_index,
968
+ )
969
+
970
+ _response_types_map: Dict[str, Optional[str]] = {
971
+ "200": "CommandTemplateResponse",
972
+ "400": "ErrorResponse",
973
+ "401": "ErrorResponse",
974
+ }
975
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
976
+ response_data.read()
977
+ return self.api_client.response_deserialize(
978
+ response_data=response_data,
979
+ response_types_map=_response_types_map,
980
+ )
981
+
982
+ @validate_call
983
+ def list_command_templates_without_preload_content(
984
+ self,
985
+ os_type: Annotated[
986
+ Optional[StrictStr],
987
+ Field(
988
+ description="The type of the Operating System (windows or linux). If not provided will return data for all OS types."
989
+ ),
990
+ ] = None,
991
+ _request_timeout: Union[
992
+ None,
993
+ Annotated[StrictFloat, Field(gt=0)],
994
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
995
+ ] = None,
996
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
997
+ _content_type: Optional[StrictStr] = None,
998
+ _headers: Optional[Dict[StrictStr, Any]] = None,
999
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1000
+ ) -> RESTResponseType:
1001
+ """list_command_templates
1002
+
1003
+ Returns a list of command templates
1004
+
1005
+ :param os_type: The type of the Operating System (windows or linux). If not provided will return data for all OS types.
1006
+ :type os_type: str
1007
+ :param _request_timeout: timeout setting for this request. If one
1008
+ number provided, it will be total request
1009
+ timeout. It can also be a pair (tuple) of
1010
+ (connection, read) timeouts.
1011
+ :type _request_timeout: int, tuple(int, int), optional
1012
+ :param _request_auth: set to override the auth_settings for an a single
1013
+ request; this effectively ignores the
1014
+ authentication in the spec for a single request.
1015
+ :type _request_auth: dict, optional
1016
+ :param _content_type: force content-type for the request.
1017
+ :type _content_type: str, Optional
1018
+ :param _headers: set to override the headers for a single
1019
+ request; this effectively ignores the headers
1020
+ in the spec for a single request.
1021
+ :type _headers: dict, optional
1022
+ :param _host_index: set to override the host_index for a single
1023
+ request; this effectively ignores the host_index
1024
+ in the spec for a single request.
1025
+ :type _host_index: int, optional
1026
+ :return: Returns the result object.
1027
+ """ # noqa: E501 docstring might be too long
1028
+
1029
+ _param = self._list_command_templates_serialize(
1030
+ os_type=os_type,
1031
+ _request_auth=_request_auth,
1032
+ _content_type=_content_type,
1033
+ _headers=_headers,
1034
+ _host_index=_host_index,
1035
+ )
1036
+
1037
+ _response_types_map: Dict[str, Optional[str]] = {
1038
+ "200": "CommandTemplateResponse",
1039
+ "400": "ErrorResponse",
1040
+ "401": "ErrorResponse",
1041
+ }
1042
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1043
+ return response_data.response
1044
+
1045
+ def _list_command_templates_serialize(
1046
+ self,
1047
+ os_type,
1048
+ _request_auth,
1049
+ _content_type,
1050
+ _headers,
1051
+ _host_index,
1052
+ ) -> RequestSerialized:
1053
+
1054
+ _host = None
1055
+
1056
+ _collection_formats: Dict[str, str] = {}
1057
+
1058
+ _path_params: Dict[str, str] = {}
1059
+ _query_params: List[Tuple[str, str]] = []
1060
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1061
+ _form_params: List[Tuple[str, str]] = []
1062
+ _files: Dict[str, Union[str, bytes]] = {}
1063
+ _body_params: Optional[bytes] = None
1064
+
1065
+ # process the path parameters
1066
+ # process the query parameters
1067
+ if os_type is not None:
1068
+
1069
+ _query_params.append(("osType", os_type))
1070
+
1071
+ # process the header parameters
1072
+ # process the form parameters
1073
+ # process the body parameter
1074
+
1075
+ # set the HTTP header `Accept`
1076
+ if "Accept" not in _header_params:
1077
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
1078
+
1079
+ # authentication setting
1080
+ _auth_settings: List[str] = []
1081
+
1082
+ return self.api_client.param_serialize(
1083
+ method="GET",
1084
+ resource_path="/v1/command-templates",
1085
+ path_params=_path_params,
1086
+ query_params=_query_params,
1087
+ header_params=_header_params,
1088
+ body=_body_params,
1089
+ post_params=_form_params,
1090
+ files=_files,
1091
+ auth_settings=_auth_settings,
1092
+ collection_formats=_collection_formats,
1093
+ _host=_host,
1094
+ _request_auth=_request_auth,
1095
+ )
1096
+
1097
+ @validate_call
1098
+ def list_commands(
1099
+ self,
1100
+ project_id: Annotated[StrictStr, Field(description="ID of the project")],
1101
+ server_id: Annotated[StrictStr, Field(description="Server ID of the machine")],
1102
+ _request_timeout: Union[
1103
+ None,
1104
+ Annotated[StrictFloat, Field(gt=0)],
1105
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1106
+ ] = None,
1107
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1108
+ _content_type: Optional[StrictStr] = None,
1109
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1110
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1111
+ ) -> GetCommandsResponse:
1112
+ """list_commands
1113
+
1114
+ Returns a list of commands
1115
+
1116
+ :param project_id: ID of the project (required)
1117
+ :type project_id: str
1118
+ :param server_id: Server ID of the machine (required)
1119
+ :type server_id: str
1120
+ :param _request_timeout: timeout setting for this request. If one
1121
+ number provided, it will be total request
1122
+ timeout. It can also be a pair (tuple) of
1123
+ (connection, read) timeouts.
1124
+ :type _request_timeout: int, tuple(int, int), optional
1125
+ :param _request_auth: set to override the auth_settings for an a single
1126
+ request; this effectively ignores the
1127
+ authentication in the spec for a single request.
1128
+ :type _request_auth: dict, optional
1129
+ :param _content_type: force content-type for the request.
1130
+ :type _content_type: str, Optional
1131
+ :param _headers: set to override the headers for a single
1132
+ request; this effectively ignores the headers
1133
+ in the spec for a single request.
1134
+ :type _headers: dict, optional
1135
+ :param _host_index: set to override the host_index for a single
1136
+ request; this effectively ignores the host_index
1137
+ in the spec for a single request.
1138
+ :type _host_index: int, optional
1139
+ :return: Returns the result object.
1140
+ """ # noqa: E501 docstring might be too long
1141
+
1142
+ _param = self._list_commands_serialize(
1143
+ project_id=project_id,
1144
+ server_id=server_id,
1145
+ _request_auth=_request_auth,
1146
+ _content_type=_content_type,
1147
+ _headers=_headers,
1148
+ _host_index=_host_index,
1149
+ )
1150
+
1151
+ _response_types_map: Dict[str, Optional[str]] = {
1152
+ "200": "GetCommandsResponse",
1153
+ "400": "ErrorResponse",
1154
+ "401": "ErrorResponse",
1155
+ "404": "ErrorResponse",
1156
+ }
1157
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1158
+ response_data.read()
1159
+ return self.api_client.response_deserialize(
1160
+ response_data=response_data,
1161
+ response_types_map=_response_types_map,
1162
+ ).data
1163
+
1164
+ @validate_call
1165
+ def list_commands_with_http_info(
1166
+ self,
1167
+ project_id: Annotated[StrictStr, Field(description="ID of the project")],
1168
+ server_id: Annotated[StrictStr, Field(description="Server ID of the machine")],
1169
+ _request_timeout: Union[
1170
+ None,
1171
+ Annotated[StrictFloat, Field(gt=0)],
1172
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1173
+ ] = None,
1174
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1175
+ _content_type: Optional[StrictStr] = None,
1176
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1177
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1178
+ ) -> ApiResponse[GetCommandsResponse]:
1179
+ """list_commands
1180
+
1181
+ Returns a list of commands
1182
+
1183
+ :param project_id: ID of the project (required)
1184
+ :type project_id: str
1185
+ :param server_id: Server ID of the machine (required)
1186
+ :type server_id: str
1187
+ :param _request_timeout: timeout setting for this request. If one
1188
+ number provided, it will be total request
1189
+ timeout. It can also be a pair (tuple) of
1190
+ (connection, read) timeouts.
1191
+ :type _request_timeout: int, tuple(int, int), optional
1192
+ :param _request_auth: set to override the auth_settings for an a single
1193
+ request; this effectively ignores the
1194
+ authentication in the spec for a single request.
1195
+ :type _request_auth: dict, optional
1196
+ :param _content_type: force content-type for the request.
1197
+ :type _content_type: str, Optional
1198
+ :param _headers: set to override the headers for a single
1199
+ request; this effectively ignores the headers
1200
+ in the spec for a single request.
1201
+ :type _headers: dict, optional
1202
+ :param _host_index: set to override the host_index for a single
1203
+ request; this effectively ignores the host_index
1204
+ in the spec for a single request.
1205
+ :type _host_index: int, optional
1206
+ :return: Returns the result object.
1207
+ """ # noqa: E501 docstring might be too long
1208
+
1209
+ _param = self._list_commands_serialize(
1210
+ project_id=project_id,
1211
+ server_id=server_id,
1212
+ _request_auth=_request_auth,
1213
+ _content_type=_content_type,
1214
+ _headers=_headers,
1215
+ _host_index=_host_index,
1216
+ )
1217
+
1218
+ _response_types_map: Dict[str, Optional[str]] = {
1219
+ "200": "GetCommandsResponse",
1220
+ "400": "ErrorResponse",
1221
+ "401": "ErrorResponse",
1222
+ "404": "ErrorResponse",
1223
+ }
1224
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1225
+ response_data.read()
1226
+ return self.api_client.response_deserialize(
1227
+ response_data=response_data,
1228
+ response_types_map=_response_types_map,
1229
+ )
1230
+
1231
+ @validate_call
1232
+ def list_commands_without_preload_content(
1233
+ self,
1234
+ project_id: Annotated[StrictStr, Field(description="ID of the project")],
1235
+ server_id: Annotated[StrictStr, Field(description="Server ID of the machine")],
1236
+ _request_timeout: Union[
1237
+ None,
1238
+ Annotated[StrictFloat, Field(gt=0)],
1239
+ Tuple[Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]],
1240
+ ] = None,
1241
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1242
+ _content_type: Optional[StrictStr] = None,
1243
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1244
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1245
+ ) -> RESTResponseType:
1246
+ """list_commands
1247
+
1248
+ Returns a list of commands
1249
+
1250
+ :param project_id: ID of the project (required)
1251
+ :type project_id: str
1252
+ :param server_id: Server ID of the machine (required)
1253
+ :type server_id: str
1254
+ :param _request_timeout: timeout setting for this request. If one
1255
+ number provided, it will be total request
1256
+ timeout. It can also be a pair (tuple) of
1257
+ (connection, read) timeouts.
1258
+ :type _request_timeout: int, tuple(int, int), optional
1259
+ :param _request_auth: set to override the auth_settings for an a single
1260
+ request; this effectively ignores the
1261
+ authentication in the spec for a single request.
1262
+ :type _request_auth: dict, optional
1263
+ :param _content_type: force content-type for the request.
1264
+ :type _content_type: str, Optional
1265
+ :param _headers: set to override the headers for a single
1266
+ request; this effectively ignores the headers
1267
+ in the spec for a single request.
1268
+ :type _headers: dict, optional
1269
+ :param _host_index: set to override the host_index for a single
1270
+ request; this effectively ignores the host_index
1271
+ in the spec for a single request.
1272
+ :type _host_index: int, optional
1273
+ :return: Returns the result object.
1274
+ """ # noqa: E501 docstring might be too long
1275
+
1276
+ _param = self._list_commands_serialize(
1277
+ project_id=project_id,
1278
+ server_id=server_id,
1279
+ _request_auth=_request_auth,
1280
+ _content_type=_content_type,
1281
+ _headers=_headers,
1282
+ _host_index=_host_index,
1283
+ )
1284
+
1285
+ _response_types_map: Dict[str, Optional[str]] = {
1286
+ "200": "GetCommandsResponse",
1287
+ "400": "ErrorResponse",
1288
+ "401": "ErrorResponse",
1289
+ "404": "ErrorResponse",
1290
+ }
1291
+ response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)
1292
+ return response_data.response
1293
+
1294
+ def _list_commands_serialize(
1295
+ self,
1296
+ project_id,
1297
+ server_id,
1298
+ _request_auth,
1299
+ _content_type,
1300
+ _headers,
1301
+ _host_index,
1302
+ ) -> RequestSerialized:
1303
+
1304
+ _host = None
1305
+
1306
+ _collection_formats: Dict[str, str] = {}
1307
+
1308
+ _path_params: Dict[str, str] = {}
1309
+ _query_params: List[Tuple[str, str]] = []
1310
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1311
+ _form_params: List[Tuple[str, str]] = []
1312
+ _files: Dict[str, Union[str, bytes]] = {}
1313
+ _body_params: Optional[bytes] = None
1314
+
1315
+ # process the path parameters
1316
+ if project_id is not None:
1317
+ _path_params["projectId"] = project_id
1318
+ if server_id is not None:
1319
+ _path_params["serverId"] = server_id
1320
+ # process the query parameters
1321
+ # process the header parameters
1322
+ # process the form parameters
1323
+ # process the body parameter
1324
+
1325
+ # set the HTTP header `Accept`
1326
+ if "Accept" not in _header_params:
1327
+ _header_params["Accept"] = self.api_client.select_header_accept(["application/json"])
1328
+
1329
+ # authentication setting
1330
+ _auth_settings: List[str] = []
1331
+
1332
+ return self.api_client.param_serialize(
1333
+ method="GET",
1334
+ resource_path="/v1/projects/{projectId}/servers/{serverId}/commands",
1335
+ path_params=_path_params,
1336
+ query_params=_query_params,
1337
+ header_params=_header_params,
1338
+ body=_body_params,
1339
+ post_params=_form_params,
1340
+ files=_files,
1341
+ auth_settings=_auth_settings,
1342
+ collection_formats=_collection_formats,
1343
+ _host=_host,
1344
+ _request_auth=_request_auth,
1345
+ )