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

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

Instance Attribute Summary

Attributes included from OpenStack::Common

#unscoped_token

Attributes included from OpenStack::Core

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Real

#accept_transfer, #create_transfer, #create_volume_type, #delete_snapshot, #delete_transfer, #delete_volume, #delete_volume_type, #extend_volume, #get_quota, #get_quota_defaults, #get_quota_usage, #get_snapshot_details, #get_transfer_details, #get_volume_details, #get_volume_type_details, #list_snapshots, #list_snapshots_detailed, #list_transfers, #list_transfers_detailed, #list_volume_types, #list_volumes, #list_volumes_detailed, #list_zones, #set_tenant, #update_quota, #update_volume_type

Methods included from OpenStack::Common

#request

Methods included from OpenStack::Core

#credentials, #initialize_identity, #reload

Constructor Details

#initialize(options = {}) ⇒ Real

Returns a new instance of Real.



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/fog/openstack/volume_v1.rb', line 135

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

Class Method Details

.not_found_classObject



130
131
132
# File 'lib/fog/openstack/volume_v1.rb', line 130

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

Instance Method Details

#create_volume(name, description, size, options = {}) ⇒ Object



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

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



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fog/openstack/requests/volume_v1/create_volume_snapshot.rb', line 6

def create_volume_snapshot(volume_id, name, description, force=false)
  data = {
      'snapshot' => {
          'volume_id'           => volume_id,
          'display_name'        => name,
          'display_description' => description,
          'force'               => force
      }
  }

  _create_volume_snapshot(data)
end