Sha256: e7fb3a5fc2810bc8692fbc37568cda7aa4ccd37083adc626a542f7ec999d69fc

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

# Block storage actions and informations


module CMD
	class Volumes
		@client = Docli.client
		# volume_options = {
		# 	:size_gigabytes => integer,
		# 	:name => string,
		# 	:description => string,
		# 	:region => string,
		# 	:snapshot_id => string
		# }
		def self.create_new_volume volume_options
			new_volume = DropletKit::Volume.new(
				size_gigabytes: volume_options[size_gigabytes],
				name: volume_options[:name],
				description: volume_options[:description],
				region: volume_options[:region],
				snapshot_id: volume_options[:snapshot_id]
				)
			return @client.volumes.create(new_volume)
		end

		# options = {
		# 	volume_id => string / volume_name => string
		# 	droplet_id => integer
		# 	region =>
		# }
		def self.attach_volume_to_droplet options
			return @client.volume_actions.attach(options)
		end

		def self.list_all_volumes
			return @client.volumes.all
		end

		# options = {
		# 	volume_id => string / volume_name => string
		# 	droplet_id => integer
		# 	region =>
		# }
		def self.attach_volume_to_droplet options
			return @client.volume_actions.detach(options)
		end

		def self.retrieve_existing_volume volume_id
			return @client.volumes.find(id: volume_id)
		end

	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
docli-0.0.2.pre.alpha.pre.12 lib/cmd/volume.rb