Class: Fog::Volume::OpenStack::V1::Real

Inherits:
Object
  • Object
show all
Includes:
OpenStack::Core, Real
Defined in:
lib/fog/volume/openstack/v1.rb,
lib/fog/volume/openstack/v1/requests/real.rb,
lib/fog/volume/openstack/v1/requests/real_mock.rb,
lib/fog/volume/openstack/v1/requests/list_volumes.rb,
lib/fog/volume/openstack/v1/requests/create_volume.rb,
lib/fog/volume/openstack/v1/requests/create_snapshot.rb,
lib/fog/volume/openstack/v1/requests/get_volume_details.rb,
lib/fog/volume/openstack/v1/requests/get_snapshot_details.rb,
lib/fog/volume/openstack/v1/requests/list_volumes_detailed.rb

Instance Attribute Summary

Attributes included from OpenStack::Core

#auth_token, #auth_token_expiration, #current_tenant, #current_user, #current_user_id, #openstack_cache_ttl, #openstack_domain_id, #openstack_domain_name, #openstack_identity_prefix, #openstack_project_domain, #openstack_project_domain_id, #openstack_project_id, #openstack_user_domain, #openstack_user_domain_id, #unscoped_token

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Real

#accept_transfer, #action, #create_backup, #create_transfer, #create_volume_type, #delete_backup, #delete_metadata, #delete_snapshot, #delete_snapshot_metadata, #delete_transfer, #delete_volume, #delete_volume_type, #extend_volume, #get_backup_details, #get_quota, #get_quota_defaults, #get_quota_usage, #get_snapshot_details, #get_transfer_details, #get_volume_details, #get_volume_type_details, #list_backups, #list_backups_detailed, #list_snapshots, #list_snapshots_detailed, #list_transfers, #list_transfers_detailed, #list_volume_types, #list_volumes, #list_volumes_detailed, #list_zones, #replace_metadata, #restore_backup, #set_tenant, #update_metadata, #update_quota, #update_snapshot, #update_snapshot_metadata, #update_volume, #update_volume_type

Methods included from OpenStack::Core

#credentials, #initialize_identity, #reload

Constructor Details

#initialize(options = {}) ⇒ Real


155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# 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

Class Method Details

.not_found_classObject


151
152
153
# File 'lib/fog/volume/openstack/v1.rb', line 151

def self.not_found_class
  Fog::Volume::OpenStack::NotFound
end

Instance Method Details

#create_snapshot(volume_id, name, description, force = false) ⇒ Object


10
11
12
13
14
15
16
17
18
19
20
21
# 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 = {}) ⇒ Object


8
9
10
11
12
13
14
15
16
17
18
# 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_pathObject


171
172
173
174
175
176
177
178
# 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