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,530 +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.mgobe.v20201014 import mgobe_client as mgobe_client_v20201014
15
- from tencentcloud.mgobe.v20201014 import models as models_v20201014
16
- from tencentcloud.mgobe.v20190929 import mgobe_client as mgobe_client_v20190929
17
- from tencentcloud.mgobe.v20190929 import models as models_v20190929
18
-
19
- from jmespath import search
20
- import time
21
-
22
- def doDescribePlayer(args, parsed_globals):
23
- g_param = parse_global_arg(parsed_globals)
24
-
25
- if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
26
- cred = credential.CVMRoleCredential()
27
- elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
28
- cred = credential.STSAssumeRoleCredential(
29
- g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
30
- g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
31
- )
32
- 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):
33
- cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
34
- else:
35
- cred = credential.Credential(
36
- g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
37
- )
38
- http_profile = HttpProfile(
39
- reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
40
- reqMethod="POST",
41
- endpoint=g_param[OptionsDefine.Endpoint],
42
- proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
43
- )
44
- profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
45
- if g_param[OptionsDefine.Language]:
46
- profile.language = g_param[OptionsDefine.Language]
47
- mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
48
- client = mod.MgobeClient(cred, g_param[OptionsDefine.Region], profile)
49
- client._sdkVersion += ("_CLI_" + __version__)
50
- models = MODELS_MAP[g_param[OptionsDefine.Version]]
51
- model = models.DescribePlayerRequest()
52
- model.from_json_string(json.dumps(args))
53
- start_time = time.time()
54
- while True:
55
- rsp = client.DescribePlayer(model)
56
- result = rsp.to_json_string()
57
- try:
58
- json_obj = json.loads(result)
59
- except TypeError as e:
60
- json_obj = json.loads(result.decode('utf-8')) # python3.3
61
- if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
62
- break
63
- cur_time = time.time()
64
- if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
65
- raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
66
- (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
67
- search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
68
- else:
69
- print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
70
- time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
71
- FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
72
-
73
-
74
- def doDescribeRoom(args, parsed_globals):
75
- g_param = parse_global_arg(parsed_globals)
76
-
77
- if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
78
- cred = credential.CVMRoleCredential()
79
- elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
80
- cred = credential.STSAssumeRoleCredential(
81
- g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
82
- g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
83
- )
84
- 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):
85
- cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
86
- else:
87
- cred = credential.Credential(
88
- g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
89
- )
90
- http_profile = HttpProfile(
91
- reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
92
- reqMethod="POST",
93
- endpoint=g_param[OptionsDefine.Endpoint],
94
- proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
95
- )
96
- profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
97
- if g_param[OptionsDefine.Language]:
98
- profile.language = g_param[OptionsDefine.Language]
99
- mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
100
- client = mod.MgobeClient(cred, g_param[OptionsDefine.Region], profile)
101
- client._sdkVersion += ("_CLI_" + __version__)
102
- models = MODELS_MAP[g_param[OptionsDefine.Version]]
103
- model = models.DescribeRoomRequest()
104
- model.from_json_string(json.dumps(args))
105
- start_time = time.time()
106
- while True:
107
- rsp = client.DescribeRoom(model)
108
- result = rsp.to_json_string()
109
- try:
110
- json_obj = json.loads(result)
111
- except TypeError as e:
112
- json_obj = json.loads(result.decode('utf-8')) # python3.3
113
- if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
114
- break
115
- cur_time = time.time()
116
- if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
117
- raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
118
- (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
119
- search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
120
- else:
121
- print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
122
- time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
123
- FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
124
-
125
-
126
- def doChangeRoomPlayerStatus(args, parsed_globals):
127
- g_param = parse_global_arg(parsed_globals)
128
-
129
- if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
130
- cred = credential.CVMRoleCredential()
131
- elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
132
- cred = credential.STSAssumeRoleCredential(
133
- g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
134
- g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
135
- )
136
- 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):
137
- cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
138
- else:
139
- cred = credential.Credential(
140
- g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
141
- )
142
- http_profile = HttpProfile(
143
- reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
144
- reqMethod="POST",
145
- endpoint=g_param[OptionsDefine.Endpoint],
146
- proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
147
- )
148
- profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
149
- if g_param[OptionsDefine.Language]:
150
- profile.language = g_param[OptionsDefine.Language]
151
- mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
152
- client = mod.MgobeClient(cred, g_param[OptionsDefine.Region], profile)
153
- client._sdkVersion += ("_CLI_" + __version__)
154
- models = MODELS_MAP[g_param[OptionsDefine.Version]]
155
- model = models.ChangeRoomPlayerStatusRequest()
156
- model.from_json_string(json.dumps(args))
157
- start_time = time.time()
158
- while True:
159
- rsp = client.ChangeRoomPlayerStatus(model)
160
- result = rsp.to_json_string()
161
- try:
162
- json_obj = json.loads(result)
163
- except TypeError as e:
164
- json_obj = json.loads(result.decode('utf-8')) # python3.3
165
- if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
166
- break
167
- cur_time = time.time()
168
- if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
169
- raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
170
- (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
171
- search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
172
- else:
173
- print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
174
- time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
175
- FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
176
-
177
-
178
- def doModifyRoom(args, parsed_globals):
179
- g_param = parse_global_arg(parsed_globals)
180
-
181
- if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
182
- cred = credential.CVMRoleCredential()
183
- elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
184
- cred = credential.STSAssumeRoleCredential(
185
- g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
186
- g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
187
- )
188
- 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):
189
- cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
190
- else:
191
- cred = credential.Credential(
192
- g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
193
- )
194
- http_profile = HttpProfile(
195
- reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
196
- reqMethod="POST",
197
- endpoint=g_param[OptionsDefine.Endpoint],
198
- proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
199
- )
200
- profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
201
- if g_param[OptionsDefine.Language]:
202
- profile.language = g_param[OptionsDefine.Language]
203
- mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
204
- client = mod.MgobeClient(cred, g_param[OptionsDefine.Region], profile)
205
- client._sdkVersion += ("_CLI_" + __version__)
206
- models = MODELS_MAP[g_param[OptionsDefine.Version]]
207
- model = models.ModifyRoomRequest()
208
- model.from_json_string(json.dumps(args))
209
- start_time = time.time()
210
- while True:
211
- rsp = client.ModifyRoom(model)
212
- result = rsp.to_json_string()
213
- try:
214
- json_obj = json.loads(result)
215
- except TypeError as e:
216
- json_obj = json.loads(result.decode('utf-8')) # python3.3
217
- if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
218
- break
219
- cur_time = time.time()
220
- if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
221
- raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
222
- (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
223
- search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
224
- else:
225
- print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
226
- time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
227
- FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
228
-
229
-
230
- def doRemoveRoomPlayer(args, parsed_globals):
231
- g_param = parse_global_arg(parsed_globals)
232
-
233
- if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
234
- cred = credential.CVMRoleCredential()
235
- elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
236
- cred = credential.STSAssumeRoleCredential(
237
- g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
238
- g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
239
- )
240
- 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):
241
- cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
242
- else:
243
- cred = credential.Credential(
244
- g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
245
- )
246
- http_profile = HttpProfile(
247
- reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
248
- reqMethod="POST",
249
- endpoint=g_param[OptionsDefine.Endpoint],
250
- proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
251
- )
252
- profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
253
- if g_param[OptionsDefine.Language]:
254
- profile.language = g_param[OptionsDefine.Language]
255
- mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
256
- client = mod.MgobeClient(cred, g_param[OptionsDefine.Region], profile)
257
- client._sdkVersion += ("_CLI_" + __version__)
258
- models = MODELS_MAP[g_param[OptionsDefine.Version]]
259
- model = models.RemoveRoomPlayerRequest()
260
- model.from_json_string(json.dumps(args))
261
- start_time = time.time()
262
- while True:
263
- rsp = client.RemoveRoomPlayer(model)
264
- result = rsp.to_json_string()
265
- try:
266
- json_obj = json.loads(result)
267
- except TypeError as e:
268
- json_obj = json.loads(result.decode('utf-8')) # python3.3
269
- if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
270
- break
271
- cur_time = time.time()
272
- if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
273
- raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
274
- (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
275
- search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
276
- else:
277
- print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
278
- time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
279
- FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
280
-
281
-
282
- def doChangeRoomPlayerProfile(args, parsed_globals):
283
- g_param = parse_global_arg(parsed_globals)
284
-
285
- if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
286
- cred = credential.CVMRoleCredential()
287
- elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
288
- cred = credential.STSAssumeRoleCredential(
289
- g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
290
- g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
291
- )
292
- 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):
293
- cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
294
- else:
295
- cred = credential.Credential(
296
- g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
297
- )
298
- http_profile = HttpProfile(
299
- reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
300
- reqMethod="POST",
301
- endpoint=g_param[OptionsDefine.Endpoint],
302
- proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
303
- )
304
- profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
305
- if g_param[OptionsDefine.Language]:
306
- profile.language = g_param[OptionsDefine.Language]
307
- mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
308
- client = mod.MgobeClient(cred, g_param[OptionsDefine.Region], profile)
309
- client._sdkVersion += ("_CLI_" + __version__)
310
- models = MODELS_MAP[g_param[OptionsDefine.Version]]
311
- model = models.ChangeRoomPlayerProfileRequest()
312
- model.from_json_string(json.dumps(args))
313
- start_time = time.time()
314
- while True:
315
- rsp = client.ChangeRoomPlayerProfile(model)
316
- result = rsp.to_json_string()
317
- try:
318
- json_obj = json.loads(result)
319
- except TypeError as e:
320
- json_obj = json.loads(result.decode('utf-8')) # python3.3
321
- if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
322
- break
323
- cur_time = time.time()
324
- if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
325
- raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
326
- (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
327
- search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
328
- else:
329
- print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
330
- time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
331
- FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
332
-
333
-
334
- def doDismissRoom(args, parsed_globals):
335
- g_param = parse_global_arg(parsed_globals)
336
-
337
- if g_param[OptionsDefine.UseCVMRole.replace('-', '_')]:
338
- cred = credential.CVMRoleCredential()
339
- elif g_param[OptionsDefine.RoleArn.replace('-', '_')] and g_param[OptionsDefine.RoleSessionName.replace('-', '_')]:
340
- cred = credential.STSAssumeRoleCredential(
341
- g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.RoleArn.replace('-', '_')],
342
- g_param[OptionsDefine.RoleSessionName.replace('-', '_')], endpoint=g_param["sts_cred_endpoint"]
343
- )
344
- 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):
345
- cred = credential.DefaultTkeOIDCRoleArnProvider().get_credentials()
346
- else:
347
- cred = credential.Credential(
348
- g_param[OptionsDefine.SecretId], g_param[OptionsDefine.SecretKey], g_param[OptionsDefine.Token]
349
- )
350
- http_profile = HttpProfile(
351
- reqTimeout=60 if g_param[OptionsDefine.Timeout] is None else int(g_param[OptionsDefine.Timeout]),
352
- reqMethod="POST",
353
- endpoint=g_param[OptionsDefine.Endpoint],
354
- proxy=g_param[OptionsDefine.HttpsProxy.replace('-', '_')]
355
- )
356
- profile = ClientProfile(httpProfile=http_profile, signMethod="HmacSHA256")
357
- if g_param[OptionsDefine.Language]:
358
- profile.language = g_param[OptionsDefine.Language]
359
- mod = CLIENT_MAP[g_param[OptionsDefine.Version]]
360
- client = mod.MgobeClient(cred, g_param[OptionsDefine.Region], profile)
361
- client._sdkVersion += ("_CLI_" + __version__)
362
- models = MODELS_MAP[g_param[OptionsDefine.Version]]
363
- model = models.DismissRoomRequest()
364
- model.from_json_string(json.dumps(args))
365
- start_time = time.time()
366
- while True:
367
- rsp = client.DismissRoom(model)
368
- result = rsp.to_json_string()
369
- try:
370
- json_obj = json.loads(result)
371
- except TypeError as e:
372
- json_obj = json.loads(result.decode('utf-8')) # python3.3
373
- if not g_param[OptionsDefine.Waiter] or search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj) == g_param['OptionsDefine.WaiterInfo']['to']:
374
- break
375
- cur_time = time.time()
376
- if cur_time - start_time >= g_param['OptionsDefine.WaiterInfo']['timeout']:
377
- raise ClientError('Request timeout, wait `%s` to `%s` timeout, last request is %s' %
378
- (g_param['OptionsDefine.WaiterInfo']['expr'], g_param['OptionsDefine.WaiterInfo']['to'],
379
- search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj)))
380
- else:
381
- print('Inquiry result is %s.' % search(g_param['OptionsDefine.WaiterInfo']['expr'], json_obj))
382
- time.sleep(g_param['OptionsDefine.WaiterInfo']['interval'])
383
- FormatOutput.output("action", json_obj, g_param[OptionsDefine.Output], g_param[OptionsDefine.Filter])
384
-
385
-
386
- CLIENT_MAP = {
387
- "v20201014": mgobe_client_v20201014,
388
- "v20190929": mgobe_client_v20190929,
389
-
390
- }
391
-
392
- MODELS_MAP = {
393
- "v20201014": models_v20201014,
394
- "v20190929": models_v20190929,
395
-
396
- }
397
-
398
- ACTION_MAP = {
399
- "DescribePlayer": doDescribePlayer,
400
- "DescribeRoom": doDescribeRoom,
401
- "ChangeRoomPlayerStatus": doChangeRoomPlayerStatus,
402
- "ModifyRoom": doModifyRoom,
403
- "RemoveRoomPlayer": doRemoveRoomPlayer,
404
- "ChangeRoomPlayerProfile": doChangeRoomPlayerProfile,
405
- "DismissRoom": doDismissRoom,
406
-
407
- }
408
-
409
- AVAILABLE_VERSION_LIST = [
410
- "v20201014",
411
- "v20190929",
412
-
413
- ]
414
-
415
-
416
- def action_caller():
417
- return ACTION_MAP
418
-
419
-
420
- def parse_global_arg(parsed_globals):
421
- g_param = parsed_globals
422
- cvm_role_flag = True
423
- for param in parsed_globals.keys():
424
- if param in [OptionsDefine.SecretKey, OptionsDefine.SecretId, OptionsDefine.RoleArn,
425
- OptionsDefine.RoleSessionName]:
426
- if parsed_globals[param] is not None:
427
- cvm_role_flag = False
428
- break
429
- is_exist_profile = True
430
- if not parsed_globals["profile"]:
431
- is_exist_profile = False
432
- g_param["profile"] = os.environ.get("TCCLI_PROFILE", "default")
433
-
434
- configure_path = os.path.join(os.path.expanduser("~"), ".tccli")
435
- is_conf_exist, conf_path = Utils.file_existed(configure_path, g_param["profile"] + ".configure")
436
- is_cred_exist, cred_path = Utils.file_existed(configure_path, g_param["profile"] + ".credential")
437
-
438
- conf = {}
439
- cred = {}
440
-
441
- if is_conf_exist:
442
- conf = Utils.load_json_msg(conf_path)
443
- if is_cred_exist:
444
- cred = Utils.load_json_msg(cred_path)
445
-
446
- if not (isinstance(conf, dict) and isinstance(cred, dict)):
447
- raise ConfigurationError(
448
- "file: %s or %s is not json format"
449
- % (g_param["profile"] + ".configure", g_param["profile"] + ".credential"))
450
-
451
- if OptionsDefine.Token not in cred:
452
- cred[OptionsDefine.Token] = None
453
-
454
- if not is_exist_profile:
455
- if os.environ.get(OptionsDefine.ENV_SECRET_ID) and os.environ.get(OptionsDefine.ENV_SECRET_KEY):
456
- cred[OptionsDefine.SecretId] = os.environ.get(OptionsDefine.ENV_SECRET_ID)
457
- cred[OptionsDefine.SecretKey] = os.environ.get(OptionsDefine.ENV_SECRET_KEY)
458
- cred[OptionsDefine.Token] = os.environ.get(OptionsDefine.ENV_TOKEN)
459
- cvm_role_flag = False
460
-
461
- if os.environ.get(OptionsDefine.ENV_REGION):
462
- conf[OptionsDefine.SysParam][OptionsDefine.Region] = os.environ.get(OptionsDefine.ENV_REGION)
463
-
464
- if os.environ.get(OptionsDefine.ENV_ROLE_ARN) and os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME):
465
- cred[OptionsDefine.RoleArn] = os.environ.get(OptionsDefine.ENV_ROLE_ARN)
466
- cred[OptionsDefine.RoleSessionName] = os.environ.get(OptionsDefine.ENV_ROLE_SESSION_NAME)
467
- cvm_role_flag = False
468
-
469
- if cvm_role_flag:
470
- if "type" in cred and cred["type"] == "cvm-role":
471
- g_param[OptionsDefine.UseCVMRole.replace('-', '_')] = True
472
-
473
- for param in g_param.keys():
474
- if g_param[param] is None:
475
- if param in [OptionsDefine.SecretKey, OptionsDefine.SecretId, OptionsDefine.Token]:
476
- if param in cred:
477
- g_param[param] = cred[param]
478
- elif not (g_param[OptionsDefine.UseCVMRole.replace('-', '_')]
479
- or os.getenv(OptionsDefine.ENV_TKE_ROLE_ARN)):
480
- raise ConfigurationError("%s is invalid" % param)
481
- elif param in [OptionsDefine.Region, OptionsDefine.Output, OptionsDefine.Language]:
482
- if param in conf[OptionsDefine.SysParam]:
483
- g_param[param] = conf[OptionsDefine.SysParam][param]
484
- elif param != OptionsDefine.Language:
485
- raise ConfigurationError("%s is invalid" % param)
486
- elif param.replace('_', '-') in [OptionsDefine.RoleArn, OptionsDefine.RoleSessionName]:
487
- if param.replace('_', '-') in cred:
488
- g_param[param] = cred[param.replace('_', '-')]
489
-
490
- try:
491
- if g_param[OptionsDefine.ServiceVersion]:
492
- g_param[OptionsDefine.Version] = "v" + g_param[OptionsDefine.ServiceVersion].replace('-', '')
493
- else:
494
- version = conf["mgobe"][OptionsDefine.Version]
495
- g_param[OptionsDefine.Version] = "v" + version.replace('-', '')
496
-
497
- if g_param[OptionsDefine.Endpoint] is None:
498
- g_param[OptionsDefine.Endpoint] = conf["mgobe"][OptionsDefine.Endpoint]
499
- g_param["sts_cred_endpoint"] = conf.get("sts", {}).get("endpoint")
500
- except Exception as err:
501
- raise ConfigurationError("config file:%s error, %s" % (conf_path, str(err)))
502
-
503
- if g_param[OptionsDefine.Version] not in AVAILABLE_VERSION_LIST:
504
- raise Exception("available versions: %s" % " ".join(AVAILABLE_VERSION_LIST))
505
-
506
- if g_param[OptionsDefine.Waiter]:
507
- param = eval(g_param[OptionsDefine.Waiter])
508
- if 'expr' not in param:
509
- raise Exception('`expr` in `--waiter` must be defined')
510
- if 'to' not in param:
511
- raise Exception('`to` in `--waiter` must be defined')
512
- if 'timeout' not in param:
513
- if 'waiter' in conf and 'timeout' in conf['waiter']:
514
- param['timeout'] = conf['waiter']['timeout']
515
- else:
516
- param['timeout'] = 180
517
- if 'interval' not in param:
518
- if 'waiter' in conf and 'interval' in conf['waiter']:
519
- param['interval'] = conf['waiter']['interval']
520
- else:
521
- param['interval'] = 5
522
- param['interval'] = min(param['interval'], param['timeout'])
523
- g_param['OptionsDefine.WaiterInfo'] = param
524
-
525
- if six.PY2:
526
- for key, value in g_param.items():
527
- if isinstance(value, six.text_type):
528
- g_param[key] = value.encode('utf-8')
529
- return g_param
530
-
@@ -1,52 +0,0 @@
1
- {
2
- "actions": {
3
- "DismissRoom": {
4
- "document": "通过game_id、room_id解散房间",
5
- "input": "DismissRoomRequest",
6
- "name": "解散房间",
7
- "output": "DismissRoomResponse",
8
- "status": "online"
9
- }
10
- },
11
- "metadata": {
12
- "apiVersion": "2019-09-29",
13
- "api_brief": "介绍如何使用API对联机对战引擎各对象进行操作,包括房间、玩家、匹配等。",
14
- "serviceNameCN": "游戏联机对战引擎",
15
- "serviceShortName": "mgobe"
16
- },
17
- "objects": {
18
- "DismissRoomRequest": {
19
- "document": "DismissRoom请求参数结构体",
20
- "members": [
21
- {
22
- "document": "表示游戏资源唯一 ID, 由后台自动分配, 无法修改。",
23
- "member": "string",
24
- "name": "GameId",
25
- "required": true,
26
- "type": "string"
27
- },
28
- {
29
- "document": "表示游戏房间唯一ID。",
30
- "member": "string",
31
- "name": "RoomId",
32
- "required": true,
33
- "type": "string"
34
- }
35
- ],
36
- "type": "object"
37
- },
38
- "DismissRoomResponse": {
39
- "document": "DismissRoom返回参数结构体",
40
- "members": [
41
- {
42
- "document": "唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。",
43
- "member": "string",
44
- "name": "RequestId",
45
- "type": "string"
46
- }
47
- ],
48
- "type": "object"
49
- }
50
- },
51
- "version": "1.0"
52
- }
@@ -1,13 +0,0 @@
1
- {
2
- "actions": {
3
- "DismissRoom": [
4
- {
5
- "document": "通过game_id、room_id解散房间",
6
- "input": "https://mgobe.tencentcloudapi.com/?Action=DismissRoom\n&GameId=\"obg-hvhvbs\"\n&RoomId=\"Sfsfdf\"\n&<公共请求参数>",
7
- "output": "{\n \"Response\": {\n \"RequestId\": \"f481b4a1-1efd-48fd-a35a-5d544c40b5b2\"\n }\n}",
8
- "title": "解散房间"
9
- }
10
- ]
11
- },
12
- "version": "1.0"
13
- }