Sha256: e23ff55aa838ab84c724753d7eef1095ef206f1513e0f13f624116aea70e65c4
Contents?: true
Size: 1.27 KB
Versions: 9
Compression:
Stored size: 1.27 KB
Contents
module Fog module Compute class QingCloud class Real # Start specified instance # {API Reference}[https://docs.qingcloud.com/api/instance/start_instances.html] def start_instances(instance_id) params = Fog::QingCloud.indexed_param('instances', instance_id).merge('action' => 'StartInstances') request(params) end end class Mock def start_instances(instance_id) instance_ids = Array(instance_id) instance_set = self.data[:instances].select {|id, s| instance_ids.include?(id) } if instance_set.empty? raise Fog::QingCloud::Errors::NotFound, "The instance ID '#{instance_ids.join(', ')}' does not exist" else instance_set.map! do |x| x['status'] = 'pending' x['transition_status'] = 'starting' self.data[:modified_at][x['instance_id']] = Time.now x end response = Excon::Response.new response.status = 200 response.body = { 'action' => 'StartInstancesResponse', 'job_id' => Fog::QingCloud::Mock.job_id, 'ret_code' => 0 } response end end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems