class QingCloud::SDK::SnapshotService

Attributes

config[RW]
properties[RW]

Public Class Methods

new(config, properties) click to toggle source
# File lib/qingcloud/sdk/service/snapshot.rb, line 24
def initialize(config, properties)
  self.config     = config
  self.properties = properties.deep_symbolize_keys
end

Public Instance Methods

apply_snapshots(snapshots: []) click to toggle source

Documentation URL: docs.qingcloud.com/api/snapshot/apply_snapshots.html

# File lib/qingcloud/sdk/service/snapshot.rb, line 30
def apply_snapshots(snapshots: [])
  input = {
    config:         config,
    properties:     properties,
    api_name:       'ApplySnapshots',
    request_method: 'GET',
    request_params: {
      'snapshots' => snapshots,
    },
  }

  apply_snapshots_input_validate input

  request = Request.new input
  request.send
end
capture_instance_from_snapshot(image_name: '', snapshot: '') click to toggle source

Documentation URL: docs.qingcloud.com/api/snapshot/capture_instance_from_snapshot.html

# File lib/qingcloud/sdk/service/snapshot.rb, line 60
def capture_instance_from_snapshot(image_name: '', snapshot: '')
  input = {
    config:         config,
    properties:     properties,
    api_name:       'CaptureInstanceFromSnapshot',
    request_method: 'GET',
    request_params: {
      'image_name' => image_name,
      'snapshot'   => snapshot,
    },
  }

  capture_instance_from_snapshot_input_validate input

  request = Request.new input
  request.send
end
create_snapshots(is_full: nil, resources: [], snapshot_name: '') click to toggle source

Documentation URL: docs.qingcloud.com/api/snapshot/create_snapshots.html

# File lib/qingcloud/sdk/service/snapshot.rb, line 91
def create_snapshots(is_full: nil, resources: [], snapshot_name: '')
  input = {
    config:         config,
    properties:     properties,
    api_name:       'CreateSnapshots',
    request_method: 'GET',
    request_params: {
      'is_full'       => is_full, # is_full's available values: 0, 1
      'resources'     => resources,
      'snapshot_name' => snapshot_name,
    },
  }

  create_snapshots_input_validate input

  request = Request.new input
  request.send
end
create_volume_from_snapshot(snapshot: '', volume_name: '') click to toggle source

Documentation URL: docs.qingcloud.com/api/snapshot/create_volume_from_snapshot.html

# File lib/qingcloud/sdk/service/snapshot.rb, line 134
def create_volume_from_snapshot(snapshot: '', volume_name: '')
  input = {
    config:         config,
    properties:     properties,
    api_name:       'CreateVolumeFromSnapshot',
    request_method: 'GET',
    request_params: {
      'snapshot'    => snapshot,
      'volume_name' => volume_name,
    },
  }

  create_volume_from_snapshot_input_validate input

  request = Request.new input
  request.send
end
delete_snapshots(snapshots: []) click to toggle source

Documentation URL: docs.qingcloud.com/api/snapshot/delete_snapshots.html

# File lib/qingcloud/sdk/service/snapshot.rb, line 165
def delete_snapshots(snapshots: [])
  input = {
    config:         config,
    properties:     properties,
    api_name:       'DeleteSnapshots',
    request_method: 'GET',
    request_params: {
      'snapshots' => snapshots,
    },
  }

  delete_snapshots_input_validate input

  request = Request.new input
  request.send
end
describe_snapshots(limit: nil, offset: nil, resource_id: '', search_word: '', snapshot_type: nil, snapshots: [], status: [], tags: [], verbose: nil) click to toggle source

Documentation URL: docs.qingcloud.com/api/snapshot/describe_snapshots.html

# File lib/qingcloud/sdk/service/snapshot.rb, line 195
def describe_snapshots(limit: nil, offset: nil, resource_id: '', search_word: '', snapshot_type: nil, snapshots: [], status: [], tags: [], verbose: nil)
  input = {
    config:         config,
    properties:     properties,
    api_name:       'DescribeSnapshots',
    request_method: 'GET',
    request_params: {
      'limit'         => limit,
      'offset'        => offset,
      'resource_id'   => resource_id,
      'search_word'   => search_word,
      'snapshot_type' => snapshot_type, # snapshot_type's available values: 0, 1
      'snapshots'     => snapshots,
      'status'        => status,
      'tags'          => tags,
      'verbose'       => verbose, # verbose's available values: 0, 1
    },
  }

  describe_snapshots_input_validate input

  request = Request.new input
  request.send
end
modify_snapshot_attributes(description: '', snapshot: '', snapshot_name: '') click to toggle source

Documentation URL: docs.qingcloud.com/api/snapshot/modify_snapshot_attributes.html

# File lib/qingcloud/sdk/service/snapshot.rb, line 251
def modify_snapshot_attributes(description: '', snapshot: '', snapshot_name: '')
  input = {
    config:         config,
    properties:     properties,
    api_name:       'ModifySnapshotAttributes',
    request_method: 'GET',
    request_params: {
      'description'   => description,
      'snapshot'      => snapshot,
      'snapshot_name' => snapshot_name,
    },
  }

  modify_snapshot_attributes_input_validate input

  request = Request.new input
  request.send
end

Private Instance Methods

apply_snapshots_input_validate(input) click to toggle source
# File lib/qingcloud/sdk/service/snapshot.rb, line 49
def apply_snapshots_input_validate(input)
  input.deep_stringify_keys!

  unless !input['request_params']['snapshots'].nil? && !input['request_params']['snapshots'].to_s.empty?
    raise ParameterRequiredError.new('snapshots', 'ApplySnapshotsInput')
  end
end
capture_instance_from_snapshot_input_validate(input) click to toggle source
# File lib/qingcloud/sdk/service/snapshot.rb, line 80
def capture_instance_from_snapshot_input_validate(input)
  input.deep_stringify_keys!

  unless !input['request_params']['snapshot'].nil? && !input['request_params']['snapshot'].to_s.empty?
    raise ParameterRequiredError.new('snapshot', 'CaptureInstanceFromSnapshotInput')
  end
end
create_snapshots_input_validate(input) click to toggle source
# File lib/qingcloud/sdk/service/snapshot.rb, line 112
def create_snapshots_input_validate(input)
  input.deep_stringify_keys!

  if input['request_params']['is_full'] && !input['request_params']['is_full'].to_s.empty?
    is_full_valid_values = %w(0 1)
    unless is_full_valid_values.include? input['request_params']['is_full'].to_s
      raise ParameterValueNotAllowedError.new(
        'is_full',
        input['request_params']['is_full'],
        is_full_valid_values,
      )
    end
  end

  unless !input['request_params']['resources'].nil? && !input['request_params']['resources'].to_s.empty?
    raise ParameterRequiredError.new('resources', 'CreateSnapshotsInput')
  end
end
create_volume_from_snapshot_input_validate(input) click to toggle source
# File lib/qingcloud/sdk/service/snapshot.rb, line 154
def create_volume_from_snapshot_input_validate(input)
  input.deep_stringify_keys!

  unless !input['request_params']['snapshot'].nil? && !input['request_params']['snapshot'].to_s.empty?
    raise ParameterRequiredError.new('snapshot', 'CreateVolumeFromSnapshotInput')
  end
end
delete_snapshots_input_validate(input) click to toggle source
# File lib/qingcloud/sdk/service/snapshot.rb, line 184
def delete_snapshots_input_validate(input)
  input.deep_stringify_keys!

  unless !input['request_params']['snapshots'].nil? && !input['request_params']['snapshots'].to_s.empty?
    raise ParameterRequiredError.new('snapshots', 'DeleteSnapshotsInput')
  end
end
describe_snapshots_input_validate(input) click to toggle source
# File lib/qingcloud/sdk/service/snapshot.rb, line 222
def describe_snapshots_input_validate(input)
  input.deep_stringify_keys!

  if input['request_params']['snapshot_type'] && !input['request_params']['snapshot_type'].to_s.empty?
    snapshot_type_valid_values = %w(0 1)
    unless snapshot_type_valid_values.include? input['request_params']['snapshot_type'].to_s
      raise ParameterValueNotAllowedError.new(
        'snapshot_type',
        input['request_params']['snapshot_type'],
        snapshot_type_valid_values,
      )
    end
  end

  if input['request_params']['verbose'] && !input['request_params']['verbose'].to_s.empty?
    verbose_valid_values = %w(0 1)
    unless verbose_valid_values.include? input['request_params']['verbose'].to_s
      raise ParameterValueNotAllowedError.new(
        'verbose',
        input['request_params']['verbose'],
        verbose_valid_values,
      )
    end
  end
end
modify_snapshot_attributes_input_validate(input) click to toggle source
# File lib/qingcloud/sdk/service/snapshot.rb, line 272
def modify_snapshot_attributes_input_validate(input)
  input.deep_stringify_keys!

  unless !input['request_params']['snapshot'].nil? && !input['request_params']['snapshot'].to_s.empty?
    raise ParameterRequiredError.new('snapshot', 'ModifySnapshotAttributesInput')
  end
end