Sha256: 6e9ef76ba66fd67ae36d955d0913047edf7183158a03aa1ea282fbe28d6b190b

Contents?: true

Size: 1.6 KB

Versions: 2

Compression:

Stored size: 1.6 KB

Contents

module EC2

  class Base

    def describe_volumes( options = {} )
      options = { :volume_id => [] }.merge(options)
      params = pathlist("VolumeId", options[:volume_id])

      return response_generator(:action => "DescribeVolumes", :params => params)
    end

    def attach_volumes( options = {} )
      options = { :volume_id => '', :instance_id => '' }.merge(options)
      raise ArgumentError, "No ':volume_id' provided" if options[:volume_id].nil? || options[:volume_id].empty?
      raise ArgumentError, "No ':instance_id' provided" if options[:instance_id].nil? || options[:instance_id].empty?

      params = { "VolumeId" => options[:volume_id], "InstanceId" => options[:instance_id] }
      return response_generator(:action => "AttachVolume", :params => params)
    end

    def delete_volume( options = {} )
      options = { :volume_id => '' }.merge(options)
      raise ArgumentError, "No ':volume_id' provided" if options[:volume_id].nil? || options[:v].empty?

      params = { "VolumeId" => options[:volume_id] }
      return response_generator(:action => "DeleteVolume", :params => params)      
    end
    
    def detach_volumes( options = {} )
      options = { :volume_id => '', :instance_id => '', :device => '', :force => false }.merge(options)
      raise ArgumentError, "No ':volume_id' provided" if options[:volume_id].nil? || options[:volume_id].empty?

      params = { "VolumeId" => options[:volume_id], "InstanceId" => options[:instance_id], 'Device' => options[:device], 'Force' => options[:force] }
      return response_generator(:action => "DetachVolume", :params => params)
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
skippy-amazon-ec2-0.0.2 lib/EC2/volumes.rb
skippy-amazon-ec2-0.2.16 lib/EC2/volumes.rb