-
Notifications
You must be signed in to change notification settings - Fork 16
/
client.rb
1162 lines (1055 loc) · 54.1 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
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# 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 Scf
module V20180416
class Client < TencentCloud::Common::AbstractClient
def initialize(credential, region, profile = nil)
api_version = '2018-04-16'
api_endpoint = 'scf.tencentcloudapi.com'
sdk_version = 'SCF_' + File.read(File.expand_path('../VERSION', __dir__)).strip
super(credential, region, api_version, api_endpoint, sdk_version, profile)
end
# 复制一个函数,您可以选择将复制出的新函数放置在特定的Region和Namespace。
# 注:本接口**不会**复制函数的以下对象或属性:
# 1. 函数的触发器
# 2. 除了$LATEST以外的其它版本
# 3. 函数配置的日志投递到的CLS目标。
# 如有需要,您可以在复制后手动配置新函数。
# @param request: Request instance for CopyFunction.
# @type request: :class:`Tencentcloud::scf::V20180416::CopyFunctionRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::CopyFunctionResponse`
def CopyFunction(request)
body = send_request('CopyFunction', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CopyFunctionResponse.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
# 为某个函数版本创建一个别名,您可以使用别名来标记特定的函数版本,如DEV/RELEASE版本,也可以随时修改别名指向的版本。
# 一个别名必须指向一个主版本,此外还可以同时指向一个附加版本。调用函数时指定特定的别名,则请求会被发送到别名指向的版本上,您可以配置请求发送到主版本和附加版本的比例。
# @param request: Request instance for CreateAlias.
# @type request: :class:`Tencentcloud::scf::V20180416::CreateAliasRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::CreateAliasResponse`
def CreateAlias(request)
body = send_request('CreateAlias', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CreateAliasResponse.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 CreateFunction.
# @type request: :class:`Tencentcloud::scf::V20180416::CreateFunctionRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::CreateFunctionResponse`
def CreateFunction(request)
body = send_request('CreateFunction', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CreateFunctionResponse.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 CreateNamespace.
# @type request: :class:`Tencentcloud::scf::V20180416::CreateNamespaceRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::CreateNamespaceResponse`
def CreateNamespace(request)
body = send_request('CreateNamespace', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CreateNamespaceResponse.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 CreateTrigger.
# @type request: :class:`Tencentcloud::scf::V20180416::CreateTriggerRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::CreateTriggerResponse`
def CreateTrigger(request)
body = send_request('CreateTrigger', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = CreateTriggerResponse.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 DeleteAlias.
# @type request: :class:`Tencentcloud::scf::V20180416::DeleteAliasRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::DeleteAliasResponse`
def DeleteAlias(request)
body = send_request('DeleteAlias', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteAliasResponse.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 DeleteFunction.
# @type request: :class:`Tencentcloud::scf::V20180416::DeleteFunctionRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::DeleteFunctionResponse`
def DeleteFunction(request)
body = send_request('DeleteFunction', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteFunctionResponse.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 DeleteLayerVersion.
# @type request: :class:`Tencentcloud::scf::V20180416::DeleteLayerVersionRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::DeleteLayerVersionResponse`
def DeleteLayerVersion(request)
body = send_request('DeleteLayerVersion', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteLayerVersionResponse.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 DeleteNamespace.
# @type request: :class:`Tencentcloud::scf::V20180416::DeleteNamespaceRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::DeleteNamespaceResponse`
def DeleteNamespace(request)
body = send_request('DeleteNamespace', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteNamespaceResponse.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 DeleteProvisionedConcurrencyConfig.
# @type request: :class:`Tencentcloud::scf::V20180416::DeleteProvisionedConcurrencyConfigRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::DeleteProvisionedConcurrencyConfigResponse`
def DeleteProvisionedConcurrencyConfig(request)
body = send_request('DeleteProvisionedConcurrencyConfig', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteProvisionedConcurrencyConfigResponse.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 DeleteReservedConcurrencyConfig.
# @type request: :class:`Tencentcloud::scf::V20180416::DeleteReservedConcurrencyConfigRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::DeleteReservedConcurrencyConfigResponse`
def DeleteReservedConcurrencyConfig(request)
body = send_request('DeleteReservedConcurrencyConfig', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteReservedConcurrencyConfigResponse.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 DeleteTrigger.
# @type request: :class:`Tencentcloud::scf::V20180416::DeleteTriggerRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::DeleteTriggerResponse`
def DeleteTrigger(request)
body = send_request('DeleteTrigger', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = DeleteTriggerResponse.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 GetAccount.
# @type request: :class:`Tencentcloud::scf::V20180416::GetAccountRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::GetAccountResponse`
def GetAccount(request)
body = send_request('GetAccount', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = GetAccountResponse.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 GetAlias.
# @type request: :class:`Tencentcloud::scf::V20180416::GetAliasRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::GetAliasResponse`
def GetAlias(request)
body = send_request('GetAlias', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = GetAliasResponse.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
# 获取函数异步执行事件状态,事件状态保留 3 * 24 小时(从事件完成开始计时)。
# @param request: Request instance for GetAsyncEventStatus.
# @type request: :class:`Tencentcloud::scf::V20180416::GetAsyncEventStatusRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::GetAsyncEventStatusResponse`
def GetAsyncEventStatus(request)
body = send_request('GetAsyncEventStatus', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = GetAsyncEventStatusResponse.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 GetFunction.
# @type request: :class:`Tencentcloud::scf::V20180416::GetFunctionRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::GetFunctionResponse`
def GetFunction(request)
body = send_request('GetFunction', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = GetFunctionResponse.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 GetFunctionAddress.
# @type request: :class:`Tencentcloud::scf::V20180416::GetFunctionAddressRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::GetFunctionAddressResponse`
def GetFunctionAddress(request)
body = send_request('GetFunctionAddress', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = GetFunctionAddressResponse.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 GetFunctionEventInvokeConfig.
# @type request: :class:`Tencentcloud::scf::V20180416::GetFunctionEventInvokeConfigRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::GetFunctionEventInvokeConfigResponse`
def GetFunctionEventInvokeConfig(request)
body = send_request('GetFunctionEventInvokeConfig', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = GetFunctionEventInvokeConfigResponse.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
# 该接口根据指定的日志查询条件返回函数运行日志。该接口已下线,查询函数请求运行的返回信息,请使用 [GetRequestStatus](https://cloud.tencent.com/document/product/583/65348)。查询函数运行日志,请参考[日志检索教程](https://cloud.tencent.com/document/product/583/52637)。
# @param request: Request instance for GetFunctionLogs.
# @type request: :class:`Tencentcloud::scf::V20180416::GetFunctionLogsRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::GetFunctionLogsResponse`
def GetFunctionLogs(request)
body = send_request('GetFunctionLogs', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = GetFunctionLogsResponse.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 GetLayerVersion.
# @type request: :class:`Tencentcloud::scf::V20180416::GetLayerVersionRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::GetLayerVersionResponse`
def GetLayerVersion(request)
body = send_request('GetLayerVersion', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = GetLayerVersionResponse.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 GetProvisionedConcurrencyConfig.
# @type request: :class:`Tencentcloud::scf::V20180416::GetProvisionedConcurrencyConfigRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::GetProvisionedConcurrencyConfigResponse`
def GetProvisionedConcurrencyConfig(request)
body = send_request('GetProvisionedConcurrencyConfig', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = GetProvisionedConcurrencyConfigResponse.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 GetRequestStatus.
# @type request: :class:`Tencentcloud::scf::V20180416::GetRequestStatusRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::GetRequestStatusResponse`
def GetRequestStatus(request)
body = send_request('GetRequestStatus', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = GetRequestStatusResponse.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 GetReservedConcurrencyConfig.
# @type request: :class:`Tencentcloud::scf::V20180416::GetReservedConcurrencyConfigRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::GetReservedConcurrencyConfigResponse`
def GetReservedConcurrencyConfig(request)
body = send_request('GetReservedConcurrencyConfig', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = GetReservedConcurrencyConfigResponse.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 Invoke.
# @type request: :class:`Tencentcloud::scf::V20180416::InvokeRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::InvokeResponse`
def Invoke(request)
body = send_request('Invoke', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = InvokeResponse.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
# SCF同步调用函数接口。
# @param request: Request instance for InvokeFunction.
# @type request: :class:`Tencentcloud::scf::V20180416::InvokeFunctionRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::InvokeFunctionResponse`
def InvokeFunction(request)
body = send_request('InvokeFunction', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = InvokeFunctionResponse.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 ListAliases.
# @type request: :class:`Tencentcloud::scf::V20180416::ListAliasesRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::ListAliasesResponse`
def ListAliases(request)
body = send_request('ListAliases', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ListAliasesResponse.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 ListAsyncEvents.
# @type request: :class:`Tencentcloud::scf::V20180416::ListAsyncEventsRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::ListAsyncEventsResponse`
def ListAsyncEvents(request)
body = send_request('ListAsyncEvents', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ListAsyncEventsResponse.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 ListFunctions.
# @type request: :class:`Tencentcloud::scf::V20180416::ListFunctionsRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::ListFunctionsResponse`
def ListFunctions(request)
body = send_request('ListFunctions', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ListFunctionsResponse.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 ListLayerVersions.
# @type request: :class:`Tencentcloud::scf::V20180416::ListLayerVersionsRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::ListLayerVersionsResponse`
def ListLayerVersions(request)
body = send_request('ListLayerVersions', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ListLayerVersionsResponse.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 ListLayers.
# @type request: :class:`Tencentcloud::scf::V20180416::ListLayersRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::ListLayersResponse`
def ListLayers(request)
body = send_request('ListLayers', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ListLayersResponse.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 ListNamespaces.
# @type request: :class:`Tencentcloud::scf::V20180416::ListNamespacesRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::ListNamespacesResponse`
def ListNamespaces(request)
body = send_request('ListNamespaces', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ListNamespacesResponse.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 ListTriggers.
# @type request: :class:`Tencentcloud::scf::V20180416::ListTriggersRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::ListTriggersResponse`
def ListTriggers(request)
body = send_request('ListTriggers', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ListTriggersResponse.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 ListVersionByFunction.
# @type request: :class:`Tencentcloud::scf::V20180416::ListVersionByFunctionRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::ListVersionByFunctionResponse`
def ListVersionByFunction(request)
body = send_request('ListVersionByFunction', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = ListVersionByFunctionResponse.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
# 使用给定的zip文件或cos对象创建一个层的新版本,每次使用相同的层的名称调用本接口,都会生成一个新版本。
# @param request: Request instance for PublishLayerVersion.
# @type request: :class:`Tencentcloud::scf::V20180416::PublishLayerVersionRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::PublishLayerVersionResponse`
def PublishLayerVersion(request)
body = send_request('PublishLayerVersion', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = PublishLayerVersionResponse.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 PublishVersion.
# @type request: :class:`Tencentcloud::scf::V20180416::PublishVersionRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::PublishVersionResponse`
def PublishVersion(request)
body = send_request('PublishVersion', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = PublishVersionResponse.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
# 设置函数某一非$LATEST版本的预置并发。
# @param request: Request instance for PutProvisionedConcurrencyConfig.
# @type request: :class:`Tencentcloud::scf::V20180416::PutProvisionedConcurrencyConfigRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::PutProvisionedConcurrencyConfigResponse`
def PutProvisionedConcurrencyConfig(request)
body = send_request('PutProvisionedConcurrencyConfig', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = PutProvisionedConcurrencyConfigResponse.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 PutReservedConcurrencyConfig.
# @type request: :class:`Tencentcloud::scf::V20180416::PutReservedConcurrencyConfigRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::PutReservedConcurrencyConfigResponse`
def PutReservedConcurrencyConfig(request)
body = send_request('PutReservedConcurrencyConfig', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = PutReservedConcurrencyConfigResponse.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 PutTotalConcurrencyConfig.
# @type request: :class:`Tencentcloud::scf::V20180416::PutTotalConcurrencyConfigRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::PutTotalConcurrencyConfigResponse`
def PutTotalConcurrencyConfig(request)
body = send_request('PutTotalConcurrencyConfig', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = PutTotalConcurrencyConfigResponse.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 TerminateAsyncEvent.
# @type request: :class:`Tencentcloud::scf::V20180416::TerminateAsyncEventRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::TerminateAsyncEventResponse`
def TerminateAsyncEvent(request)
body = send_request('TerminateAsyncEvent', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = TerminateAsyncEventResponse.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 UpdateAlias.
# @type request: :class:`Tencentcloud::scf::V20180416::UpdateAliasRequest`
# @rtype: :class:`Tencentcloud::scf::V20180416::UpdateAliasResponse`
def UpdateAlias(request)
body = send_request('UpdateAlias', request.serialize)
response = JSON.parse(body)
if response['Response'].key?('Error') == false
model = UpdateAliasResponse.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
# 该接口根据传入参数更新函数代码。