tccli 3.0.1134.1__py2.py3-none-any.whl → 3.0.1136.1__py2.py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- tccli/__init__.py +1 -1
- tccli/services/__init__.py +3 -0
- tccli/services/asr/asr_client.py +53 -0
- tccli/services/asr/v20190614/api.json +193 -1
- tccli/services/asr/v20190614/examples.json +8 -0
- tccli/services/batch/v20170312/api.json +8 -5
- tccli/services/batch/v20170312/examples.json +1 -1
- tccli/services/cdb/cdb_client.py +57 -4
- tccli/services/cdb/v20170320/api.json +270 -0
- tccli/services/cdb/v20170320/examples.json +8 -0
- tccli/services/ckafka/v20190819/api.json +1 -1
- tccli/services/cls/v20201016/api.json +3 -3
- tccli/services/dlc/dlc_client.py +53 -0
- tccli/services/dlc/v20210125/api.json +138 -4
- tccli/services/dlc/v20210125/examples.json +13 -5
- tccli/services/dsgc/v20190723/api.json +35 -35
- tccli/services/eiam/v20210420/api.json +4 -4
- tccli/services/eiam/v20210420/examples.json +4 -4
- tccli/services/ess/v20201111/api.json +1 -1
- tccli/services/essbasic/v20210526/api.json +3 -3
- tccli/services/facefusion/v20181201/api.json +12 -12
- tccli/services/facefusion/v20181201/examples.json +4 -4
- tccli/services/iotexplorer/iotexplorer_client.py +53 -0
- tccli/services/iotexplorer/v20190423/api.json +137 -4
- tccli/services/iotexplorer/v20190423/examples.json +8 -0
- tccli/services/lcic/v20220817/api.json +4 -4
- tccli/services/lighthouse/v20200324/api.json +15 -15
- tccli/services/lighthouse/v20200324/examples.json +7 -7
- tccli/services/lke/lke_client.py +175 -16
- tccli/services/lke/v20231130/api.json +782 -165
- tccli/services/lke/v20231130/examples.json +35 -5
- tccli/services/ocr/v20181119/api.json +1 -1
- tccli/services/ses/v20201002/api.json +20 -1
- tccli/services/tdmq/tdmq_client.py +53 -0
- tccli/services/tdmq/v20200217/api.json +321 -0
- tccli/services/tdmq/v20200217/examples.json +8 -0
- tccli/services/tem/v20210701/api.json +8 -5
- tccli/services/tem/v20210701/examples.json +2 -2
- tccli/services/tke/v20180525/api.json +33 -21
- tccli/services/tke/v20180525/examples.json +4 -4
- tccli/services/trocket/trocket_client.py +65 -12
- tccli/services/trocket/v20230308/api.json +196 -0
- tccli/services/trocket/v20230308/examples.json +8 -0
- tccli/services/trtc/v20190722/api.json +48 -66
- tccli/services/tsi/__init__.py +4 -0
- tccli/services/tsi/tsi_client.py +301 -0
- tccli/services/tsi/v20210325/api.json +373 -0
- tccli/services/tsi/v20210325/examples.json +29 -0
- tccli/services/vpc/v20170312/api.json +36 -16
- tccli/services/vpc/v20170312/examples.json +9 -3
- tccli/services/waf/v20180125/api.json +70 -0
- tccli/services/waf/v20180125/examples.json +8 -0
- tccli/services/waf/waf_client.py +53 -0
- {tccli-3.0.1134.1.dist-info → tccli-3.0.1136.1.dist-info}/METADATA +2 -2
- {tccli-3.0.1134.1.dist-info → tccli-3.0.1136.1.dist-info}/RECORD +58 -54
- {tccli-3.0.1134.1.dist-info → tccli-3.0.1136.1.dist-info}/WHEEL +0 -0
- {tccli-3.0.1134.1.dist-info → tccli-3.0.1136.1.dist-info}/entry_points.txt +0 -0
- {tccli-3.0.1134.1.dist-info → tccli-3.0.1136.1.dist-info}/license_files/LICENSE +0 -0
@@ -3475,6 +3475,15 @@
|
|
3475
3475
|
"name": "BackgroundCustomRender",
|
3476
3476
|
"required": false,
|
3477
3477
|
"type": "object"
|
3478
|
+
},
|
3479
|
+
{
|
3480
|
+
"disabled": false,
|
3481
|
+
"document": "子背景色生效模式,默认值为0表示均不生效。\nbit0:占位图缩放是否生效。\nbit1:上行流缩放是否生效。\n您可以将相应bit位置1启动生效,例如:\n0(00)表示子背景色不生效。\n1(01)表示子背景色只在占位图缩放时生效。\n2(10)表示子背景色只在上行流缩放时生效。\n3(11)表示子背景色在占位图缩放和上行流缩放时均生效。\n",
|
3482
|
+
"example": "BackGroundColorMode",
|
3483
|
+
"member": "uint64",
|
3484
|
+
"name": "BackGroundColorMode",
|
3485
|
+
"required": false,
|
3486
|
+
"type": "int"
|
3478
3487
|
}
|
3479
3488
|
],
|
3480
3489
|
"usage": "in"
|
@@ -3978,8 +3987,7 @@
|
|
3978
3987
|
"member": "uint64",
|
3979
3988
|
"name": "Top",
|
3980
3989
|
"required": true,
|
3981
|
-
"type": "int"
|
3982
|
-
"value_allowed_null": false
|
3990
|
+
"type": "int"
|
3983
3991
|
},
|
3984
3992
|
{
|
3985
3993
|
"disabled": false,
|
@@ -3988,8 +3996,7 @@
|
|
3988
3996
|
"member": "uint64",
|
3989
3997
|
"name": "Left",
|
3990
3998
|
"required": true,
|
3991
|
-
"type": "int"
|
3992
|
-
"value_allowed_null": false
|
3999
|
+
"type": "int"
|
3993
4000
|
},
|
3994
4001
|
{
|
3995
4002
|
"disabled": false,
|
@@ -3998,8 +4005,7 @@
|
|
3998
4005
|
"member": "uint64",
|
3999
4006
|
"name": "Width",
|
4000
4007
|
"required": true,
|
4001
|
-
"type": "int"
|
4002
|
-
"value_allowed_null": false
|
4008
|
+
"type": "int"
|
4003
4009
|
},
|
4004
4010
|
{
|
4005
4011
|
"disabled": false,
|
@@ -4008,8 +4014,7 @@
|
|
4008
4014
|
"member": "uint64",
|
4009
4015
|
"name": "Height",
|
4010
4016
|
"required": true,
|
4011
|
-
"type": "int"
|
4012
|
-
"value_allowed_null": false
|
4017
|
+
"type": "int"
|
4013
4018
|
},
|
4014
4019
|
{
|
4015
4020
|
"disabled": false,
|
@@ -4018,8 +4023,7 @@
|
|
4018
4023
|
"member": "string",
|
4019
4024
|
"name": "UserId",
|
4020
4025
|
"required": false,
|
4021
|
-
"type": "string"
|
4022
|
-
"value_allowed_null": false
|
4026
|
+
"type": "string"
|
4023
4027
|
},
|
4024
4028
|
{
|
4025
4029
|
"disabled": false,
|
@@ -4028,8 +4032,7 @@
|
|
4028
4032
|
"member": "uint64",
|
4029
4033
|
"name": "Alpha",
|
4030
4034
|
"required": false,
|
4031
|
-
"type": "int"
|
4032
|
-
"value_allowed_null": false
|
4035
|
+
"type": "int"
|
4033
4036
|
},
|
4034
4037
|
{
|
4035
4038
|
"disabled": false,
|
@@ -4038,8 +4041,7 @@
|
|
4038
4041
|
"member": "uint64",
|
4039
4042
|
"name": "RenderMode",
|
4040
4043
|
"required": false,
|
4041
|
-
"type": "int"
|
4042
|
-
"value_allowed_null": false
|
4044
|
+
"type": "int"
|
4043
4045
|
},
|
4044
4046
|
{
|
4045
4047
|
"disabled": false,
|
@@ -4048,8 +4050,7 @@
|
|
4048
4050
|
"member": "uint64",
|
4049
4051
|
"name": "MediaId",
|
4050
4052
|
"required": false,
|
4051
|
-
"type": "int"
|
4052
|
-
"value_allowed_null": false
|
4053
|
+
"type": "int"
|
4053
4054
|
},
|
4054
4055
|
{
|
4055
4056
|
"disabled": false,
|
@@ -4058,18 +4059,16 @@
|
|
4058
4059
|
"member": "uint64",
|
4059
4060
|
"name": "ImageLayer",
|
4060
4061
|
"required": false,
|
4061
|
-
"type": "int"
|
4062
|
-
"value_allowed_null": false
|
4062
|
+
"type": "int"
|
4063
4063
|
},
|
4064
4064
|
{
|
4065
4065
|
"disabled": false,
|
4066
|
-
"document": "图片的url地址, 只支持jpg
|
4067
|
-
"example": "https://xxxx",
|
4066
|
+
"document": "图片的url地址, 只支持jpg, png, jpeg,大小限制不超过5M。注意,url必须携带格式后缀,url内只支持特定的字符串, 范围是a-z A-Z 0-9 '-', '.', '_', '~', ':', '/', '?', '#', '[', ']' '@', '!', '&', '(', ')', '*', '+', ',', '%', '='",
|
4067
|
+
"example": "https://xxxx/image.jpg, https://xxxx/image.jpg?token=xxx",
|
4068
4068
|
"member": "string",
|
4069
4069
|
"name": "SubBackgroundImage",
|
4070
4070
|
"required": false,
|
4071
|
-
"type": "string"
|
4072
|
-
"value_allowed_null": false
|
4071
|
+
"type": "string"
|
4073
4072
|
}
|
4074
4073
|
],
|
4075
4074
|
"usage": "in"
|
@@ -4079,13 +4078,12 @@
|
|
4079
4078
|
"members": [
|
4080
4079
|
{
|
4081
4080
|
"disabled": false,
|
4082
|
-
"document": "布局模式:\n1:悬浮布局;\n2:屏幕分享布局;\n3
|
4081
|
+
"document": "布局模式:\n1:悬浮布局;\n2:屏幕分享布局;\n3:九宫格布局;\n4:自定义布局;\n\n悬浮布局:默认第一个进入房间的主播(也可以指定一个主播)的视频画面会铺满整个屏幕。其他主播的视频画面从左下角开始依次按照进房顺序水平排列,显示为小画面,小画面悬浮于大画面之上。当画面数量小于等于17个时,每行4个(4 x 4排列)。当画面数量大于17个时,重新布局小画面为每行5个(5 x 5)排列。最多支持25个画面,如果用户只发送音频,仍然会占用画面位置。\n\n屏幕分享布局:指定一个主播在屏幕左侧的大画面位置(如果不指定,那么大画面位置为背景色),其他主播自上而下依次垂直排列于右侧。当画面数量少于17个的时候,右侧每列最多8人,最多占据两列。当画面数量多于17个的时候,超过17个画面的主播从左下角开始依次水平排列。最多支持25个画面,如果主播只发送音频,仍然会占用画面位置。\n\n九宫格布局:根据主播的数量自动调整每个画面的大小,每个主播的画面大小一致,最多支持25个画面。\n\n自定义布局:根据需要在MixLayoutList内定制每个主播画面的布局。",
|
4083
4082
|
"example": "3",
|
4084
4083
|
"member": "uint64",
|
4085
4084
|
"name": "MixLayoutMode",
|
4086
4085
|
"required": true,
|
4087
|
-
"type": "int"
|
4088
|
-
"value_allowed_null": false
|
4086
|
+
"type": "int"
|
4089
4087
|
},
|
4090
4088
|
{
|
4091
4089
|
"disabled": false,
|
@@ -4094,8 +4092,7 @@
|
|
4094
4092
|
"member": "MixLayout",
|
4095
4093
|
"name": "MixLayoutList",
|
4096
4094
|
"required": false,
|
4097
|
-
"type": "list"
|
4098
|
-
"value_allowed_null": false
|
4095
|
+
"type": "list"
|
4099
4096
|
},
|
4100
4097
|
{
|
4101
4098
|
"disabled": false,
|
@@ -4104,8 +4101,7 @@
|
|
4104
4101
|
"member": "string",
|
4105
4102
|
"name": "BackGroundColor",
|
4106
4103
|
"required": false,
|
4107
|
-
"type": "string"
|
4108
|
-
"value_allowed_null": false
|
4104
|
+
"type": "string"
|
4109
4105
|
},
|
4110
4106
|
{
|
4111
4107
|
"disabled": false,
|
@@ -4114,8 +4110,7 @@
|
|
4114
4110
|
"member": "string",
|
4115
4111
|
"name": "MaxResolutionUserId",
|
4116
4112
|
"required": false,
|
4117
|
-
"type": "string"
|
4118
|
-
"value_allowed_null": false
|
4113
|
+
"type": "string"
|
4119
4114
|
},
|
4120
4115
|
{
|
4121
4116
|
"disabled": false,
|
@@ -4124,18 +4119,16 @@
|
|
4124
4119
|
"member": "uint64",
|
4125
4120
|
"name": "MediaId",
|
4126
4121
|
"required": false,
|
4127
|
-
"type": "int"
|
4128
|
-
"value_allowed_null": false
|
4122
|
+
"type": "int"
|
4129
4123
|
},
|
4130
4124
|
{
|
4131
4125
|
"disabled": false,
|
4132
|
-
"document": "图片的url
|
4133
|
-
"example": "https://xxxx",
|
4126
|
+
"document": "图片的url地址,只支持jpg, png, jpeg,大小限制不超过5M。注意,url必须携带格式后缀,url内只支持特定的字符串, 范围是a-z A-Z 0-9 '-', '.', '_', '~', ':', '/', '?', '#', '[', ']' '@', '!', '&', '(', ')', '*', '+', ',', '%', '='",
|
4127
|
+
"example": "https://xxxx/image.jpg, https://xxxx/image.jpg?token=xxx",
|
4134
4128
|
"member": "string",
|
4135
4129
|
"name": "BackgroundImageUrl",
|
4136
4130
|
"required": false,
|
4137
|
-
"type": "string"
|
4138
|
-
"value_allowed_null": false
|
4131
|
+
"type": "string"
|
4139
4132
|
},
|
4140
4133
|
{
|
4141
4134
|
"disabled": false,
|
@@ -4144,8 +4137,7 @@
|
|
4144
4137
|
"member": "uint64",
|
4145
4138
|
"name": "PlaceHolderMode",
|
4146
4139
|
"required": false,
|
4147
|
-
"type": "int"
|
4148
|
-
"value_allowed_null": false
|
4140
|
+
"type": "int"
|
4149
4141
|
},
|
4150
4142
|
{
|
4151
4143
|
"disabled": false,
|
@@ -4154,18 +4146,16 @@
|
|
4154
4146
|
"member": "uint64",
|
4155
4147
|
"name": "BackgroundImageRenderMode",
|
4156
4148
|
"required": false,
|
4157
|
-
"type": "int"
|
4158
|
-
"value_allowed_null": false
|
4149
|
+
"type": "int"
|
4159
4150
|
},
|
4160
4151
|
{
|
4161
4152
|
"disabled": false,
|
4162
|
-
"document": "子画面占位图url
|
4163
|
-
"example": "https://xxxx",
|
4153
|
+
"document": "子画面占位图url地址,只支持jpg, png, jpeg,大小限制不超过5M。注意,url必须携带格式后缀,url内只支持特定的字符串, 范围是a-z A-Z 0-9 '-', '.', '_', '~', ':', '/', '?', '#', '[', ']' '@', '!', '&', '(', ')', '*', '+', ',', '%', '='",
|
4154
|
+
"example": "https://xxxx/image.jpg, https://xxxx/image.jpg?token=xxx",
|
4164
4155
|
"member": "string",
|
4165
4156
|
"name": "DefaultSubBackgroundImage",
|
4166
4157
|
"required": false,
|
4167
|
-
"type": "string"
|
4168
|
-
"value_allowed_null": false
|
4158
|
+
"type": "string"
|
4169
4159
|
},
|
4170
4160
|
{
|
4171
4161
|
"disabled": false,
|
@@ -4174,8 +4164,7 @@
|
|
4174
4164
|
"member": "WaterMark",
|
4175
4165
|
"name": "WaterMarkList",
|
4176
4166
|
"required": false,
|
4177
|
-
"type": "list"
|
4178
|
-
"value_allowed_null": false
|
4167
|
+
"type": "list"
|
4179
4168
|
},
|
4180
4169
|
{
|
4181
4170
|
"disabled": false,
|
@@ -4184,8 +4173,7 @@
|
|
4184
4173
|
"member": "uint64",
|
4185
4174
|
"name": "RenderMode",
|
4186
4175
|
"required": false,
|
4187
|
-
"type": "int"
|
4188
|
-
"value_allowed_null": false
|
4176
|
+
"type": "int"
|
4189
4177
|
},
|
4190
4178
|
{
|
4191
4179
|
"disabled": false,
|
@@ -4194,8 +4182,7 @@
|
|
4194
4182
|
"member": "uint64",
|
4195
4183
|
"name": "MaxResolutionUserAlign",
|
4196
4184
|
"required": false,
|
4197
|
-
"type": "int"
|
4198
|
-
"value_allowed_null": false
|
4185
|
+
"type": "int"
|
4199
4186
|
}
|
4200
4187
|
],
|
4201
4188
|
"usage": "in"
|
@@ -5762,7 +5749,7 @@
|
|
5762
5749
|
"type": "string"
|
5763
5750
|
},
|
5764
5751
|
{
|
5765
|
-
"disabled":
|
5752
|
+
"disabled": true,
|
5766
5753
|
"document": "【本字段已废弃】视频编码参数。可选,如果不填,保持原始流的参数。",
|
5767
5754
|
"example": "无",
|
5768
5755
|
"member": "VideoEncodeParams",
|
@@ -5771,7 +5758,7 @@
|
|
5771
5758
|
"type": "object"
|
5772
5759
|
},
|
5773
5760
|
{
|
5774
|
-
"disabled":
|
5761
|
+
"disabled": true,
|
5775
5762
|
"document": "【本字段已废弃】音频编码参数。可选,如果不填,保持原始流的参数。",
|
5776
5763
|
"example": "无",
|
5777
5764
|
"member": "AudioEncodeParams",
|
@@ -5780,7 +5767,7 @@
|
|
5780
5767
|
"type": "object"
|
5781
5768
|
},
|
5782
5769
|
{
|
5783
|
-
"disabled":
|
5770
|
+
"disabled": true,
|
5784
5771
|
"document": "【本字段已废弃,请使用 StreamUrl 字段】源流URL,支持一个地址。",
|
5785
5772
|
"example": "https://a.b/test.mp4",
|
5786
5773
|
"member": "string",
|
@@ -7060,13 +7047,12 @@
|
|
7060
7047
|
"members": [
|
7061
7048
|
{
|
7062
7049
|
"disabled": false,
|
7063
|
-
"document": "下载的url地址, 只支持jpg
|
7064
|
-
"example": "https://xxxx",
|
7050
|
+
"document": "下载的url地址, 只支持jpg, png, jpeg,大小限制不超过5M。注意,url必须携带格式后缀,url内只支持特定的字符串, 范围是a-z A-Z 0-9 '-', '.', '_', '~', ':', '/', '?', '#', '[', ']' '@', '!', '&', '(', ')', '*', '+', ',', '%', '='",
|
7051
|
+
"example": "https://xxxx/image.jpg, https://xxxx/image.jpg?token=xxx",
|
7065
7052
|
"member": "string",
|
7066
7053
|
"name": "WaterMarkUrl",
|
7067
7054
|
"required": true,
|
7068
|
-
"type": "string"
|
7069
|
-
"value_allowed_null": false
|
7055
|
+
"type": "string"
|
7070
7056
|
},
|
7071
7057
|
{
|
7072
7058
|
"disabled": false,
|
@@ -7075,8 +7061,7 @@
|
|
7075
7061
|
"member": "uint64",
|
7076
7062
|
"name": "Top",
|
7077
7063
|
"required": true,
|
7078
|
-
"type": "int"
|
7079
|
-
"value_allowed_null": false
|
7064
|
+
"type": "int"
|
7080
7065
|
},
|
7081
7066
|
{
|
7082
7067
|
"disabled": false,
|
@@ -7085,8 +7070,7 @@
|
|
7085
7070
|
"member": "uint64",
|
7086
7071
|
"name": "Left",
|
7087
7072
|
"required": true,
|
7088
|
-
"type": "int"
|
7089
|
-
"value_allowed_null": false
|
7073
|
+
"type": "int"
|
7090
7074
|
},
|
7091
7075
|
{
|
7092
7076
|
"disabled": false,
|
@@ -7095,8 +7079,7 @@
|
|
7095
7079
|
"member": "uint64",
|
7096
7080
|
"name": "Width",
|
7097
7081
|
"required": true,
|
7098
|
-
"type": "int"
|
7099
|
-
"value_allowed_null": false
|
7082
|
+
"type": "int"
|
7100
7083
|
},
|
7101
7084
|
{
|
7102
7085
|
"disabled": false,
|
@@ -7105,8 +7088,7 @@
|
|
7105
7088
|
"member": "uint64",
|
7106
7089
|
"name": "Height",
|
7107
7090
|
"required": true,
|
7108
|
-
"type": "int"
|
7109
|
-
"value_allowed_null": false
|
7091
|
+
"type": "int"
|
7110
7092
|
}
|
7111
7093
|
],
|
7112
7094
|
"usage": "in"
|
@@ -0,0 +1,301 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
import os
|
3
|
+
import sys
|
4
|
+
import six
|
5
|
+
import json
|
6
|
+
import tccli.options_define as OptionsDefine
|
7
|
+
import tccli.format_output as FormatOutput
|
8
|
+
from tccli import __version__
|
9
|
+
from tccli.utils import Utils
|
10
|
+
from tccli.exceptions import ConfigurationError, ClientError, ParamError
|
11
|
+
from tencentcloud.common import credential
|
12
|
+
from tencentcloud.common.profile.http_profile import HttpProfile
|
13
|
+
from tencentcloud.common.profile.client_profile import ClientProfile
|
14
|
+
from tencentcloud.tsi.v20210325 import tsi_client as tsi_client_v20210325
|
15
|
+
from tencentcloud.tsi.v20210325 import models as models_v20210325
|
16
|
+
|
17
|
+
from jmespath import search
|
18
|
+
import time
|
19
|
+
|
20
|
+
def doTongChuanRecognize(args, parsed_globals):
|
21
|
+
g_param = parse_global_arg(parsed_globals)
|
22
|
+
|
23
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
24
|
+
cred = credential.CVMRoleCredential()
|
25
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
26
|
+
cred = credential.STSAssumeRoleCredential(
|
27
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
28
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
29
|
+
)
|
30
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
31
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
32
|
+
else:
|
33
|
+
cred = credential.Credential(
|
34
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
35
|
+
)
|
36
|
+
http_profile = HttpProfile(
|
37
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
38
|
+
reqMethod="POST",
|
39
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
40
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
41
|
+
)
|
42
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
43
|
+
if g_param[OptionsDefine.Language]:
|
44
|
+
profile.language = g_param[OptionsDefine.Language]
|
45
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
46
|
+
client = mod.TsiClient(cred, g_param[OptionsDefine.Region], profile)
|
47
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
48
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
49
|
+
model = models.TongChuanRecognizeRequest()
|
50
|
+
model.from_json_string(json.dumps(args))
|
51
|
+
start_time = time.time()
|
52
|
+
while True:
|
53
|
+
rsp = client.TongChuanRecognize(model)
|
54
|
+
result = rsp.to_json_string()
|
55
|
+
try:
|
56
|
+
json_obj = json.loads(result)
|
57
|
+
except TypeError as e:
|
58
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
59
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
60
|
+
break
|
61
|
+
cur_time = time.time()
|
62
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
63
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
64
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
65
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
66
|
+
else:
|
67
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
68
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
69
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
70
|
+
|
71
|
+
|
72
|
+
def doTongChuanDisplay(args, parsed_globals):
|
73
|
+
g_param = parse_global_arg(parsed_globals)
|
74
|
+
|
75
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
76
|
+
cred = credential.CVMRoleCredential()
|
77
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
78
|
+
cred = credential.STSAssumeRoleCredential(
|
79
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
80
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
81
|
+
)
|
82
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
83
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
84
|
+
else:
|
85
|
+
cred = credential.Credential(
|
86
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
87
|
+
)
|
88
|
+
http_profile = HttpProfile(
|
89
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
90
|
+
reqMethod="POST",
|
91
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
92
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
93
|
+
)
|
94
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
95
|
+
if g_param[OptionsDefine.Language]:
|
96
|
+
profile.language = g_param[OptionsDefine.Language]
|
97
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
98
|
+
client = mod.TsiClient(cred, g_param[OptionsDefine.Region], profile)
|
99
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
100
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
101
|
+
model = models.TongChuanDisplayRequest()
|
102
|
+
model.from_json_string(json.dumps(args))
|
103
|
+
start_time = time.time()
|
104
|
+
while True:
|
105
|
+
rsp = client.TongChuanDisplay(model)
|
106
|
+
result = rsp.to_json_string()
|
107
|
+
try:
|
108
|
+
json_obj = json.loads(result)
|
109
|
+
except TypeError as e:
|
110
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
111
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
112
|
+
break
|
113
|
+
cur_time = time.time()
|
114
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
115
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
116
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
117
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
118
|
+
else:
|
119
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
120
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
121
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
122
|
+
|
123
|
+
|
124
|
+
def doTongChuanSync(args, parsed_globals):
|
125
|
+
g_param = parse_global_arg(parsed_globals)
|
126
|
+
|
127
|
+
if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
|
128
|
+
cred = credential.CVMRoleCredential()
|
129
|
+
elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
|
130
|
+
cred = credential.STSAssumeRoleCredential(
|
131
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
|
132
|
+
g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
|
133
|
+
)
|
134
|
+
elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_WEB_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
|
135
|
+
cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
|
136
|
+
else:
|
137
|
+
cred = credential.Credential(
|
138
|
+
g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
|
139
|
+
)
|
140
|
+
http_profile = HttpProfile(
|
141
|
+
reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
|
142
|
+
reqMethod="POST",
|
143
|
+
endpoint=g_param[OptionsDefine.Endpoint],
|
144
|
+
proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
|
145
|
+
)
|
146
|
+
profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
|
147
|
+
if g_param[OptionsDefine.Language]:
|
148
|
+
profile.language = g_param[OptionsDefine.Language]
|
149
|
+
mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
|
150
|
+
client = mod.TsiClient(cred, g_param[OptionsDefine.Region], profile)
|
151
|
+
client._sdkVersion += ("_CLI_" + __version__)
|
152
|
+
models = MODELS_MAP[g_param[OptionsDefine.Version]]
|
153
|
+
model = models.TongChuanSyncRequest()
|
154
|
+
model.from_json_string(json.dumps(args))
|
155
|
+
start_time = time.time()
|
156
|
+
while True:
|
157
|
+
rsp = client.TongChuanSync(model)
|
158
|
+
result = rsp.to_json_string()
|
159
|
+
try:
|
160
|
+
json_obj = json.loads(result)
|
161
|
+
except TypeError as e:
|
162
|
+
json_obj = json.loads(result.decode('utf-8')) # python3.3
|
163
|
+
if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
|
164
|
+
break
|
165
|
+
cur_time = time.time()
|
166
|
+
if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
|
167
|
+
raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
|
168
|
+
(g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
|
169
|
+
search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
|
170
|
+
else:
|
171
|
+
print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
|
172
|
+
time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
|
173
|
+
FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
|
174
|
+
|
175
|
+
|
176
|
+
CLIENT_MAP = {
|
177
|
+
"v20210325": tsi_client_v20210325,
|
178
|
+
|
179
|
+
}
|
180
|
+
|
181
|
+
MODELS_MAP = {
|
182
|
+
"v20210325": models_v20210325,
|
183
|
+
|
184
|
+
}
|
185
|
+
|
186
|
+
ACTION_MAP = {
|
187
|
+
"TongChuanRecognize": doTongChuanRecognize,
|
188
|
+
"TongChuanDisplay": doTongChuanDisplay,
|
189
|
+
"TongChuanSync": doTongChuanSync,
|
190
|
+
|
191
|
+
}
|
192
|
+
|
193
|
+
AVAILABLE_VERSION_LIST = [
|
194
|
+
"v20210325",
|
195
|
+
|
196
|
+
]
|
197
|
+
|
198
|
+
|
199
|
+
def action_caller():
|
200
|
+
return ACTION_MAP
|
201
|
+
|
202
|
+
|
203
|
+
def parse_global_arg(parsed_globals):
|
204
|
+
g_param = parsed_globals
|
205
|
+
|
206
|
+
is_exist_profile = True
|
207
|
+
if not parsed_globals["profile"]:
|
208
|
+
is_exist_profile = False
|
209
|
+
g_param["profile"] = os.environ.get("TCCLI_PROFILE", "default")
|
210
|
+
|
211
|
+
configure_path = os.path.join(os.path.expanduser("~"), ".tccli")
|
212
|
+
is_conf_exist, conf_path = Utils.file_existed(configure_path, g_param["profile"] + ".configure")
|
213
|
+
is_cred_exist, cred_path = Utils.file_existed(configure_path, g_param["profile"] + ".credential")
|
214
|
+
|
215
|
+
conf = {}
|
216
|
+
cred = {}
|
217
|
+
|
218
|
+
if is_conf_exist:
|
219
|
+
conf = Utils.load_json_msg(conf_path)
|
220
|
+
if is_cred_exist:
|
221
|
+
cred = Utils.load_json_msg(cred_path)
|
222
|
+
|
223
|
+
if not (isinstance(conf, dict) and isinstance(cred, dict)):
|
224
|
+
raise ConfigurationError(
|
225
|
+
"file: %s or %s is not json format"
|
226
|
+
% (g_param["profile"] + ".configure", g_param["profile"] + ".credential"))
|
227
|
+
|
228
|
+
if OptionsDefine.Token not in cred:
|
229
|
+
cred[OptionsDefine.Token] = None
|
230
|
+
|
231
|
+
if not is_exist_profile:
|
232
|
+
if os.environ.get(OptionsDefine.ENV_SECRET_ID) and os.environ.get(OptionsDefine.ENV_SECRET_KEY):
|
233
|
+
cred[OptionsDefine.SecretId] = os.environ.get(OptionsDefine.ENV_SECRET_ID)
|
234
|
+
cred[OptionsDefine.SecretKey] = os.environ.get(OptionsDefine.ENV_SECRET_KEY)
|
235
|
+
cred[OptionsDefine.Token] = os.environ.get(OptionsDefine.ENV_TOKEN)
|
236
|
+
|
237
|
+
if os.environ.get(OptionsDefine.ENV_REGION):
|
238
|
+
conf[OptionsDefine.SysParam][OptionsDefine.Region] = os.environ.get(OptionsDefine.ENV_REGION)
|
239
|
+
|
240
|
+
if os.environ.get(OptionsDefine.ENV_ROLE_ARN) and os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME):
|
241
|
+
cred[OptionsDefine.RoleArn] = os.environ.get(OptionsDefine.ENV_ROLE_ARN)
|
242
|
+
cred[OptionsDefine.RoleSessionName] = os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME)
|
243
|
+
|
244
|
+
for param in g_param.keys():
|
245
|
+
if g_param[param] is None:
|
246
|
+
if param in [OptionsDefine.SecretKey, OptionsDefine.SecretId, OptionsDefine.Token]:
|
247
|
+
if param in cred:
|
248
|
+
g_param[param] = cred[param]
|
249
|
+
elif not (g_param[OptionsDefine.UseCVMRole.replace('-', '_')]
|
250
|
+
or os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN)):
|
251
|
+
raise ConfigurationError("%s is invalid" % param)
|
252
|
+
elif param in [OptionsDefine.Region, OptionsDefine.Output, OptionsDefine.Language]:
|
253
|
+
if param in conf[OptionsDefine.SysParam]:
|
254
|
+
g_param[param] = conf[OptionsDefine.SysParam][param]
|
255
|
+
elif param != OptionsDefine.Language:
|
256
|
+
raise ConfigurationError("%s is invalid" % param)
|
257
|
+
elif param.replace('_', '-') in [OptionsDefine.RoleArn, OptionsDefine.RoleSessionName]:
|
258
|
+
if param.replace('_', '-') in cred:
|
259
|
+
g_param[param] = cred[param.replace('_', '-')]
|
260
|
+
|
261
|
+
try:
|
262
|
+
if g_param[OptionsDefine.ServiceVersion]:
|
263
|
+
g_param[OptionsDefine.Version] = "v" + g_param[OptionsDefine.ServiceVersion].replace('-', '')
|
264
|
+
else:
|
265
|
+
version = conf["tsi"][OptionsDefine.Version]
|
266
|
+
g_param[OptionsDefine.Version] = "v" + version.replace('-', '')
|
267
|
+
|
268
|
+
if g_param[OptionsDefine.Endpoint] is None:
|
269
|
+
g_param[OptionsDefine.Endpoint] = conf["tsi"][OptionsDefine.Endpoint]
|
270
|
+
g_param["sts_cred_endpoint"] = conf.get("sts", {}).get("endpoint")
|
271
|
+
except Exception as err:
|
272
|
+
raise ConfigurationError("config file:%s error, %s" % (conf_path, str(err)))
|
273
|
+
|
274
|
+
if g_param[OptionsDefine.Version] not in AVAILABLE_VERSION_LIST:
|
275
|
+
raise Exception("available versions: %s" % " ".join(AVAILABLE_VERSION_LIST))
|
276
|
+
|
277
|
+
if g_param[OptionsDefine.Waiter]:
|
278
|
+
param = eval(g_param[OptionsDefine.Waiter])
|
279
|
+
if 'expr' not in param:
|
280
|
+
raise Exception('`expr` in `--waiter` must be defined')
|
281
|
+
if 'to' not in param:
|
282
|
+
raise Exception('`to` in `--waiter` must be defined')
|
283
|
+
if 'timeout' not in param:
|
284
|
+
if 'waiter' in conf and 'timeout' in conf['waiter']:
|
285
|
+
param['timeout'] = conf['waiter']['timeout']
|
286
|
+
else:
|
287
|
+
param['timeout'] = 180
|
288
|
+
if 'interval' not in param:
|
289
|
+
if 'waiter' in conf and 'interval' in conf['waiter']:
|
290
|
+
param['interval'] = conf['waiter']['interval']
|
291
|
+
else:
|
292
|
+
param['interval'] = 5
|
293
|
+
param['interval'] = min(param['interval'], param['timeout'])
|
294
|
+
g_param['OptionsDefine.WaiterInfo'] = param
|
295
|
+
|
296
|
+
if six.PY2:
|
297
|
+
for key, value in g_param.items():
|
298
|
+
if isinstance(value, six.text_type):
|
299
|
+
g_param[key] = value.encode('utf-8')
|
300
|
+
return g_param
|
301
|
+
|