# frozen_string_literal: true # Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require 'json' module TencentCloud module Vm module V20200709 class Client < TencentCloud::Common::AbstractClient def initialize(credential, region, profile = nil) api_version = '2020-07-09' api_endpoint = 'vm.tencentcloudapi.com' sdk_version = 'VM_' + File.read(File.expand_path('../VERSION', __dir__)).strip super(credential, region, api_version, api_endpoint, sdk_version, profile) end # 取消任务 # @param request: Request instance for CancelTask. # @type request: :class:`Tencentcloud::vm::V20200709::CancelTaskRequest` # @rtype: :class:`Tencentcloud::vm::V20200709::CancelTaskResponse` def CancelTask(request) body = send_request('CancelTask', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = CancelTaskResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # 创建业务配置,1个账号最多可以创建20个配置,可定义音频审核的场景,如色情、谩骂等, # 在创建业务配置之前,你需要以下步骤: # 1. 开通COS存储捅功能,新建存储桶,例如 cms_segments,用来存储 视频转换过程中生成对音频和图片。 # 2. 然后在COS控制台,授权天御内容安全主账号 对 cms_segments 存储桶对读写权限。具体授权操作,参考https://cloud.tencent.com/document/product/436/38648 # @param request: Request instance for CreateBizConfig. # @type request: :class:`Tencentcloud::vm::V20200709::CreateBizConfigRequest` # @rtype: :class:`Tencentcloud::vm::V20200709::CreateBizConfigResponse` def CreateBizConfig(request) body = send_request('CreateBizConfig', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = CreateBizConfigResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # 通过URL或存储桶创建审核任务 # @param request: Request instance for CreateVideoModerationTask. # @type request: :class:`Tencentcloud::vm::V20200709::CreateVideoModerationTaskRequest` # @rtype: :class:`Tencentcloud::vm::V20200709::CreateVideoModerationTaskResponse` def CreateVideoModerationTask(request) body = send_request('CreateVideoModerationTask', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = CreateVideoModerationTaskResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # 查看任务详情DescribeTaskDetail # @param request: Request instance for DescribeTaskDetail. # @type request: :class:`Tencentcloud::vm::V20200709::DescribeTaskDetailRequest` # @rtype: :class:`Tencentcloud::vm::V20200709::DescribeTaskDetailResponse` def DescribeTaskDetail(request) body = send_request('DescribeTaskDetail', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DescribeTaskDetailResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end # 控制台识别统计 # @param request: Request instance for DescribeVideoStat. # @type request: :class:`Tencentcloud::vm::V20200709::DescribeVideoStatRequest` # @rtype: :class:`Tencentcloud::vm::V20200709::DescribeVideoStatResponse` def DescribeVideoStat(request) body = send_request('DescribeVideoStat', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DescribeVideoStatResponse.new model.deserialize(response['Response']) model else code = response['Response']['Error']['Code'] message = response['Response']['Error']['Message'] reqid = response['Response']['RequestId'] raise TencentCloud::Common::TencentCloudSDKException.new(code, message, reqid) end rescue TencentCloud::Common::TencentCloudSDKException => e raise e rescue StandardError => e raise TencentCloud::Common::TencentCloudSDKException.new(nil, e.inspect) end end end end end