Sha256: 6d99513d9bdd9b188699adb1e7bd4b830282c1311f5d67860745ff0e1ea07e62

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

# Block storage actions and informations


module Cmd
	class Volumes
		# 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 Docli.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 Docli.client.volume_actions.attach(options)
		end

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

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

		def self.retrieve_existing_volume volume_id
			return Docli.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.15 lib/cmd/volume.rb