tccli 3.0.898.1__py2.py3-none-any.whl → 3.0.899.1__py2.py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. tccli/__init__.py +1 -1
  2. tccli/examples/cfs/v20190719/CreateMigrationTask.md +1 -1
  3. tccli/examples/cfs/v20190719/DeleteMigrationTask.md +1 -1
  4. tccli/examples/cfs/v20190719/ModifyFileSystemAutoScaleUpRule.md +1 -1
  5. tccli/examples/cfs/v20190719/ScaleUpFileSystem.md +1 -1
  6. tccli/examples/cls/v20201016/DeleteShipper.md +2 -2
  7. tccli/examples/cls/v20201016/ModifyShipper.md +2 -2
  8. tccli/examples/live/v20180801/DescribeLiveDomains.md +1 -1
  9. tccli/examples/nlp/v20190408/AnalyzeSentiment.md +24 -0
  10. tccli/examples/nlp/v20190408/ClassifyContent.md +39 -0
  11. tccli/examples/nlp/v20190408/ComposeCouplet.md +27 -0
  12. tccli/examples/nlp/v20190408/ComposePoetry.md +29 -0
  13. tccli/examples/waf/v20180125/ModifySpartaProtection.md +154 -0
  14. tccli/examples/wedata/v20210820/DescribeDimensionScore.md +15 -3
  15. tccli/examples/wedata/v20210820/DescribeQualityScore.md +1 -1
  16. tccli/examples/wedata/v20210820/DescribeQualityScoreTrend.md +10 -2
  17. tccli/examples/wedata/v20210820/DescribeTableQualityDetails.md +1 -1
  18. tccli/examples/wedata/v20210820/DescribeTableScoreTrend.md +10 -2
  19. tccli/services/antiddos/v20200309/api.json +45 -26
  20. tccli/services/apigateway/v20180808/api.json +17 -28
  21. tccli/services/asr/v20190614/api.json +3 -2
  22. tccli/services/cdb/v20170320/api.json +16 -11
  23. tccli/services/cfs/v20190719/api.json +7 -0
  24. tccli/services/cfs/v20190719/examples.json +4 -4
  25. tccli/services/ckafka/v20190819/api.json +20 -8
  26. tccli/services/cls/v20201016/api.json +3 -4
  27. tccli/services/cls/v20201016/examples.json +4 -4
  28. tccli/services/ess/v20201111/api.json +2 -0
  29. tccli/services/live/v20180801/api.json +4 -11
  30. tccli/services/live/v20180801/examples.json +1 -1
  31. tccli/services/nlp/nlp_client.py +216 -4
  32. tccli/services/nlp/v20190408/api.json +329 -0
  33. tccli/services/nlp/v20190408/examples.json +32 -0
  34. tccli/services/tbaas/v20180416/api.json +16 -16
  35. tccli/services/tdid/tdid_client.py +0 -106
  36. tccli/services/tdid/v20210519/api.json +25 -306
  37. tccli/services/tdid/v20210519/examples.json +0 -16
  38. tccli/services/tts/v20190823/api.json +7 -3
  39. tccli/services/waf/v20180125/api.json +401 -0
  40. tccli/services/waf/v20180125/examples.json +26 -0
  41. tccli/services/waf/waf_client.py +57 -4
  42. tccli/services/wedata/v20210820/api.json +151 -83
  43. tccli/services/wedata/v20210820/examples.json +8 -8
  44. {tccli-3.0.898.1.dist-info → tccli-3.0.899.1.dist-info}/METADATA +2 -2
  45. {tccli-3.0.898.1.dist-info → tccli-3.0.899.1.dist-info}/RECORD +48 -43
  46. {tccli-3.0.898.1.dist-info → tccli-3.0.899.1.dist-info}/WHEEL +0 -0
  47. {tccli-3.0.898.1.dist-info → tccli-3.0.899.1.dist-info}/entry_points.txt +0 -0
  48. {tccli-3.0.898.1.dist-info → tccli-3.0.899.1.dist-info}/license_files/LICENSE +0 -0
@@ -50,7 +50,7 @@
50
50
  ],
51
51
  "CreateMigrationTask": [
52
52
  {
53
- "document": "用于创建数据迁移任务,需开启白名单后才能使用。",
53
+ "document": "用于创建数据迁移任务",
54
54
  "input": "POST / HTTP/1.1\nHost: cfs.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: CreateMigrationTask\n<公共请求参数>\n\n{\n \"BucketRegion\": \"ap-nanjing\",\n \"SrcService\": \"COS\",\n \"CoverType\": \"1\",\n \"SrcSecretKey\": \"*****************************\",\n \"BucketPath\": \"cos/\",\n \"MigrationMode\": \"0\",\n \"FileSystemId\": \"cfs-8dd58fd7\",\n \"BucketName\": \"test-1-1256238147\",\n \"FsPath\": \"/test/\",\n \"MigrationType\": \"0\",\n \"TaskName\": \"test\",\n \"SrcSecretId\": \"**************************************************\",\n \"FsName\": \"test\"\n}",
55
55
  "output": "{\n \"Response\": {\n \"TaskId\": \"cfsmigrate-dfe9b1f2\",\n \"RequestId\": \"91cd4a08-a105-4c59-b229-82f0fs7363b8\"\n }\n}",
56
56
  "title": "创建迁移任务"
@@ -101,7 +101,7 @@
101
101
  "document": "用于删除数据迁移任务",
102
102
  "input": "POST / HTTP/1.1\nHost: cfs.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: DeleteMigrationTask\n<公共请求参数>\n\n{\n \"TaskId\": \"cfsmigrate-4e78dae8\"\n}",
103
103
  "output": "{\n \"Response\": {\n \"RequestId\": \"b72e3de2-6770-4388-af42-7e511935ad8e\"\n }\n}",
104
- "title": "删除迁移"
104
+ "title": "删除迁移任务"
105
105
  }
106
106
  ],
107
107
  "DeleteMountTarget": [
@@ -237,7 +237,7 @@
237
237
  "document": "更新文件系统自动扩容策略",
238
238
  "input": "POST / HTTP/1.1\nHost: cfs.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: ModifyCFSFileSystemAutoScaleRule\n<公共请求参数>\n\n{\n \"FileSystemId\": \"cfs-agaga\",\n \"Status\": 1,\n \"ScaleUpThreshold\": 85,\n \"TargetThreshold\": 70\n}",
239
239
  "output": "{\n \"Response\": {\n \"RequestId\": \"gagagagad-xdx\",\n \"FileSystemId\": \"cfs-agaga\",\n \"Status\": 1,\n \"ScaleUpThreshold\": 85,\n \"TargetThreshold\": 70\n }\n}",
240
- "title": "ModifyCFSFileSystemAutoScaleRule"
240
+ "title": "更新文件系统自动扩容策略"
241
241
  }
242
242
  ],
243
243
  "ScaleUpFileSystem": [
@@ -245,7 +245,7 @@
245
245
  "document": "扩容文件系统",
246
246
  "input": "POST / HTTP/1.1\nHost: cfs.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: UpgradeCFSFileSystem\n<公共请求参数>\n\n{\n \"FileSystemId\": \"cfs-agagag\",\n \"TargetCapacity\": 1\n}",
247
247
  "output": "{\n \"Response\": {\n \"RequestId\": \"agagaga-tatatatata-tatata\",\n \"FileSystemId\": \"cfs-agagag\",\n \"TargetCapacity\": 10\n }\n}",
248
- "title": "UpgradeCFSFileSystem"
248
+ "title": "扩容文件系统"
249
249
  }
250
250
  ],
251
251
  "SetUserQuota": [
@@ -3528,7 +3528,7 @@
3528
3528
  },
3529
3529
  {
3530
3530
  "disabled": false,
3531
- "document": "实例版本。目前支持 \"0.10.2\",\"1.1.1\",\"2.4.2\",\"2.8.1\"",
3531
+ "document": "实例版本。目前支持 \"0.10.2\",\"1.1.1\",\"2.4.1\",\"2.4.2\",\"2.8.1\"。\"2.4.1\" 与 \"2.4.2\" 属于同一个版本,传任意一个均可。",
3532
3532
  "example": "2.4.2",
3533
3533
  "member": "string",
3534
3534
  "name": "KafkaVersion",
@@ -3618,7 +3618,7 @@
3618
3618
  },
3619
3619
  {
3620
3620
  "disabled": false,
3621
- "document": "公网带宽大小,单位 Mbps。默认是没有加上免费 3Mbps 带宽。例如总共需要 3Mbps 公网带宽,此处传 0;总共需要 4Mbps 公网带宽,此处传 1",
3621
+ "document": "公网带宽大小,单位 Mbps。默认是没有加上免费 3Mbps 带宽。例如总共需要 3Mbps 公网带宽,此处传 0;总共需要 6Mbps 公网带宽,此处传 3。需要保证传入参数为 3 的整数倍",
3622
3622
  "example": "12",
3623
3623
  "member": "int64",
3624
3624
  "name": "PublicNetworkMonthly",
@@ -3673,6 +3673,7 @@
3673
3673
  "example": "无",
3674
3674
  "member": "JgwOperateResponse",
3675
3675
  "name": "Result",
3676
+ "output_required": true,
3676
3677
  "type": "object",
3677
3678
  "value_allowed_null": false
3678
3679
  },
@@ -3772,7 +3773,7 @@
3772
3773
  },
3773
3774
  {
3774
3775
  "disabled": false,
3775
- "document": "vpcId,不填默认基础网络",
3776
+ "document": "vpcId必填",
3776
3777
  "example": "vpc-xxx",
3777
3778
  "member": "string",
3778
3779
  "name": "VpcId",
@@ -3817,8 +3818,8 @@
3817
3818
  },
3818
3819
  {
3819
3820
  "disabled": false,
3820
- "document": "CKafka版本号[0.10.2、1.1.1、2.4.1], 默认是1.1.1",
3821
- "example": "0.10.2/1.1.1/2.4.1",
3821
+ "document": "CKafka版本号[0.10.2、1.1.1、2.4.1、2.4.2、2.8.1], 默认是1.1.1。2.4.1 与 2.4.2 属于同一个版本,传任意一个均可。",
3822
+ "example": "1.1.1",
3822
3823
  "member": "string",
3823
3824
  "name": "KafkaVersion",
3824
3825
  "required": false,
@@ -3898,12 +3899,21 @@
3898
3899
  },
3899
3900
  {
3900
3901
  "disabled": false,
3901
- "document": "公网带宽大小,单位 Mbps。默认是没有加上免费 3Mbps 带宽。例如总共需要 3Mbps 公网带宽,此处传 0;总共需要 4Mbps 公网带宽,此处传 1。默认值为 0",
3902
+ "document": "公网带宽大小,单位 Mbps。默认是没有加上免费 3Mbps 带宽。例如总共需要 3Mbps 公网带宽,此处传 0;总共需要 6Mbps 公网带宽,此处传 3。默认值为 0。需要保证传入参数为 3 的整数倍",
3902
3903
  "example": "12",
3903
3904
  "member": "int64",
3904
3905
  "name": "PublicNetworkMonthly",
3905
3906
  "required": false,
3906
3907
  "type": "int"
3908
+ },
3909
+ {
3910
+ "disabled": false,
3911
+ "document": "购买实例数量。非必填,默认值为 1。当传入该参数时,会创建多个 instanceName 加后缀区分的实例",
3912
+ "example": "1",
3913
+ "member": "int64",
3914
+ "name": "InstanceNum",
3915
+ "required": false,
3916
+ "type": "int"
3907
3917
  }
3908
3918
  ],
3909
3919
  "type": "object"
@@ -3963,6 +3973,7 @@
3963
3973
  "example": "无",
3964
3974
  "member": "CreateInstancePreResp",
3965
3975
  "name": "Result",
3976
+ "output_required": true,
3966
3977
  "type": "object",
3967
3978
  "value_allowed_null": false
3968
3979
  },
@@ -4087,7 +4098,7 @@
4087
4098
  },
4088
4099
  {
4089
4100
  "disabled": false,
4090
- "document": "实例版本。目前支持 \"0.10.2\",\"1.1.1\",\"2.4.2\",\"2.8.1\"",
4101
+ "document": "实例版本。目前支持 \"0.10.2\",\"1.1.1\",\"2.4.1\",\"2.4.2\",\"2.8.1\"。\"2.4.1\" 与 \"2.4.2\" 属于同一个版本,传任意一个均可。",
4091
4102
  "example": "2.4.2",
4092
4103
  "member": "string",
4093
4104
  "name": "KafkaVersion",
@@ -4186,7 +4197,7 @@
4186
4197
  },
4187
4198
  {
4188
4199
  "disabled": false,
4189
- "document": "公网带宽大小,单位 Mbps。默认是没有加上免费 3Mbps 带宽。例如总共需要 3Mbps 公网带宽,此处传 0;总共需要 4Mbps 公网带宽,此处传 1",
4200
+ "document": "公网带宽大小,单位 Mbps。默认是没有加上免费 3Mbps 带宽。例如总共需要 3Mbps 公网带宽,此处传 0;总共需要 6Mbps 公网带宽,此处传 3。需要保证传入参数为 3 的整数倍",
4190
4201
  "example": "12",
4191
4202
  "member": "int64",
4192
4203
  "name": "PublicNetworkMonthly",
@@ -4205,6 +4216,7 @@
4205
4216
  "example": "无",
4206
4217
  "member": "CreateInstancePostResp",
4207
4218
  "name": "Result",
4219
+ "output_required": true,
4208
4220
  "type": "object",
4209
4221
  "value_allowed_null": false
4210
4222
  },
@@ -183,9 +183,9 @@
183
183
  "status": "online"
184
184
  },
185
185
  "DeleteShipper": {
186
- "document": "删除投递规则",
186
+ "document": "删除投递COS任务",
187
187
  "input": "DeleteShipperRequest",
188
- "name": "删除投递规则",
188
+ "name": "删除投递COS任务",
189
189
  "output": "DeleteShipperResponse",
190
190
  "status": "online"
191
191
  },
@@ -416,7 +416,7 @@
416
416
  "ModifyShipper": {
417
417
  "document": "修改现有的投递规则,客户如果使用此接口,需要自行处理CLS对指定bucket的写权限。",
418
418
  "input": "ModifyShipperRequest",
419
- "name": "修改投递规则",
419
+ "name": "修改投递COS任务",
420
420
  "output": "ModifyShipperResponse",
421
421
  "status": "online"
422
422
  },
@@ -3812,7 +3812,6 @@
3812
3812
  "document": "DeleteShipper请求参数结构体",
3813
3813
  "members": [
3814
3814
  {
3815
- "default": "",
3816
3815
  "disabled": false,
3817
3816
  "document": "投递规则ID",
3818
3817
  "example": "57f5808c-4a55-11eb-b378-0242ac130002",
@@ -210,10 +210,10 @@
210
210
  ],
211
211
  "DeleteShipper": [
212
212
  {
213
- "document": "",
213
+ "document": "删除投递COS任务",
214
214
  "input": "POST / HTTP/1.1\nHost: cls.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: DeleteShipper\n<公共请求参数>\n\n{\n \"ShipperId\": \"xxxxxxx-xxx-xxx-xxx-xxxxxxx\"\n}",
215
215
  "output": "{\n \"Response\": {\n \"RequestId\": \"6ef60bec-0242-43af-bb20-270359fb54a7\"\n }\n}",
216
- "title": "删除投递规则"
216
+ "title": "删除投递COS任务"
217
217
  }
218
218
  ],
219
219
  "DeleteTopic": [
@@ -474,10 +474,10 @@
474
474
  ],
475
475
  "ModifyShipper": [
476
476
  {
477
- "document": "修改cos投递规则",
477
+ "document": "修改投递COS任务",
478
478
  "input": "POST / HTTP/1.1\nHost: cls.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: ModifyShipper\n<公共请求参数>\n\n{\n \"ShipperId\": \"xxxx-xx-xx-xx-xxxxxxxx\",\n \"Bucket\": \"test-1250000001\",\n \"Prefix\": \"test\",\n \"ShipperName\": \"myname\",\n \"Interval\": 300,\n \"MaxSize\": 256,\n \"Partition\": \"%Y%m%d\",\n \"Compress\": {\n \"Format\": \"none\"\n },\n \"FilterRules\": [\n {\n \"Key\": \"\",\n \"Regex\": \"\",\n \"Value\": \"\"\n }\n ],\n \"FilenameMode\": 0\n}",
479
479
  "output": "{\n \"Response\": {\n \"RequestId\": \"6ef60bec-0242-43af-bb20-270359fb54a7\"\n }\n}",
480
- "title": "修改投递规则"
480
+ "title": "修改投递COS任务"
481
481
  }
482
482
  ],
483
483
  "ModifyTopic": [
@@ -8033,6 +8033,7 @@
8033
8033
  "example": "无",
8034
8034
  "member": "SuccessUpdateStaffData",
8035
8035
  "name": "SuccessEmployeeData",
8036
+ "output_required": true,
8036
8037
  "type": "list",
8037
8038
  "value_allowed_null": false
8038
8039
  },
@@ -8042,6 +8043,7 @@
8042
8043
  "example": "无",
8043
8044
  "member": "FailedUpdateStaffData",
8044
8045
  "name": "FailedEmployeeData",
8046
+ "output_required": true,
8045
8047
  "type": "list",
8046
8048
  "value_allowed_null": false
8047
8049
  },
@@ -6400,7 +6400,6 @@
6400
6400
  "document": "DescribeLiveDomains请求参数结构体",
6401
6401
  "members": [
6402
6402
  {
6403
- "default": "",
6404
6403
  "disabled": false,
6405
6404
  "document": "域名状态过滤。0-停用,1-启用。",
6406
6405
  "example": "1",
@@ -6410,7 +6409,6 @@
6410
6409
  "type": "int"
6411
6410
  },
6412
6411
  {
6413
- "default": "",
6414
6412
  "disabled": false,
6415
6413
  "document": "域名类型过滤。0-推流,1-播放。",
6416
6414
  "example": "1",
@@ -6420,7 +6418,6 @@
6420
6418
  "type": "int"
6421
6419
  },
6422
6420
  {
6423
- "default": "",
6424
6421
  "disabled": false,
6425
6422
  "document": "分页大小,范围:10~100。默认10。",
6426
6423
  "example": "10",
@@ -6430,7 +6427,6 @@
6430
6427
  "type": "int"
6431
6428
  },
6432
6429
  {
6433
- "default": "",
6434
6430
  "disabled": false,
6435
6431
  "document": "取第几页,范围:1~100000。默认1。",
6436
6432
  "example": "1",
@@ -6440,7 +6436,6 @@
6440
6436
  "type": "int"
6441
6437
  },
6442
6438
  {
6443
- "default": "",
6444
6439
  "disabled": false,
6445
6440
  "document": "0 普通直播 1慢直播 默认0。",
6446
6441
  "example": "0",
@@ -6450,7 +6445,6 @@
6450
6445
  "type": "int"
6451
6446
  },
6452
6447
  {
6453
- "default": "",
6454
6448
  "disabled": false,
6455
6449
  "document": "域名前缀。",
6456
6450
  "example": "qq",
@@ -6460,7 +6454,6 @@
6460
6454
  "type": "string"
6461
6455
  },
6462
6456
  {
6463
- "default": "",
6464
6457
  "disabled": false,
6465
6458
  "document": "播放区域,只在 DomainType=1 时该参数有意义。\n1: 国内。\n2: 全球。\n3: 海外。",
6466
6459
  "example": "1",
@@ -6481,7 +6474,7 @@
6481
6474
  "example": "2",
6482
6475
  "member": "uint64",
6483
6476
  "name": "AllCount",
6484
- "required": true,
6477
+ "output_required": true,
6485
6478
  "type": "int",
6486
6479
  "value_allowed_null": false
6487
6480
  },
@@ -6491,7 +6484,7 @@
6491
6484
  "example": "无",
6492
6485
  "member": "DomainInfo",
6493
6486
  "name": "DomainList",
6494
- "required": true,
6487
+ "output_required": true,
6495
6488
  "type": "list",
6496
6489
  "value_allowed_null": false
6497
6490
  },
@@ -6501,7 +6494,7 @@
6501
6494
  "example": "77",
6502
6495
  "member": "int64",
6503
6496
  "name": "CreateLimitCount",
6504
- "required": true,
6497
+ "output_required": true,
6505
6498
  "type": "int",
6506
6499
  "value_allowed_null": true
6507
6500
  },
@@ -6511,7 +6504,7 @@
6511
6504
  "example": "[1,0,3]",
6512
6505
  "member": "int64",
6513
6506
  "name": "PlayTypeCount",
6514
- "required": true,
6507
+ "output_required": true,
6515
6508
  "type": "list",
6516
6509
  "value_allowed_null": true
6517
6510
  },
@@ -546,7 +546,7 @@
546
546
  ],
547
547
  "DescribeLiveDomains": [
548
548
  {
549
- "document": "",
549
+ "document": "接入标签鉴权。",
550
550
  "input": "POST / HTTP/1.1\nHost: live.tencentcloudapi.com\nContent-Type: application/json\nX-TC-Action: DescribeLiveDomains\n<公共请求参数>\n\n{\n \"IsDelayLive\": \"0\",\n \"PageSize\": \"10\",\n \"PageNum\": \"1\",\n \"DomainStatus\": \"1\",\n \"DomainType\": \"1\"\n}",
551
551
  "output": "{\n \"Response\": {\n \"RequestId\": \"eac6b301-a322-493a-8e36-83b295459397\",\n \"AllCount\": 2,\n \"CreateLimitCount\": 0,\n \"PlayTypeCount\": [\n 1,\n 2,\n 3\n ],\n \"DomainList\": [\n {\n \"Name\": \"abc.com\",\n \"IsMiniProgramLive\": 0,\n \"Type\": 1,\n \"Status\": 1,\n \"PlayType\": 1,\n \"IsDelayLive\": 0,\n \"CreateTime\": \"2018-08-29 10:00:00\",\n \"BCName\": 1,\n \"CurrentCName\": \"\",\n \"TargetDomain\": \"abc.com.liveplay.myqcloud.com\",\n \"RentTag\": 0,\n \"RentExpireTime\": \"0000-00-00 00:00:00\"\n }\n ]\n }\n}",
552
552
  "title": "查询域名列表"
@@ -641,6 +641,58 @@ def doParseWords(args, parsed_globals):
641
641
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
642
642
 
643
643
 
644
+ def doComposeCouplet(args, parsed_globals):
645
+ g_param = parse_global_arg(parsed_globals)
646
+
647
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
648
+ cred = credential.CVMRoleCredential()
649
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
650
+ cred = credential.STSAssumeRoleCredential(
651
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
652
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')]
653
+ )
654
+ elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
655
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
656
+ else:
657
+ cred = credential.Credential(
658
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
659
+ )
660
+ http_profile = HttpProfile(
661
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
662
+ reqMethod="POST",
663
+ endpoint=g_param[OptionsDefine.Endpoint],
664
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
665
+ )
666
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
667
+ if g_param[OptionsDefine.Language]:
668
+ profile.language = g_param[OptionsDefine.Language]
669
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
670
+ client = mod.NlpClient(cred, g_param[OptionsDefine.Region], profile)
671
+ client._sdkVersion += ("_CLI_" + __version__)
672
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
673
+ model = models.ComposeCoupletRequest()
674
+ model.from_json_string(json.dumps(args))
675
+ start_time = time.time()
676
+ while True:
677
+ rsp = client.ComposeCouplet(model)
678
+ result = rsp.to_json_string()
679
+ try:
680
+ json_obj = json.loads(result)
681
+ except TypeError as e:
682
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
683
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
684
+ break
685
+ cur_time = time.time()
686
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
687
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
688
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
689
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
690
+ else:
691
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
692
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
693
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
694
+
695
+
644
696
  def doTextClassification(args, parsed_globals):
645
697
  g_param = parse_global_arg(parsed_globals)
646
698
 
@@ -1005,6 +1057,58 @@ def doGenerateCouplet(args, parsed_globals):
1005
1057
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1006
1058
 
1007
1059
 
1060
+ def doChatBot(args, parsed_globals):
1061
+ g_param = parse_global_arg(parsed_globals)
1062
+
1063
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
1064
+ cred = credential.CVMRoleCredential()
1065
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
1066
+ cred = credential.STSAssumeRoleCredential(
1067
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
1068
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')]
1069
+ )
1070
+ elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
1071
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
1072
+ else:
1073
+ cred = credential.Credential(
1074
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
1075
+ )
1076
+ http_profile = HttpProfile(
1077
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
1078
+ reqMethod="POST",
1079
+ endpoint=g_param[OptionsDefine.Endpoint],
1080
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
1081
+ )
1082
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
1083
+ if g_param[OptionsDefine.Language]:
1084
+ profile.language = g_param[OptionsDefine.Language]
1085
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
1086
+ client = mod.NlpClient(cred, g_param[OptionsDefine.Region], profile)
1087
+ client._sdkVersion += ("_CLI_" + __version__)
1088
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
1089
+ model = models.ChatBotRequest()
1090
+ model.from_json_string(json.dumps(args))
1091
+ start_time = time.time()
1092
+ while True:
1093
+ rsp = client.ChatBot(model)
1094
+ result = rsp.to_json_string()
1095
+ try:
1096
+ json_obj = json.loads(result)
1097
+ except TypeError as e:
1098
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
1099
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
1100
+ break
1101
+ cur_time = time.time()
1102
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
1103
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
1104
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
1105
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
1106
+ else:
1107
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
1108
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
1109
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1110
+
1111
+
1008
1112
  def doCreateWordItems(args, parsed_globals):
1009
1113
  g_param = parse_global_arg(parsed_globals)
1010
1114
 
@@ -1213,7 +1317,7 @@ def doSentimentAnalysis(args, parsed_globals):
1213
1317
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1214
1318
 
1215
1319
 
1216
- def doChatBot(args, parsed_globals):
1320
+ def doComposePoetry(args, parsed_globals):
1217
1321
  g_param = parse_global_arg(parsed_globals)
1218
1322
 
1219
1323
  if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
@@ -1242,11 +1346,11 @@ def doChatBot(args, parsed_globals):
1242
1346
  client = mod.NlpClient(cred, g_param[OptionsDefine.Region], profile)
1243
1347
  client._sdkVersion += ("_CLI_" + __version__)
1244
1348
  models = MODELS_MAP[g_param[OptionsDefine.Version]]
1245
- model = models.ChatBotRequest()
1349
+ model = models.ComposePoetryRequest()
1246
1350
  model.from_json_string(json.dumps(args))
1247
1351
  start_time = time.time()
1248
1352
  while True:
1249
- rsp = client.ChatBot(model)
1353
+ rsp = client.ComposePoetry(model)
1250
1354
  result = rsp.to_json_string()
1251
1355
  try:
1252
1356
  json_obj = json.loads(result)
@@ -1473,6 +1577,58 @@ def doTextEmbellish(args, parsed_globals):
1473
1577
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1474
1578
 
1475
1579
 
1580
+ def doClassifyContent(args, parsed_globals):
1581
+ g_param = parse_global_arg(parsed_globals)
1582
+
1583
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
1584
+ cred = credential.CVMRoleCredential()
1585
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
1586
+ cred = credential.STSAssumeRoleCredential(
1587
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
1588
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')]
1589
+ )
1590
+ elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
1591
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
1592
+ else:
1593
+ cred = credential.Credential(
1594
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
1595
+ )
1596
+ http_profile = HttpProfile(
1597
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
1598
+ reqMethod="POST",
1599
+ endpoint=g_param[OptionsDefine.Endpoint],
1600
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
1601
+ )
1602
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
1603
+ if g_param[OptionsDefine.Language]:
1604
+ profile.language = g_param[OptionsDefine.Language]
1605
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
1606
+ client = mod.NlpClient(cred, g_param[OptionsDefine.Region], profile)
1607
+ client._sdkVersion += ("_CLI_" + __version__)
1608
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
1609
+ model = models.ClassifyContentRequest()
1610
+ model.from_json_string(json.dumps(args))
1611
+ start_time = time.time()
1612
+ while True:
1613
+ rsp = client.ClassifyContent(model)
1614
+ result = rsp.to_json_string()
1615
+ try:
1616
+ json_obj = json.loads(result)
1617
+ except TypeError as e:
1618
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
1619
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
1620
+ break
1621
+ cur_time = time.time()
1622
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
1623
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
1624
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
1625
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
1626
+ else:
1627
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
1628
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
1629
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1630
+
1631
+
1476
1632
  def doTextCorrectionPro(args, parsed_globals):
1477
1633
  g_param = parse_global_arg(parsed_globals)
1478
1634
 
@@ -1681,6 +1837,58 @@ def doDeleteDict(args, parsed_globals):
1681
1837
  FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1682
1838
 
1683
1839
 
1840
+ def doAnalyzeSentiment(args, parsed_globals):
1841
+ g_param = parse_global_arg(parsed_globals)
1842
+
1843
+ if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
1844
+ cred = credential.CVMRoleCredential()
1845
+ elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
1846
+ cred = credential.STSAssumeRoleCredential(
1847
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
1848
+ g_param[OptionsDefine.RoleSessionName.replace('-', '_')]
1849
+ )
1850
+ elif os.getenv(OptionsDefine.ENV_TKE_REGION) and os.getenv(OptionsDefine.ENV_TKE_PROVIDER_ID) and os.getenv(OptionsDefine.ENV_TKE_IDENTITY_TOKEN_FILE) and os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN):
1851
+ cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
1852
+ else:
1853
+ cred = credential.Credential(
1854
+ g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
1855
+ )
1856
+ http_profile = HttpProfile(
1857
+ reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
1858
+ reqMethod="POST",
1859
+ endpoint=g_param[OptionsDefine.Endpoint],
1860
+ proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
1861
+ )
1862
+ profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
1863
+ if g_param[OptionsDefine.Language]:
1864
+ profile.language = g_param[OptionsDefine.Language]
1865
+ mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
1866
+ client = mod.NlpClient(cred, g_param[OptionsDefine.Region], profile)
1867
+ client._sdkVersion += ("_CLI_" + __version__)
1868
+ models = MODELS_MAP[g_param[OptionsDefine.Version]]
1869
+ model = models.AnalyzeSentimentRequest()
1870
+ model.from_json_string(json.dumps(args))
1871
+ start_time = time.time()
1872
+ while True:
1873
+ rsp = client.AnalyzeSentiment(model)
1874
+ result = rsp.to_json_string()
1875
+ try:
1876
+ json_obj = json.loads(result)
1877
+ except TypeError as e:
1878
+ json_obj = json.loads(result.decode('utf-8')) # python3.3
1879
+ if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
1880
+ break
1881
+ cur_time = time.time()
1882
+ if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
1883
+ raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
1884
+ (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
1885
+ search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
1886
+ else:
1887
+ print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
1888
+ time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
1889
+ FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
1890
+
1891
+
1684
1892
  def doSimilarWords(args, parsed_globals):
1685
1893
  g_param = parse_global_arg(parsed_globals)
1686
1894
 
@@ -1808,6 +2016,7 @@ ACTION_MAP = {
1808
2016
  "CreateDict": doCreateDict,
1809
2017
  "GeneratePoetry": doGeneratePoetry,
1810
2018
  "ParseWords": doParseWords,
2019
+ "ComposeCouplet": doComposeCouplet,
1811
2020
  "TextClassification": doTextClassification,
1812
2021
  "WordSimilarity": doWordSimilarity,
1813
2022
  "SentenceEmbedding": doSentenceEmbedding,
@@ -1815,19 +2024,22 @@ ACTION_MAP = {
1815
2024
  "TextCorrection": doTextCorrection,
1816
2025
  "EvaluateWordSimilarity": doEvaluateWordSimilarity,
1817
2026
  "GenerateCouplet": doGenerateCouplet,
2027
+ "ChatBot": doChatBot,
1818
2028
  "CreateWordItems": doCreateWordItems,
1819
2029
  "TextSimilarityPro": doTextSimilarityPro,
1820
2030
  "TextSimilarity": doTextSimilarity,
1821
2031
  "SentimentAnalysis": doSentimentAnalysis,
1822
- "ChatBot": doChatBot,
2032
+ "ComposePoetry": doComposePoetry,
1823
2033
  "LexicalAnalysis": doLexicalAnalysis,
1824
2034
  "RetrieveSimilarWords": doRetrieveSimilarWords,
1825
2035
  "KeywordsExtraction": doKeywordsExtraction,
1826
2036
  "TextEmbellish": doTextEmbellish,
2037
+ "ClassifyContent": doClassifyContent,
1827
2038
  "TextCorrectionPro": doTextCorrectionPro,
1828
2039
  "WordEmbedding": doWordEmbedding,
1829
2040
  "SentenceCorrection": doSentenceCorrection,
1830
2041
  "DeleteDict": doDeleteDict,
2042
+ "AnalyzeSentiment": doAnalyzeSentiment,
1831
2043
  "SimilarWords": doSimilarWords,
1832
2044
  "AutoSummarization": doAutoSummarization,
1833
2045