# 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 Tiems module V20190416 class Client < TencentCloud::Common::AbstractClient def initialize(credential, region, profile = nil) api_version = '2019-04-16' api_endpoint = 'tiems.tencentcloudapi.com' sdk_version = 'TIEMS_' + File.read(File.expand_path('../VERSION', __dir__)).strip super(credential, region, api_version, api_endpoint, sdk_version, profile) end # 创建任务 # @param request: Request instance for CreateJob. # @type request: :class:`Tencentcloud::tiems::V20190416::CreateJobRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::CreateJobResponse` def CreateJob(request) body = send_request('CreateJob', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = CreateJobResponse.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 CreateRsgAsGroup. # @type request: :class:`Tencentcloud::tiems::V20190416::CreateRsgAsGroupRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::CreateRsgAsGroupResponse` def CreateRsgAsGroup(request) body = send_request('CreateRsgAsGroup', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = CreateRsgAsGroupResponse.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 CreateRuntime. # @type request: :class:`Tencentcloud::tiems::V20190416::CreateRuntimeRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::CreateRuntimeResponse` def CreateRuntime(request) body = send_request('CreateRuntime', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = CreateRuntimeResponse.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 CreateService. # @type request: :class:`Tencentcloud::tiems::V20190416::CreateServiceRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::CreateServiceResponse` def CreateService(request) body = send_request('CreateService', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = CreateServiceResponse.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 CreateServiceConfig. # @type request: :class:`Tencentcloud::tiems::V20190416::CreateServiceConfigRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::CreateServiceConfigResponse` def CreateServiceConfig(request) body = send_request('CreateServiceConfig', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = CreateServiceConfigResponse.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 DeleteInstance. # @type request: :class:`Tencentcloud::tiems::V20190416::DeleteInstanceRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::DeleteInstanceResponse` def DeleteInstance(request) body = send_request('DeleteInstance', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DeleteInstanceResponse.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 DeleteJob. # @type request: :class:`Tencentcloud::tiems::V20190416::DeleteJobRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::DeleteJobResponse` def DeleteJob(request) body = send_request('DeleteJob', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DeleteJobResponse.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 DeleteResourceGroup. # @type request: :class:`Tencentcloud::tiems::V20190416::DeleteResourceGroupRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::DeleteResourceGroupResponse` def DeleteResourceGroup(request) body = send_request('DeleteResourceGroup', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DeleteResourceGroupResponse.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 DeleteRsgAsGroup. # @type request: :class:`Tencentcloud::tiems::V20190416::DeleteRsgAsGroupRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::DeleteRsgAsGroupResponse` def DeleteRsgAsGroup(request) body = send_request('DeleteRsgAsGroup', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DeleteRsgAsGroupResponse.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 DeleteRuntime. # @type request: :class:`Tencentcloud::tiems::V20190416::DeleteRuntimeRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::DeleteRuntimeResponse` def DeleteRuntime(request) body = send_request('DeleteRuntime', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DeleteRuntimeResponse.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 DeleteService. # @type request: :class:`Tencentcloud::tiems::V20190416::DeleteServiceRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::DeleteServiceResponse` def DeleteService(request) body = send_request('DeleteService', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DeleteServiceResponse.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 DeleteServiceConfig. # @type request: :class:`Tencentcloud::tiems::V20190416::DeleteServiceConfigRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::DeleteServiceConfigResponse` def DeleteServiceConfig(request) body = send_request('DeleteServiceConfig', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DeleteServiceConfigResponse.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 DescribeInstances. # @type request: :class:`Tencentcloud::tiems::V20190416::DescribeInstancesRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::DescribeInstancesResponse` def DescribeInstances(request) body = send_request('DescribeInstances', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DescribeInstancesResponse.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 DescribeResourceGroups. # @type request: :class:`Tencentcloud::tiems::V20190416::DescribeResourceGroupsRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::DescribeResourceGroupsResponse` def DescribeResourceGroups(request) body = send_request('DescribeResourceGroups', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DescribeResourceGroupsResponse.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 DescribeRsgAsGroupActivities. # @type request: :class:`Tencentcloud::tiems::V20190416::DescribeRsgAsGroupActivitiesRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::DescribeRsgAsGroupActivitiesResponse` def DescribeRsgAsGroupActivities(request) body = send_request('DescribeRsgAsGroupActivities', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DescribeRsgAsGroupActivitiesResponse.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 DescribeRsgAsGroups. # @type request: :class:`Tencentcloud::tiems::V20190416::DescribeRsgAsGroupsRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::DescribeRsgAsGroupsResponse` def DescribeRsgAsGroups(request) body = send_request('DescribeRsgAsGroups', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DescribeRsgAsGroupsResponse.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 DescribeRuntimes. # @type request: :class:`Tencentcloud::tiems::V20190416::DescribeRuntimesRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::DescribeRuntimesResponse` def DescribeRuntimes(request) body = send_request('DescribeRuntimes', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DescribeRuntimesResponse.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 DescribeServiceConfigs. # @type request: :class:`Tencentcloud::tiems::V20190416::DescribeServiceConfigsRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::DescribeServiceConfigsResponse` def DescribeServiceConfigs(request) body = send_request('DescribeServiceConfigs', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DescribeServiceConfigsResponse.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 DescribeServices. # @type request: :class:`Tencentcloud::tiems::V20190416::DescribeServicesRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::DescribeServicesResponse` def DescribeServices(request) body = send_request('DescribeServices', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DescribeServicesResponse.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 DisableRsgAsGroup. # @type request: :class:`Tencentcloud::tiems::V20190416::DisableRsgAsGroupRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::DisableRsgAsGroupResponse` def DisableRsgAsGroup(request) body = send_request('DisableRsgAsGroup', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = DisableRsgAsGroupResponse.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 EnableRsgAsGroup. # @type request: :class:`Tencentcloud::tiems::V20190416::EnableRsgAsGroupRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::EnableRsgAsGroupResponse` def EnableRsgAsGroup(request) body = send_request('EnableRsgAsGroup', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = EnableRsgAsGroupResponse.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 ExposeService. # @type request: :class:`Tencentcloud::tiems::V20190416::ExposeServiceRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::ExposeServiceResponse` def ExposeService(request) body = send_request('ExposeService', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = ExposeServiceResponse.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 UpdateJob. # @type request: :class:`Tencentcloud::tiems::V20190416::UpdateJobRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::UpdateJobResponse` def UpdateJob(request) body = send_request('UpdateJob', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = UpdateJobResponse.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 UpdateRsgAsGroup. # @type request: :class:`Tencentcloud::tiems::V20190416::UpdateRsgAsGroupRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::UpdateRsgAsGroupResponse` def UpdateRsgAsGroup(request) body = send_request('UpdateRsgAsGroup', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = UpdateRsgAsGroupResponse.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 UpdateService. # @type request: :class:`Tencentcloud::tiems::V20190416::UpdateServiceRequest` # @rtype: :class:`Tencentcloud::tiems::V20190416::UpdateServiceResponse` def UpdateService(request) body = send_request('UpdateService', request.serialize) response = JSON.parse(body) if response['Response'].key?('Error') == false model = UpdateServiceResponse.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