class Fog::Volume::OpenStack::V1::Real

Public Class Methods

new(options = {}) click to toggle source
# File lib/fog/openstack/volume_v1.rb, line 146
def initialize(options = {})
  initialize_identity options

  @openstack_service_type  = options[:openstack_service_type] || ['volume']
  @openstack_service_name  = options[:openstack_service_name]
  @openstack_endpoint_type = options[:openstack_endpoint_type] || 'adminURL'

  @connection_options = options[:connection_options] || {}

  authenticate

  unless @path.match(SUPPORTED_VERSIONS)
    @path = Fog::OpenStack.get_supported_version_path(SUPPORTED_VERSIONS,
                                                      @openstack_management_uri,
                                                      @auth_token,
                                                      @connection_options)
  end

  @persistent = options[:persistent] || false
  @connection = Fog::Core::Connection.new("#{@scheme}://#{@host}:#{@port}", @persistent, @connection_options)
end
not_found_class() click to toggle source
# File lib/fog/openstack/volume_v1.rb, line 141
def self.not_found_class
  Fog::Volume::OpenStack::NotFound
end

Public Instance Methods

create_snapshot(volume_id, name, description, force = false) click to toggle source
# File lib/fog/openstack/requests/volume_v1/create_snapshot.rb, line 10
def create_snapshot(volume_id, name, description, force = false)
  data = {
    'snapshot' => {
      'volume_id'           => volume_id,
      'display_name'        => name,
      'display_description' => description,
      'force'               => force.nil? ? false : force
    }
  }

  _create_snapshot(data)
end
create_volume(name, description, size, options={}) click to toggle source
# File lib/fog/openstack/requests/volume_v1/create_volume.rb, line 8
def create_volume(name, description, size, options={})
  data = {
      'volume' => {
          'display_name'        => name,
          'display_description' => description,
          'size'                => size
      }
  }

  _create_volume(data, options)
end