tccli 3.0.1348.1__py2.py3-none-any.whl → 3.0.1350.1__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. tccli/__init__.py +1 -1
  2. tccli/services/__init__.py +0 -76
  3. tccli/services/ai3d/v20250513/api.json +1 -1
  4. tccli/services/aiart/v20221229/api.json +2 -2
  5. tccli/services/autoscaling/v20180419/api.json +11 -0
  6. tccli/services/batch/v20170312/api.json +44 -0
  7. tccli/services/cdb/v20170320/api.json +8 -8
  8. tccli/services/cdb/v20170320/examples.json +1 -1
  9. tccli/services/cdn/v20180606/api.json +5 -5
  10. tccli/services/cdwch/v20200915/api.json +11 -1
  11. tccli/services/cdwdoris/v20211228/api.json +145 -7
  12. tccli/services/cfg/v20210820/api.json +20 -0
  13. tccli/services/cfs/v20190719/api.json +10 -10
  14. tccli/services/cfw/cfw_client.py +53 -0
  15. tccli/services/cfw/v20190904/api.json +272 -0
  16. tccli/services/cfw/v20190904/examples.json +8 -0
  17. tccli/services/ckafka/ckafka_client.py +0 -53
  18. tccli/services/ckafka/v20190819/api.json +0 -215
  19. tccli/services/ckafka/v20190819/examples.json +0 -8
  20. tccli/services/csip/csip_client.py +833 -144
  21. tccli/services/csip/v20221121/api.json +3304 -1436
  22. tccli/services/csip/v20221121/examples.json +105 -7
  23. tccli/services/ctem/v20231128/api.json +20 -0
  24. tccli/services/cvm/v20170312/api.json +3 -3
  25. tccli/services/cwp/v20180228/api.json +9 -0
  26. tccli/services/cwp/v20180228/examples.json +6 -0
  27. tccli/services/dts/v20211206/api.json +21 -1
  28. tccli/services/emr/v20190103/api.json +219 -4
  29. tccli/services/es/v20250101/api.json +22 -0
  30. tccli/services/ess/v20201111/api.json +10 -1
  31. tccli/services/essbasic/v20210526/api.json +3 -3
  32. tccli/services/faceid/v20180301/api.json +3 -3
  33. tccli/services/gs/v20191118/api.json +38 -0
  34. tccli/services/igtm/igtm_client.py +159 -0
  35. tccli/services/igtm/v20231024/api.json +577 -0
  36. tccli/services/igtm/v20231024/examples.json +24 -0
  37. tccli/services/iotexplorer/v20190423/api.json +3 -3
  38. tccli/services/lcic/lcic_client.py +53 -0
  39. tccli/services/lcic/v20220817/api.json +53 -0
  40. tccli/services/lcic/v20220817/examples.json +8 -0
  41. tccli/services/live/live_client.py +224 -65
  42. tccli/services/live/v20180801/api.json +275 -1
  43. tccli/services/live/v20180801/examples.json +25 -1
  44. tccli/services/lke/v20231130/api.json +248 -2
  45. tccli/services/lke/v20231130/examples.json +1 -1
  46. tccli/services/lkeap/v20240522/api.json +1 -1
  47. tccli/services/mrs/v20200910/api.json +10 -0
  48. tccli/services/nlp/nlp_client.py +4 -322
  49. tccli/services/nlp/v20190408/api.json +0 -459
  50. tccli/services/nlp/v20190408/examples.json +0 -48
  51. tccli/services/ocr/v20181119/api.json +60 -5
  52. tccli/services/omics/v20221128/api.json +41 -3
  53. tccli/services/redis/v20180412/api.json +6 -6
  54. tccli/services/redis/v20180412/examples.json +1 -1
  55. tccli/services/ses/v20201002/api.json +100 -5
  56. tccli/services/tcb/v20180608/api.json +1 -1
  57. tccli/services/tcb/v20180608/examples.json +1 -1
  58. tccli/services/tdmq/v20200217/api.json +19 -0
  59. tccli/services/teo/teo_client.py +281 -16
  60. tccli/services/teo/v20220901/api.json +611 -6
  61. tccli/services/teo/v20220901/examples.json +48 -2
  62. tccli/services/tione/v20211111/api.json +16 -0
  63. tccli/services/tke/tke_client.py +57 -4
  64. tccli/services/tke/v20180525/api.json +24 -24
  65. tccli/services/tke/v20220501/api.json +52 -0
  66. tccli/services/tke/v20220501/examples.json +8 -0
  67. tccli/services/tmt/v20180321/api.json +4 -4
  68. tccli/services/tsf/v20180326/api.json +4 -4
  69. tccli/services/vclm/v20240523/api.json +2 -2
  70. tccli/services/vod/v20180717/api.json +5 -5
  71. tccli/services/vod/v20180717/examples.json +9 -9
  72. tccli/services/vpc/v20170312/api.json +1 -1
  73. tccli/services/vrs/v20200824/api.json +1 -1
  74. {tccli-3.0.1348.1.dist-info → tccli-3.0.1350.1.dist-info}/METADATA +2 -2
  75. {tccli-3.0.1348.1.dist-info → tccli-3.0.1350.1.dist-info}/RECORD +78 -180
  76. tccli/services/cis/__init__.py +0 -4
  77. tccli/services/cis/cis_client.py +0 -525
  78. tccli/services/cis/v20180408/api.json +0 -737
  79. tccli/services/cis/v20180408/examples.json +0 -93
  80. tccli/services/dataintegration/__init__.py +0 -4
  81. tccli/services/dataintegration/dataintegration_client.py +0 -207
  82. tccli/services/dataintegration/v20220613/api.json +0 -87
  83. tccli/services/dataintegration/v20220613/examples.json +0 -13
  84. tccli/services/dtf/__init__.py +0 -4
  85. tccli/services/dtf/dtf_client.py +0 -207
  86. tccli/services/dtf/v20200506/api.json +0 -274
  87. tccli/services/dtf/v20200506/examples.json +0 -13
  88. tccli/services/gpm/__init__.py +0 -4
  89. tccli/services/gpm/gpm_client.py +0 -1108
  90. tccli/services/gpm/v20200820/api.json +0 -1959
  91. tccli/services/gpm/v20200820/examples.json +0 -149
  92. tccli/services/gse/__init__.py +0 -4
  93. tccli/services/gse/gse_client.py +0 -4076
  94. tccli/services/gse/v20191112/api.json +0 -7095
  95. tccli/services/gse/v20191112/examples.json +0 -615
  96. tccli/services/iecp/__init__.py +0 -4
  97. tccli/services/iecp/iecp_client.py +0 -4500
  98. tccli/services/iecp/v20210914/api.json +0 -9770
  99. tccli/services/iecp/v20210914/examples.json +0 -691
  100. tccli/services/iir/__init__.py +0 -4
  101. tccli/services/iir/iir_client.py +0 -207
  102. tccli/services/iir/v20200417/api.json +0 -204
  103. tccli/services/iir/v20200417/examples.json +0 -13
  104. tccli/services/iottid/__init__.py +0 -4
  105. tccli/services/iottid/iottid_client.py +0 -631
  106. tccli/services/iottid/v20190411/api.json +0 -553
  107. tccli/services/iottid/v20190411/examples.json +0 -95
  108. tccli/services/mgobe/__init__.py +0 -4
  109. tccli/services/mgobe/mgobe_client.py +0 -530
  110. tccli/services/mgobe/v20190929/api.json +0 -52
  111. tccli/services/mgobe/v20190929/examples.json +0 -13
  112. tccli/services/mgobe/v20201014/api.json +0 -671
  113. tccli/services/mgobe/v20201014/examples.json +0 -61
  114. tccli/services/mvj/__init__.py +0 -4
  115. tccli/services/mvj/mvj_client.py +0 -207
  116. tccli/services/mvj/v20190926/api.json +0 -123
  117. tccli/services/mvj/v20190926/examples.json +0 -19
  118. tccli/services/pds/__init__.py +0 -4
  119. tccli/services/pds/pds_client.py +0 -260
  120. tccli/services/pds/v20210701/api.json +0 -193
  121. tccli/services/pds/v20210701/examples.json +0 -21
  122. tccli/services/smpn/__init__.py +0 -4
  123. tccli/services/smpn/smpn_client.py +0 -260
  124. tccli/services/smpn/v20190822/api.json +0 -191
  125. tccli/services/smpn/v20190822/examples.json +0 -21
  126. tccli/services/solar/__init__.py +0 -4
  127. tccli/services/solar/solar_client.py +0 -1055
  128. tccli/services/solar/v20181011/api.json +0 -1760
  129. tccli/services/solar/v20181011/examples.json +0 -125
  130. tccli/services/tan/__init__.py +0 -4
  131. tccli/services/tan/tan_client.py +0 -207
  132. tccli/services/tan/v20220420/api.json +0 -65
  133. tccli/services/tan/v20220420/examples.json +0 -19
  134. tccli/services/tav/__init__.py +0 -4
  135. tccli/services/tav/tav_client.py +0 -366
  136. tccli/services/tav/v20190118/api.json +0 -262
  137. tccli/services/tav/v20190118/examples.json +0 -37
  138. tccli/services/tbm/__init__.py +0 -4
  139. tccli/services/tbm/tbm_client.py +0 -631
  140. tccli/services/tbm/v20180129/api.json +0 -1037
  141. tccli/services/tbm/v20180129/examples.json +0 -77
  142. tccli/services/tcex/__init__.py +0 -4
  143. tccli/services/tcex/tcex_client.py +0 -260
  144. tccli/services/tcex/v20200727/api.json +0 -158
  145. tccli/services/tcex/v20200727/examples.json +0 -21
  146. tccli/services/tci/__init__.py +0 -4
  147. tccli/services/tci/tci_client.py +0 -2327
  148. tccli/services/tci/v20190318/api.json +0 -4958
  149. tccli/services/tci/v20190318/examples.json +0 -333
  150. tccli/services/tic/__init__.py +0 -4
  151. tccli/services/tic/tic_client.py +0 -843
  152. tccli/services/tic/v20201117/api.json +0 -1067
  153. tccli/services/tic/v20201117/examples.json +0 -121
  154. tccli/services/ticm/__init__.py +0 -4
  155. tccli/services/ticm/ticm_client.py +0 -313
  156. tccli/services/ticm/v20181127/api.json +0 -1391
  157. tccli/services/ticm/v20181127/examples.json +0 -53
  158. tccli/services/tics/__init__.py +0 -4
  159. tccli/services/tics/tics_client.py +0 -366
  160. tccli/services/tics/v20181115/api.json +0 -694
  161. tccli/services/tics/v20181115/examples.json +0 -37
  162. tccli/services/tiems/__init__.py +0 -4
  163. tccli/services/tiems/tiems_client.py +0 -1479
  164. tccli/services/tiems/v20190416/api.json +0 -3144
  165. tccli/services/tiems/v20190416/examples.json +0 -217
  166. tccli/services/trdp/__init__.py +0 -4
  167. tccli/services/trdp/trdp_client.py +0 -207
  168. tccli/services/trdp/v20220726/api.json +0 -843
  169. tccli/services/trdp/v20220726/examples.json +0 -13
  170. tccli/services/ump/__init__.py +0 -4
  171. tccli/services/ump/ump_client.py +0 -1055
  172. tccli/services/ump/v20200918/api.json +0 -2168
  173. tccli/services/ump/v20200918/examples.json +0 -141
  174. tccli/services/youmall/__init__.py +0 -4
  175. tccli/services/youmall/v20180228/api.json +0 -3572
  176. tccli/services/youmall/v20180228/examples.json +0 -313
  177. tccli/services/youmall/youmall_client.py +0 -1797
  178. {tccli-3.0.1348.1.dist-info → tccli-3.0.1350.1.dist-info}/WHEEL +0 -0
  179. {tccli-3.0.1348.1.dist-info → tccli-3.0.1350.1.dist-info}/entry_points.txt +0 -0
  180. {tccli-3.0.1348.1.dist-info → tccli-3.0.1350.1.dist-info}/license_files/LICENSE +0 -0
@@ -1,366 +0,0 @@
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.tav.v20190118 import tav_client as tav_client_v20190118
15
- from tencentcloud.tav.v20190118 import models as models_v20190118
16
-
17
- from jmespath import search
18
- import time
19
-
20
- def doGetScanResult(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.TavClient(cred, g_param[OptionsDefine.Region], profile)
47
- client._sdkVersion += ("_CLI_" + __version__)
48
- models = MODELS_MAP[g_param[OptionsDefine.Version]]
49
- model = models.GetScanResultRequest()
50
- model.from_json_string(json.dumps(args))
51
- start_time = time.time()
52
- while True:
53
- rsp = client.GetScanResult(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 doScanFile(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.TavClient(cred, g_param[OptionsDefine.Region], profile)
99
- client._sdkVersion += ("_CLI_" + __version__)
100
- models = MODELS_MAP[g_param[OptionsDefine.Version]]
101
- model = models.ScanFileRequest()
102
- model.from_json_string(json.dumps(args))
103
- start_time = time.time()
104
- while True:
105
- rsp = client.ScanFile(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 doGetLocalEngine(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.TavClient(cred, g_param[OptionsDefine.Region], profile)
151
- client._sdkVersion += ("_CLI_" + __version__)
152
- models = MODELS_MAP[g_param[OptionsDefine.Version]]
153
- model = models.GetLocalEngineRequest()
154
- model.from_json_string(json.dumps(args))
155
- start_time = time.time()
156
- while True:
157
- rsp = client.GetLocalEngine(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
- def doScanFileHash(args, parsed_globals):
177
- g_param = parse_global_arg(parsed_globals)
178
-
179
- if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
180
- cred = credential.CVMRoleCredential()
181
- elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
182
- cred = credential.STSAssumeRoleCredential(
183
- g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
184
- g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
185
- )
186
- 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):
187
- cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
188
- else:
189
- cred = credential.Credential(
190
- g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
191
- )
192
- http_profile = HttpProfile(
193
- reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
194
- reqMethod="POST",
195
- endpoint=g_param[OptionsDefine.Endpoint],
196
- proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
197
- )
198
- profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
199
- if g_param[OptionsDefine.Language]:
200
- profile.language = g_param[OptionsDefine.Language]
201
- mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
202
- client = mod.TavClient(cred, g_param[OptionsDefine.Region], profile)
203
- client._sdkVersion += ("_CLI_" + __version__)
204
- models = MODELS_MAP[g_param[OptionsDefine.Version]]
205
- model = models.ScanFileHashRequest()
206
- model.from_json_string(json.dumps(args))
207
- start_time = time.time()
208
- while True:
209
- rsp = client.ScanFileHash(model)
210
- result = rsp.to_json_string()
211
- try:
212
- json_obj = json.loads(result)
213
- except TypeError as e:
214
- json_obj = json.loads(result.decode('utf-8')) # python3.3
215
- if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
216
- break
217
- cur_time = time.time()
218
- if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
219
- raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
220
- (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
221
- search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
222
- else:
223
- print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
224
- time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
225
- FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
226
-
227
-
228
- CLIENT_MAP = {
229
- "v20190118": tav_client_v20190118,
230
-
231
- }
232
-
233
- MODELS_MAP = {
234
- "v20190118": models_v20190118,
235
-
236
- }
237
-
238
- ACTION_MAP = {
239
- "GetScanResult": doGetScanResult,
240
- "ScanFile": doScanFile,
241
- "GetLocalEngine": doGetLocalEngine,
242
- "ScanFileHash": doScanFileHash,
243
-
244
- }
245
-
246
- AVAILABLE_VERSION_LIST = [
247
- "v20190118",
248
-
249
- ]
250
-
251
-
252
- def action_caller():
253
- return ACTION_MAP
254
-
255
-
256
- def parse_global_arg(parsed_globals):
257
- g_param = parsed_globals
258
- cvm_role_flag = True
259
- for param in parsed_globals.keys():
260
- if param in [OptionsDefine.SecretKey, OptionsDefine.SecretId, OptionsDefine.RoleArn,
261
- OptionsDefine.RoleSessionName]:
262
- if parsed_globals[param] is not None:
263
- cvm_role_flag = False
264
- break
265
- is_exist_profile = True
266
- if not parsed_globals["profile"]:
267
- is_exist_profile = False
268
- g_param["profile"] = os.environ.get("TCCLI_PROFILE", "default")
269
-
270
- configure_path = os.path.join(os.path.expanduser("~"), ".tccli")
271
- is_conf_exist, conf_path = Utils.file_existed(configure_path, g_param["profile"] + ".configure")
272
- is_cred_exist, cred_path = Utils.file_existed(configure_path, g_param["profile"] + ".credential")
273
-
274
- conf = {}
275
- cred = {}
276
-
277
- if is_conf_exist:
278
- conf = Utils.load_json_msg(conf_path)
279
- if is_cred_exist:
280
- cred = Utils.load_json_msg(cred_path)
281
-
282
- if not (isinstance(conf, dict) and isinstance(cred, dict)):
283
- raise ConfigurationError(
284
- "file: %s or %s is not json format"
285
- % (g_param["profile"] + ".configure", g_param["profile"] + ".credential"))
286
-
287
- if OptionsDefine.Token not in cred:
288
- cred[OptionsDefine.Token] = None
289
-
290
- if not is_exist_profile:
291
- if os.environ.get(OptionsDefine.ENV_SECRET_ID) and os.environ.get(OptionsDefine.ENV_SECRET_KEY):
292
- cred[OptionsDefine.SecretId] = os.environ.get(OptionsDefine.ENV_SECRET_ID)
293
- cred[OptionsDefine.SecretKey] = os.environ.get(OptionsDefine.ENV_SECRET_KEY)
294
- cred[OptionsDefine.Token] = os.environ.get(OptionsDefine.ENV_TOKEN)
295
- cvm_role_flag = False
296
-
297
- if os.environ.get(OptionsDefine.ENV_REGION):
298
- conf[OptionsDefine.SysParam][OptionsDefine.Region] = os.environ.get(OptionsDefine.ENV_REGION)
299
-
300
- if os.environ.get(OptionsDefine.ENV_ROLE_ARN) and os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME):
301
- cred[OptionsDefine.RoleArn] = os.environ.get(OptionsDefine.ENV_ROLE_ARN)
302
- cred[OptionsDefine.RoleSessionName] = os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME)
303
- cvm_role_flag = False
304
-
305
- if cvm_role_flag:
306
- if "type" in cred and cred["type"] == "cvm-role":
307
- g_param[OptionsDefine.UseCVMRole.replace('-', '_')] = True
308
-
309
- for param in g_param.keys():
310
- if g_param[param] is None:
311
- if param in [OptionsDefine.SecretKey, OptionsDefine.SecretId, OptionsDefine.Token]:
312
- if param in cred:
313
- g_param[param] = cred[param]
314
- elif not (g_param[OptionsDefine.UseCVMRole.replace('-', '_')]
315
- or os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN)):
316
- raise ConfigurationError("%s is invalid" % param)
317
- elif param in [OptionsDefine.Region, OptionsDefine.Output, OptionsDefine.Language]:
318
- if param in conf[OptionsDefine.SysParam]:
319
- g_param[param] = conf[OptionsDefine.SysParam][param]
320
- elif param != OptionsDefine.Language:
321
- raise ConfigurationError("%s is invalid" % param)
322
- elif param.replace('_', '-') in [OptionsDefine.RoleArn, OptionsDefine.RoleSessionName]:
323
- if param.replace('_', '-') in cred:
324
- g_param[param] = cred[param.replace('_', '-')]
325
-
326
- try:
327
- if g_param[OptionsDefine.ServiceVersion]:
328
- g_param[OptionsDefine.Version] = "v" + g_param[OptionsDefine.ServiceVersion].replace('-', '')
329
- else:
330
- version = conf["tav"][OptionsDefine.Version]
331
- g_param[OptionsDefine.Version] = "v" + version.replace('-', '')
332
-
333
- if g_param[OptionsDefine.Endpoint] is None:
334
- g_param[OptionsDefine.Endpoint] = conf["tav"][OptionsDefine.Endpoint]
335
- g_param["sts_cred_endpoint"] = conf.get("sts", {}).get("endpoint")
336
- except Exception as err:
337
- raise ConfigurationError("config file:%s error, %s" % (conf_path, str(err)))
338
-
339
- if g_param[OptionsDefine.Version] not in AVAILABLE_VERSION_LIST:
340
- raise Exception("available versions: %s" % " ".join(AVAILABLE_VERSION_LIST))
341
-
342
- if g_param[OptionsDefine.Waiter]:
343
- param = eval(g_param[OptionsDefine.Waiter])
344
- if 'expr' not in param:
345
- raise Exception('`expr` in `--waiter` must be defined')
346
- if 'to' not in param:
347
- raise Exception('`to` in `--waiter` must be defined')
348
- if 'timeout' not in param:
349
- if 'waiter' in conf and 'timeout' in conf['waiter']:
350
- param['timeout'] = conf['waiter']['timeout']
351
- else:
352
- param['timeout'] = 180
353
- if 'interval' not in param:
354
- if 'waiter' in conf and 'interval' in conf['waiter']:
355
- param['interval'] = conf['waiter']['interval']
356
- else:
357
- param['interval'] = 5
358
- param['interval'] = min(param['interval'], param['timeout'])
359
- g_param['OptionsDefine.WaiterInfo'] = param
360
-
361
- if six.PY2:
362
- for key, value in g_param.items():
363
- if isinstance(value, six.text_type):
364
- g_param[key] = value.encode('utf-8')
365
- return g_param
366
-
@@ -1,262 +0,0 @@
1
- {
2
- "actions": {
3
- "GetLocalEngine": {
4
- "document": "获取TAV本地引擎",
5
- "input": "GetLocalEngineRequest",
6
- "name": "本地引擎下载地址获取",
7
- "output": "GetLocalEngineResponse"
8
- },
9
- "GetScanResult": {
10
- "document": "tav文件上传扫描结果查询",
11
- "input": "GetScanResultRequest",
12
- "name": "文件上传扫描结果查询",
13
- "output": "GetScanResultResponse"
14
- },
15
- "ScanFile": {
16
- "document": "tav文件上传扫描",
17
- "input": "ScanFileRequest",
18
- "name": "文件上传扫描",
19
- "output": "ScanFileResponse"
20
- },
21
- "ScanFileHash": {
22
- "document": "通过文件哈希值获取文件黑白属性",
23
- "input": "ScanFileHashRequest",
24
- "name": "公有云查",
25
- "output": "ScanFileHashResponse"
26
- }
27
- },
28
- "metadata": {
29
- "apiVersion": "2019-01-18",
30
- "serviceNameCN": "文件检测",
31
- "serviceShortName": "tav"
32
- },
33
- "objects": {
34
- "GetLocalEngineRequest": {
35
- "document": "GetLocalEngine请求参数结构体",
36
- "members": [
37
- {
38
- "document": "购买服务后获得的授权信息,用于保证请求有效性",
39
- "member": "string",
40
- "name": "Key",
41
- "required": true,
42
- "type": "string"
43
- }
44
- ],
45
- "type": "object"
46
- },
47
- "GetLocalEngineResponse": {
48
- "document": "GetLocalEngine返回参数结构体",
49
- "members": [
50
- {
51
- "document": "接口调用状态,成功返回200,失败返回400",
52
- "member": "uint64",
53
- "name": "Status",
54
- "type": "int",
55
- "value_allowed_null": false
56
- },
57
- {
58
- "document": "接口调用描述信息,成功返回\"scan success\",失败返回\"scan error\"",
59
- "member": "string",
60
- "name": "Info",
61
- "type": "string",
62
- "value_allowed_null": false
63
- },
64
- {
65
- "document": "本地引擎下载地址",
66
- "member": "string",
67
- "name": "Data",
68
- "type": "string",
69
- "value_allowed_null": false
70
- },
71
- {
72
- "document": "唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。",
73
- "member": "string",
74
- "name": "RequestId",
75
- "type": "string"
76
- }
77
- ],
78
- "type": "object"
79
- },
80
- "GetScanResultRequest": {
81
- "document": "GetScanResult请求参数结构体",
82
- "members": [
83
- {
84
- "document": "购买服务后获得的授权信息,用于保证请求有效性",
85
- "member": "string",
86
- "name": "Key",
87
- "required": true,
88
- "type": "string"
89
- },
90
- {
91
- "document": "需要获取扫描接口的md5(只允许单个md5)",
92
- "member": "string",
93
- "name": "Md5",
94
- "required": true,
95
- "type": "string"
96
- }
97
- ],
98
- "type": "object"
99
- },
100
- "GetScanResultResponse": {
101
- "document": "GetScanResult返回参数结构体",
102
- "members": [
103
- {
104
- "document": "接口调用状态,成功返回200,失败返回400",
105
- "member": "uint64",
106
- "name": "Status",
107
- "type": "int",
108
- "value_allowed_null": false
109
- },
110
- {
111
- "document": "接口调用描述信息,成功返回\"scan success\",失败返回\"scan error\"",
112
- "member": "string",
113
- "name": "Info",
114
- "type": "string",
115
- "value_allowed_null": false
116
- },
117
- {
118
- "document": "实际结果信息,包括md5、scan_status、virus_name三个字段;virus_name报毒名:\"torjan.**\":黑样本的报毒名、\".\":样本不报毒、\"\" :样本无检出信息,需上传扫描;\nscan_status样本状态:-1无检出信息需上传扫描、0样本扫描中、1样本扫描结束且不报毒、2样本扫描结束且报黑、3样本下载失败;",
119
- "member": "string",
120
- "name": "Data",
121
- "type": "string",
122
- "value_allowed_null": false
123
- },
124
- {
125
- "document": "唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。",
126
- "member": "string",
127
- "name": "RequestId",
128
- "type": "string"
129
- }
130
- ],
131
- "type": "object"
132
- },
133
- "ScanFileHashRequest": {
134
- "document": "ScanFileHash请求参数结构体",
135
- "members": [
136
- {
137
- "document": "购买服务后获得的授权信息,用于保证请求有效性",
138
- "member": "string",
139
- "name": "Key",
140
- "required": true,
141
- "type": "string"
142
- },
143
- {
144
- "document": "需要查询的md5值(支持单个和多个,多个md5间用逗号分格)",
145
- "member": "string",
146
- "name": "Md5s",
147
- "required": true,
148
- "type": "string"
149
- },
150
- {
151
- "document": "保留字段默认填0",
152
- "member": "string",
153
- "name": "WithCategory",
154
- "required": true,
155
- "type": "string"
156
- },
157
- {
158
- "document": "松严规则控制字段默认填10(5-松、10-标准、15-严)",
159
- "member": "string",
160
- "name": "SensitiveLevel",
161
- "required": true,
162
- "type": "string"
163
- }
164
- ],
165
- "type": "object"
166
- },
167
- "ScanFileHashResponse": {
168
- "document": "ScanFileHash返回参数结构体",
169
- "members": [
170
- {
171
- "document": "接口调用状态,成功返回200,失败返回400",
172
- "member": "uint64",
173
- "name": "Status",
174
- "type": "int",
175
- "value_allowed_null": false
176
- },
177
- {
178
- "document": "接口调用描述信息,成功返回\"scan success\",失败返回\"scan error\"",
179
- "member": "string",
180
- "name": "Info",
181
- "type": "string",
182
- "value_allowed_null": false
183
- },
184
- {
185
- "document": "云查实际结果信息,包括md5、return_state、virus_state、virus_name字符逗号间隔; \nreturn_state查询状态:-1/0代表失败、1/2代表成功;\nvirus_state文状件态:0文件不存在、1白、2黑、3未知、4感染性、5低可信白;",
186
- "member": "string",
187
- "name": "Data",
188
- "type": "string",
189
- "value_allowed_null": false
190
- },
191
- {
192
- "document": "唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。",
193
- "member": "string",
194
- "name": "RequestId",
195
- "type": "string"
196
- }
197
- ],
198
- "type": "object"
199
- },
200
- "ScanFileRequest": {
201
- "document": "ScanFile请求参数结构体",
202
- "members": [
203
- {
204
- "document": "购买服务后获得的授权信息,用于保证请求有效性",
205
- "member": "string",
206
- "name": "Key",
207
- "required": true,
208
- "type": "string"
209
- },
210
- {
211
- "document": "文件下载url地址",
212
- "member": "string",
213
- "name": "Sample",
214
- "required": true,
215
- "type": "string"
216
- },
217
- {
218
- "document": "文件的md5值",
219
- "member": "string",
220
- "name": "Md5",
221
- "required": true,
222
- "type": "string"
223
- }
224
- ],
225
- "type": "object"
226
- },
227
- "ScanFileResponse": {
228
- "document": "ScanFile返回参数结构体",
229
- "members": [
230
- {
231
- "document": "接口调用状态,成功返回200,失败返回400",
232
- "member": "uint64",
233
- "name": "Status",
234
- "type": "int",
235
- "value_allowed_null": false
236
- },
237
- {
238
- "document": "接口调用描述信息,成功返回\"success\",失败返回\"invalid request\"",
239
- "member": "string",
240
- "name": "Info",
241
- "type": "string",
242
- "value_allowed_null": false
243
- },
244
- {
245
- "document": "异步扫描任务提交成功返回success",
246
- "member": "string",
247
- "name": "Data",
248
- "type": "string",
249
- "value_allowed_null": false
250
- },
251
- {
252
- "document": "唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。",
253
- "member": "string",
254
- "name": "RequestId",
255
- "type": "string"
256
- }
257
- ],
258
- "type": "object"
259
- }
260
- },
261
- "version": "1.0"
262
- }
@@ -1,37 +0,0 @@
1
- {
2
- "actions": {
3
- "GetLocalEngine": [
4
- {
5
- "document": "",
6
- "input": "https://tav.tencentcloudapi.com/?Action=GetLocalEngine\r\n&Key=d12790cf44382a3c15e4e8c63e41e74d\r\n&<公共请求参数>",
7
- "output": "{\"Response\": {\"Status\": 200, \"Info\": \"scan success\", \"Data\": \"http://s.pc.qq.com/tav/zip/tavlocalengine.zip\", \"RequestId\": \"00f29851-2408-4818-b66c-3b2d2ba4196f\"}}",
8
- "title": "TAV本地引擎"
9
- }
10
- ],
11
- "GetScanResult": [
12
- {
13
- "document": "",
14
- "input": "https://tav.tencentcloudapi.com/?Action=GetScanResult\r\n&Key=d12790cf44382a3c15e4e8c63e41e74d\r\n&Md5=0f600011f6abb02f6a117e1efb952a3c\r\n&<公共请求参数>",
15
- "output": "{\"Response\": {\"Status\": 200, \"Info\": \"scan success\", \"Data\":\"\",\"RequestId\": \"00f29851-2408-4818-b66c-3b2d2ba4196f\"}}",
16
- "title": "tav文件上传扫描结果查询"
17
- }
18
- ],
19
- "ScanFile": [
20
- {
21
- "document": "",
22
- "input": "https://tav.tencentcloudapi.com/?Action=ScanFile\r\n&Key=d12790cf44382a3c15e4e8c63e41e74d\r\n&Sample=http://10.195.2.97/download?md5=02e0f6af62f26284652df601b2613feb\r\n&Md5=0f600011f6abb02f6a117e1efb952a3c\r\n&<公共请求参数>",
23
- "output": "{\"Response\": {\"Status\": 200, \"Info\": \"scan success\", \"Data\":\"\",\"RequestId\": \"00f29851-2408-4818-b66c-3b2d2ba4196f\"}}",
24
- "title": "tav文件上传扫描"
25
- }
26
- ],
27
- "ScanFileHash": [
28
- {
29
- "document": "",
30
- "input": "https://tav.tencentcloudapi.com/?Action=ScanFileHash\r\n&Key=d12790cf44382a3c15e4e8c63e41e74d\r\n&Md5s=0f600011f6abb02f6a117e1efb952a3c\r\n&WithCategory=0\r\n&SensitiveLevel=10\r\n&<公共请求参数>",
31
- "output": "{\"Response\": {\"Status\": 200, \"Info\": \"scan success\", \"Data\": \"md5:0f600011f6abb02f6a117e1efb952a3c,return_state:1,virus_state:2,virus_name:Win32.Trojan.Agent.tkxh|\", \"RequestId\": \"00f29851-2408-4818-b66c-3b2d2ba4196f\"}}",
32
- "title": "TAV公有云查"
33
- }
34
- ]
35
- },
36
- "version": "1.0"
37
- }
@@ -1,4 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- from tccli.services.tbm.tbm_client import action_caller
4
-