tencentcloud-sdk-iotcloud 1.0.200

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.
@@ -0,0 +1,396 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require 'json'
18
+
19
+ module TencentCloud
20
+ module Iotcloud
21
+ module V20210408
22
+ class Client < TencentCloud::Common::AbstractClient
23
+
24
+ def initialize(credential, region, profile = nil)
25
+ api_version = '2021-04-08'
26
+ api_endpoint = 'iotcloud.tencentcloudapi.com'
27
+ sdk_version = 'IOTCLOUD_' + File.read(File.expand_path('../VERSION', __dir__)).strip
28
+ super(credential, region, api_version, api_endpoint, sdk_version, profile)
29
+ end
30
+
31
+
32
+ # 本接口(CreateDevice)用于新建一个物联网通信设备。
33
+
34
+ # @param request: Request instance for CreateDevice.
35
+ # @type request: :class:`Tencentcloud::iotcloud::V20210408::CreateDeviceRequest`
36
+ # @rtype: :class:`Tencentcloud::iotcloud::V20210408::CreateDeviceResponse`
37
+ def CreateDevice(request)
38
+ body = send_request('CreateDevice', request.serialize)
39
+ response = JSON.parse(body)
40
+ if response['Response'].key?('Error') == false
41
+ model = CreateDeviceResponse.new
42
+ model.deserialize(response['Response'])
43
+ model
44
+ else
45
+ code = response['Response']['Error']['Code']
46
+ message = response['Response']['Error']['Message']
47
+ reqid = response['Response']['RequestId']
48
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
49
+ end
50
+ rescue TencentCloud::Common::TencentCloudSDKException => e
51
+ raise e
52
+ rescue StandardError => e
53
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
54
+ end
55
+
56
+ # 创建私有CA证书
57
+
58
+ # @param request: Request instance for CreatePrivateCA.
59
+ # @type request: :class:`Tencentcloud::iotcloud::V20210408::CreatePrivateCARequest`
60
+ # @rtype: :class:`Tencentcloud::iotcloud::V20210408::CreatePrivateCAResponse`
61
+ def CreatePrivateCA(request)
62
+ body = send_request('CreatePrivateCA', request.serialize)
63
+ response = JSON.parse(body)
64
+ if response['Response'].key?('Error') == false
65
+ model = CreatePrivateCAResponse.new
66
+ model.deserialize(response['Response'])
67
+ model
68
+ else
69
+ code = response['Response']['Error']['Code']
70
+ message = response['Response']['Error']['Message']
71
+ reqid = response['Response']['RequestId']
72
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
73
+ end
74
+ rescue TencentCloud::Common::TencentCloudSDKException => e
75
+ raise e
76
+ rescue StandardError => e
77
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
78
+ end
79
+
80
+ # 本接口(DeleteDevice)用于删除物联网通信设备。
81
+
82
+ # @param request: Request instance for DeleteDevice.
83
+ # @type request: :class:`Tencentcloud::iotcloud::V20210408::DeleteDeviceRequest`
84
+ # @rtype: :class:`Tencentcloud::iotcloud::V20210408::DeleteDeviceResponse`
85
+ def DeleteDevice(request)
86
+ body = send_request('DeleteDevice', request.serialize)
87
+ response = JSON.parse(body)
88
+ if response['Response'].key?('Error') == false
89
+ model = DeleteDeviceResponse.new
90
+ model.deserialize(response['Response'])
91
+ model
92
+ else
93
+ code = response['Response']['Error']['Code']
94
+ message = response['Response']['Error']['Message']
95
+ reqid = response['Response']['RequestId']
96
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
97
+ end
98
+ rescue TencentCloud::Common::TencentCloudSDKException => e
99
+ raise e
100
+ rescue StandardError => e
101
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
102
+ end
103
+
104
+ # 删除私有CA证书
105
+
106
+ # @param request: Request instance for DeletePrivateCA.
107
+ # @type request: :class:`Tencentcloud::iotcloud::V20210408::DeletePrivateCARequest`
108
+ # @rtype: :class:`Tencentcloud::iotcloud::V20210408::DeletePrivateCAResponse`
109
+ def DeletePrivateCA(request)
110
+ body = send_request('DeletePrivateCA', request.serialize)
111
+ response = JSON.parse(body)
112
+ if response['Response'].key?('Error') == false
113
+ model = DeletePrivateCAResponse.new
114
+ model.deserialize(response['Response'])
115
+ model
116
+ else
117
+ code = response['Response']['Error']['Code']
118
+ message = response['Response']['Error']['Message']
119
+ reqid = response['Response']['RequestId']
120
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
121
+ end
122
+ rescue TencentCloud::Common::TencentCloudSDKException => e
123
+ raise e
124
+ rescue StandardError => e
125
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
126
+ end
127
+
128
+ # 本接口(DeleteProduct)用于删除一个物联网通信产品
129
+
130
+ # @param request: Request instance for DeleteProduct.
131
+ # @type request: :class:`Tencentcloud::iotcloud::V20210408::DeleteProductRequest`
132
+ # @rtype: :class:`Tencentcloud::iotcloud::V20210408::DeleteProductResponse`
133
+ def DeleteProduct(request)
134
+ body = send_request('DeleteProduct', request.serialize)
135
+ response = JSON.parse(body)
136
+ if response['Response'].key?('Error') == false
137
+ model = DeleteProductResponse.new
138
+ model.deserialize(response['Response'])
139
+ model
140
+ else
141
+ code = response['Response']['Error']['Code']
142
+ message = response['Response']['Error']['Message']
143
+ reqid = response['Response']['RequestId']
144
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
145
+ end
146
+ rescue TencentCloud::Common::TencentCloudSDKException => e
147
+ raise e
148
+ rescue StandardError => e
149
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
150
+ end
151
+
152
+ # 本接口(DescribeDevice)用于查看设备信息
153
+
154
+ # @param request: Request instance for DescribeDevice.
155
+ # @type request: :class:`Tencentcloud::iotcloud::V20210408::DescribeDeviceRequest`
156
+ # @rtype: :class:`Tencentcloud::iotcloud::V20210408::DescribeDeviceResponse`
157
+ def DescribeDevice(request)
158
+ body = send_request('DescribeDevice', request.serialize)
159
+ response = JSON.parse(body)
160
+ if response['Response'].key?('Error') == false
161
+ model = DescribeDeviceResponse.new
162
+ model.deserialize(response['Response'])
163
+ model
164
+ else
165
+ code = response['Response']['Error']['Code']
166
+ message = response['Response']['Error']['Message']
167
+ reqid = response['Response']['RequestId']
168
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
169
+ end
170
+ rescue TencentCloud::Common::TencentCloudSDKException => e
171
+ raise e
172
+ rescue StandardError => e
173
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
174
+ end
175
+
176
+ # 本接口(DescribeDevices)用于查询物联网通信设备的设备列表。
177
+
178
+ # @param request: Request instance for DescribeDevices.
179
+ # @type request: :class:`Tencentcloud::iotcloud::V20210408::DescribeDevicesRequest`
180
+ # @rtype: :class:`Tencentcloud::iotcloud::V20210408::DescribeDevicesResponse`
181
+ def DescribeDevices(request)
182
+ body = send_request('DescribeDevices', request.serialize)
183
+ response = JSON.parse(body)
184
+ if response['Response'].key?('Error') == false
185
+ model = DescribeDevicesResponse.new
186
+ model.deserialize(response['Response'])
187
+ model
188
+ else
189
+ code = response['Response']['Error']['Code']
190
+ message = response['Response']['Error']['Message']
191
+ reqid = response['Response']['RequestId']
192
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
193
+ end
194
+ rescue TencentCloud::Common::TencentCloudSDKException => e
195
+ raise e
196
+ rescue StandardError => e
197
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
198
+ end
199
+
200
+ # 查询私有化CA信息
201
+
202
+ # @param request: Request instance for DescribePrivateCA.
203
+ # @type request: :class:`Tencentcloud::iotcloud::V20210408::DescribePrivateCARequest`
204
+ # @rtype: :class:`Tencentcloud::iotcloud::V20210408::DescribePrivateCAResponse`
205
+ def DescribePrivateCA(request)
206
+ body = send_request('DescribePrivateCA', request.serialize)
207
+ response = JSON.parse(body)
208
+ if response['Response'].key?('Error') == false
209
+ model = DescribePrivateCAResponse.new
210
+ model.deserialize(response['Response'])
211
+ model
212
+ else
213
+ code = response['Response']['Error']['Code']
214
+ message = response['Response']['Error']['Message']
215
+ reqid = response['Response']['RequestId']
216
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
217
+ end
218
+ rescue TencentCloud::Common::TencentCloudSDKException => e
219
+ raise e
220
+ rescue StandardError => e
221
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
222
+ end
223
+
224
+ # 查询私有CA绑定的产品列表
225
+
226
+ # @param request: Request instance for DescribePrivateCABindedProducts.
227
+ # @type request: :class:`Tencentcloud::iotcloud::V20210408::DescribePrivateCABindedProductsRequest`
228
+ # @rtype: :class:`Tencentcloud::iotcloud::V20210408::DescribePrivateCABindedProductsResponse`
229
+ def DescribePrivateCABindedProducts(request)
230
+ body = send_request('DescribePrivateCABindedProducts', request.serialize)
231
+ response = JSON.parse(body)
232
+ if response['Response'].key?('Error') == false
233
+ model = DescribePrivateCABindedProductsResponse.new
234
+ model.deserialize(response['Response'])
235
+ model
236
+ else
237
+ code = response['Response']['Error']['Code']
238
+ message = response['Response']['Error']['Message']
239
+ reqid = response['Response']['RequestId']
240
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
241
+ end
242
+ rescue TencentCloud::Common::TencentCloudSDKException => e
243
+ raise e
244
+ rescue StandardError => e
245
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
246
+ end
247
+
248
+ # 查询私有CA证书列表
249
+
250
+ # @param request: Request instance for DescribePrivateCAs.
251
+ # @type request: :class:`Tencentcloud::iotcloud::V20210408::DescribePrivateCAsRequest`
252
+ # @rtype: :class:`Tencentcloud::iotcloud::V20210408::DescribePrivateCAsResponse`
253
+ def DescribePrivateCAs(request)
254
+ body = send_request('DescribePrivateCAs', request.serialize)
255
+ response = JSON.parse(body)
256
+ if response['Response'].key?('Error') == false
257
+ model = DescribePrivateCAsResponse.new
258
+ model.deserialize(response['Response'])
259
+ model
260
+ else
261
+ code = response['Response']['Error']['Code']
262
+ message = response['Response']['Error']['Message']
263
+ reqid = response['Response']['RequestId']
264
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
265
+ end
266
+ rescue TencentCloud::Common::TencentCloudSDKException => e
267
+ raise e
268
+ rescue StandardError => e
269
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
270
+ end
271
+
272
+ # 本接口(DescribeProduct)用于查看产品详情
273
+
274
+ # @param request: Request instance for DescribeProduct.
275
+ # @type request: :class:`Tencentcloud::iotcloud::V20210408::DescribeProductRequest`
276
+ # @rtype: :class:`Tencentcloud::iotcloud::V20210408::DescribeProductResponse`
277
+ def DescribeProduct(request)
278
+ body = send_request('DescribeProduct', request.serialize)
279
+ response = JSON.parse(body)
280
+ if response['Response'].key?('Error') == false
281
+ model = DescribeProductResponse.new
282
+ model.deserialize(response['Response'])
283
+ model
284
+ else
285
+ code = response['Response']['Error']['Code']
286
+ message = response['Response']['Error']['Message']
287
+ reqid = response['Response']['RequestId']
288
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
289
+ end
290
+ rescue TencentCloud::Common::TencentCloudSDKException => e
291
+ raise e
292
+ rescue StandardError => e
293
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
294
+ end
295
+
296
+ # 查询产品绑定的CA证书
297
+
298
+ # @param request: Request instance for DescribeProductCA.
299
+ # @type request: :class:`Tencentcloud::iotcloud::V20210408::DescribeProductCARequest`
300
+ # @rtype: :class:`Tencentcloud::iotcloud::V20210408::DescribeProductCAResponse`
301
+ def DescribeProductCA(request)
302
+ body = send_request('DescribeProductCA', request.serialize)
303
+ response = JSON.parse(body)
304
+ if response['Response'].key?('Error') == false
305
+ model = DescribeProductCAResponse.new
306
+ model.deserialize(response['Response'])
307
+ model
308
+ else
309
+ code = response['Response']['Error']['Code']
310
+ message = response['Response']['Error']['Message']
311
+ reqid = response['Response']['RequestId']
312
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
313
+ end
314
+ rescue TencentCloud::Common::TencentCloudSDKException => e
315
+ raise e
316
+ rescue StandardError => e
317
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
318
+ end
319
+
320
+ # 设置设备上报的日志级别
321
+
322
+ # @param request: Request instance for UpdateDeviceLogLevel.
323
+ # @type request: :class:`Tencentcloud::iotcloud::V20210408::UpdateDeviceLogLevelRequest`
324
+ # @rtype: :class:`Tencentcloud::iotcloud::V20210408::UpdateDeviceLogLevelResponse`
325
+ def UpdateDeviceLogLevel(request)
326
+ body = send_request('UpdateDeviceLogLevel', request.serialize)
327
+ response = JSON.parse(body)
328
+ if response['Response'].key?('Error') == false
329
+ model = UpdateDeviceLogLevelResponse.new
330
+ model.deserialize(response['Response'])
331
+ model
332
+ else
333
+ code = response['Response']['Error']['Code']
334
+ message = response['Response']['Error']['Message']
335
+ reqid = response['Response']['RequestId']
336
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
337
+ end
338
+ rescue TencentCloud::Common::TencentCloudSDKException => e
339
+ raise e
340
+ rescue StandardError => e
341
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
342
+ end
343
+
344
+ # 批量启用或者禁用设备
345
+
346
+ # @param request: Request instance for UpdateDevicesEnableState.
347
+ # @type request: :class:`Tencentcloud::iotcloud::V20210408::UpdateDevicesEnableStateRequest`
348
+ # @rtype: :class:`Tencentcloud::iotcloud::V20210408::UpdateDevicesEnableStateResponse`
349
+ def UpdateDevicesEnableState(request)
350
+ body = send_request('UpdateDevicesEnableState', request.serialize)
351
+ response = JSON.parse(body)
352
+ if response['Response'].key?('Error') == false
353
+ model = UpdateDevicesEnableStateResponse.new
354
+ model.deserialize(response['Response'])
355
+ model
356
+ else
357
+ code = response['Response']['Error']['Code']
358
+ message = response['Response']['Error']['Message']
359
+ reqid = response['Response']['RequestId']
360
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
361
+ end
362
+ rescue TencentCloud::Common::TencentCloudSDKException => e
363
+ raise e
364
+ rescue StandardError => e
365
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
366
+ end
367
+
368
+ # 更新私有CA证书
369
+
370
+ # @param request: Request instance for UpdatePrivateCA.
371
+ # @type request: :class:`Tencentcloud::iotcloud::V20210408::UpdatePrivateCARequest`
372
+ # @rtype: :class:`Tencentcloud::iotcloud::V20210408::UpdatePrivateCAResponse`
373
+ def UpdatePrivateCA(request)
374
+ body = send_request('UpdatePrivateCA', request.serialize)
375
+ response = JSON.parse(body)
376
+ if response['Response'].key?('Error') == false
377
+ model = UpdatePrivateCAResponse.new
378
+ model.deserialize(response['Response'])
379
+ model
380
+ else
381
+ code = response['Response']['Error']['Code']
382
+ message = response['Response']['Error']['Message']
383
+ reqid = response['Response']['RequestId']
384
+ raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid)
385
+ end
386
+ rescue TencentCloud::Common::TencentCloudSDKException => e
387
+ raise e
388
+ rescue StandardError => e
389
+ raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect)
390
+ end
391
+
392
+
393
+ end
394
+ end
395
+ end
396
+ end