/
client.rb
725 lines (659 loc) · 33.4 KB
/
client.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
# frozen_string_literal: true
# Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
require 'json'
module TencentCloud
module Tat
module V20201028
class Client < TencentCloud::Common::AbstractClient
def initialize(credential, region, profile = nil)
api_version = '2020-10-28'
api_endpoint = 'tat.tencentcloudapi.com'
sdk_version = 'TAT_' + File.read(File.expand_path('../VERSION', __dir__)).strip
super(credential, region, api_version, api_endpoint, sdk_version, profile)
end
# 取消一台或多台CVM实例执行的命令
# * 如果命令还未下发到agent,任务状态处于处于PENDING、DELIVERING、DELIVER_DELAYED,取消后任务状态是CANCELLED
# * 如果命令已下发到agent,任务状态处于RUNNING, 取消后任务状态是TERMINATED
# @param request: Request instance for CancelInvocation.
# @type request: :class:`Tencentcloud::tat::V20201028::CancelInvocationRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::CancelInvocationResponse`
def CancelInvocation(request)
body = send_request('CancelInvocation', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CancelInvocationResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 此接口用于创建命令。
# @param request: Request instance for CreateCommand.
# @type request: :class:`Tencentcloud::tat::V20201028::CreateCommandRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::CreateCommandResponse`
def CreateCommand(request)
body = send_request('CreateCommand', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CreateCommandResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 此接口用于创建执行器。
# @param request: Request instance for CreateInvoker.
# @type request: :class:`Tencentcloud::tat::V20201028::CreateInvokerRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::CreateInvokerResponse`
def CreateInvoker(request)
body = send_request('CreateInvoker', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CreateInvokerResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 接口用于创建注册码。
# @param request: Request instance for CreateRegisterCode.
# @type request: :class:`Tencentcloud::tat::V20201028::CreateRegisterCodeRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::CreateRegisterCodeResponse`
def CreateRegisterCode(request)
body = send_request('CreateRegisterCode', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CreateRegisterCodeResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 此接口用于删除命令。
# 如果命令与执行器关联,则无法被删除。
# @param request: Request instance for DeleteCommand.
# @type request: :class:`Tencentcloud::tat::V20201028::DeleteCommandRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::DeleteCommandResponse`
def DeleteCommand(request)
body = send_request('DeleteCommand', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteCommandResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 批量删除命令接口
# @param request: Request instance for DeleteCommands.
# @type request: :class:`Tencentcloud::tat::V20201028::DeleteCommandsRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::DeleteCommandsResponse`
def DeleteCommands(request)
body = send_request('DeleteCommands', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteCommandsResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 此接口用于删除执行器。
# @param request: Request instance for DeleteInvoker.
# @type request: :class:`Tencentcloud::tat::V20201028::DeleteInvokerRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::DeleteInvokerResponse`
def DeleteInvoker(request)
body = send_request('DeleteInvoker', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteInvokerResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 此接口用于批量删除注册码。
# @param request: Request instance for DeleteRegisterCodes.
# @type request: :class:`Tencentcloud::tat::V20201028::DeleteRegisterCodesRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::DeleteRegisterCodesResponse`
def DeleteRegisterCodes(request)
body = send_request('DeleteRegisterCodes', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteRegisterCodesResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 接口用于删除托管实例。
# @param request: Request instance for DeleteRegisterInstance.
# @type request: :class:`Tencentcloud::tat::V20201028::DeleteRegisterInstanceRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::DeleteRegisterInstanceResponse`
def DeleteRegisterInstance(request)
body = send_request('DeleteRegisterInstance', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteRegisterInstanceResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 此接口用于查询自动化助手客户端的状态。
# @param request: Request instance for DescribeAutomationAgentStatus.
# @type request: :class:`Tencentcloud::tat::V20201028::DescribeAutomationAgentStatusRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::DescribeAutomationAgentStatusResponse`
def DescribeAutomationAgentStatus(request)
body = send_request('DescribeAutomationAgentStatus', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeAutomationAgentStatusResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 此接口用于查询命令详情。
# @param request: Request instance for DescribeCommands.
# @type request: :class:`Tencentcloud::tat::V20201028::DescribeCommandsRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::DescribeCommandsResponse`
def DescribeCommands(request)
body = send_request('DescribeCommands', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeCommandsResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 此接口用于查询执行任务详情。
# @param request: Request instance for DescribeInvocationTasks.
# @type request: :class:`Tencentcloud::tat::V20201028::DescribeInvocationTasksRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::DescribeInvocationTasksResponse`
def DescribeInvocationTasks(request)
body = send_request('DescribeInvocationTasks', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeInvocationTasksResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 此接口用于查询执行活动详情。
# @param request: Request instance for DescribeInvocations.
# @type request: :class:`Tencentcloud::tat::V20201028::DescribeInvocationsRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::DescribeInvocationsResponse`
def DescribeInvocations(request)
body = send_request('DescribeInvocations', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeInvocationsResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 此接口用于查询执行器的执行记录。
# @param request: Request instance for DescribeInvokerRecords.
# @type request: :class:`Tencentcloud::tat::V20201028::DescribeInvokerRecordsRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::DescribeInvokerRecordsResponse`
def DescribeInvokerRecords(request)
body = send_request('DescribeInvokerRecords', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeInvokerRecordsResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 此接口用于查询执行器信息。
# @param request: Request instance for DescribeInvokers.
# @type request: :class:`Tencentcloud::tat::V20201028::DescribeInvokersRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::DescribeInvokersResponse`
def DescribeInvokers(request)
body = send_request('DescribeInvokers', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeInvokersResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 此接口用于获取配额信息
# @param request: Request instance for DescribeQuotas.
# @type request: :class:`Tencentcloud::tat::V20201028::DescribeQuotasRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::DescribeQuotasResponse`
def DescribeQuotas(request)
body = send_request('DescribeQuotas', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeQuotasResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 此接口用于查询 TAT 产品后台地域列表。
# RegionState 为 AVAILABLE,代表该地域的 TAT 后台服务已经可用;未返回,代表该地域的 TAT 后台服务尚不可用。
# @param request: Request instance for DescribeRegions.
# @type request: :class:`Tencentcloud::tat::V20201028::DescribeRegionsRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::DescribeRegionsResponse`
def DescribeRegions(request)
body = send_request('DescribeRegions', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeRegionsResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 接口用于查询注册码信息。
# @param request: Request instance for DescribeRegisterCodes.
# @type request: :class:`Tencentcloud::tat::V20201028::DescribeRegisterCodesRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::DescribeRegisterCodesResponse`
def DescribeRegisterCodes(request)
body = send_request('DescribeRegisterCodes', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeRegisterCodesResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 接口用于查询被托管的实例信息。
# @param request: Request instance for DescribeRegisterInstances.
# @type request: :class:`Tencentcloud::tat::V20201028::DescribeRegisterInstancesRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::DescribeRegisterInstancesResponse`
def DescribeRegisterInstances(request)
body = send_request('DescribeRegisterInstances', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DescribeRegisterInstancesResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 此接口用于停止执行器。
# @param request: Request instance for DisableInvoker.
# @type request: :class:`Tencentcloud::tat::V20201028::DisableInvokerRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::DisableInvokerResponse`
def DisableInvoker(request)
body = send_request('DisableInvoker', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DisableInvokerResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 此接口用于批量禁用注册码。
# @param request: Request instance for DisableRegisterCodes.
# @type request: :class:`Tencentcloud::tat::V20201028::DisableRegisterCodesRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::DisableRegisterCodesResponse`
def DisableRegisterCodes(request)
body = send_request('DisableRegisterCodes', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DisableRegisterCodesResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 此接口用于启用执行器。
# @param request: Request instance for EnableInvoker.
# @type request: :class:`Tencentcloud::tat::V20201028::EnableInvokerRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::EnableInvokerResponse`
def EnableInvoker(request)
body = send_request('EnableInvoker', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = EnableInvokerResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 在指定的实例上触发命令,调用成功返回执行活动ID(inv-xxxxxxxx),每个执行活动内部有一个或多个执行任务(invt-xxxxxxxx),每个执行任务代表命令在一台 CVM 或一台 Lighthouse 上的执行记录。
# * 如果指定实例未安装 agent,或 agent 不在线,返回失败
# * 如果命令类型与 agent 运行环境不符,返回失败
# * 指定的实例需要处于 VPC 网络
# * 指定的实例需要处于 RUNNING 状态
# * 不可同时指定 CVM 和 Lighthouse
# @param request: Request instance for InvokeCommand.
# @type request: :class:`Tencentcloud::tat::V20201028::InvokeCommandRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::InvokeCommandResponse`
def InvokeCommand(request)
body = send_request('InvokeCommand', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = InvokeCommandResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 此接口用于修改命令。
# @param request: Request instance for ModifyCommand.
# @type request: :class:`Tencentcloud::tat::V20201028::ModifyCommandRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::ModifyCommandResponse`
def ModifyCommand(request)
body = send_request('ModifyCommand', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ModifyCommandResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 此接口用于修改执行器。
# @param request: Request instance for ModifyInvoker.
# @type request: :class:`Tencentcloud::tat::V20201028::ModifyInvokerRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::ModifyInvokerResponse`
def ModifyInvoker(request)
body = send_request('ModifyInvoker', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ModifyInvokerResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 接口用于修改托管实例信息。
# @param request: Request instance for ModifyRegisterInstance.
# @type request: :class:`Tencentcloud::tat::V20201028::ModifyRegisterInstanceRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::ModifyRegisterInstanceResponse`
def ModifyRegisterInstance(request)
body = send_request('ModifyRegisterInstance', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ModifyRegisterInstanceResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 此接口用于预览自定义参数替换后的命令内容。不会触发真实执行。
# @param request: Request instance for PreviewReplacedCommandContent.
# @type request: :class:`Tencentcloud::tat::V20201028::PreviewReplacedCommandContentRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::PreviewReplacedCommandContentResponse`
def PreviewReplacedCommandContent(request)
body = send_request('PreviewReplacedCommandContent', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = PreviewReplacedCommandContentResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
# 执行命令,调用成功返回执行活动ID(inv-xxxxxxxx),每个执行活动内部有一个或多个执行任务(invt-xxxxxxxx),每个执行任务代表命令在一台 CVM 或一台 Lighthouse 上的执行记录。
# * 如果指定实例未安装 agent,或 agent 不在线,返回失败
# * 如果命令类型与 agent 运行环境不符,返回失败
# * 指定的实例需要处于 VPC 网络
# * 指定的实例需要处于 `RUNNING` 状态
# * 不可同时指定 CVM 和 Lighthouse
# @param request: Request instance for RunCommand.
# @type request: :class:`Tencentcloud::tat::V20201028::RunCommandRequest`
# @rtype: :class:`Tencentcloud::tat::V20201028::RunCommandResponse`
def RunCommand(request)
body = send_request('RunCommand', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = RunCommandResponse.new
model.deserialize(response['Response'])
model
else
code = response['Response']['Error']['Code']
message = response['Response']['Error']['Message']
reqid = response['Response']['RequestId']
raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
end
rescue TencentCloud::Common::TencentCloudSDKException => e
raise e
rescue StandardError => e
raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
end
end
end
end
end