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

Public Class Methods

new(options = {}) click to toggle source
# File lib/fog/volume/openstack/v1.rb, line 155
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
  set_api_path

  @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/volume/openstack/v1.rb, line 151
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/volume/openstack/v1/requests/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/volume/openstack/v1/requests/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
set_api_path() click to toggle source
# File lib/fog/volume/openstack/v1.rb, line 171
def set_api_path
  unless @path.match(SUPPORTED_VERSIONS)
    @path = Fog::OpenStack.get_supported_version_path(SUPPORTED_VERSIONS,
                                                      @openstack_management_uri,
                                                      @auth_token,
                                                      @connection_options)
  end
end