Module: Fog::OpenStack::Core

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#auth_tokenObject

Returns the value of attribute auth_token.



4
5
6
# File 'lib/fog/openstack/core.rb', line 4

def auth_token
  @auth_token
end

#auth_token_expirationObject (readonly)

Returns the value of attribute auth_token_expiration.



6
7
8
# File 'lib/fog/openstack/core.rb', line 6

def auth_token_expiration
  @auth_token_expiration
end

#current_tenantObject (readonly)

Returns the value of attribute current_tenant.



9
10
11
# File 'lib/fog/openstack/core.rb', line 9

def current_tenant
  @current_tenant
end

#current_userObject (readonly)

Returns the value of attribute current_user.



7
8
9
# File 'lib/fog/openstack/core.rb', line 7

def current_user
  @current_user
end

#current_user_idObject (readonly)

Returns the value of attribute current_user_id.



8
9
10
# File 'lib/fog/openstack/core.rb', line 8

def current_user_id
  @current_user_id
end

#openstack_cache_ttlObject (readonly)

Returns the value of attribute openstack_cache_ttl.



5
6
7
# File 'lib/fog/openstack/core.rb', line 5

def openstack_cache_ttl
  @openstack_cache_ttl
end

#openstack_domain_idObject (readonly)

Returns the value of attribute openstack_domain_id.



13
14
15
# File 'lib/fog/openstack/core.rb', line 13

def openstack_domain_id
  @openstack_domain_id
end

#openstack_domain_nameObject (readonly)

Returns the value of attribute openstack_domain_name.



10
11
12
# File 'lib/fog/openstack/core.rb', line 10

def openstack_domain_name
  @openstack_domain_name
end

#openstack_identity_prefixObject (readonly)

Returns the value of attribute openstack_identity_prefix.



17
18
19
# File 'lib/fog/openstack/core.rb', line 17

def openstack_identity_prefix
  @openstack_identity_prefix
end

#openstack_project_domainObject (readonly)

Returns the value of attribute openstack_project_domain.



12
13
14
# File 'lib/fog/openstack/core.rb', line 12

def openstack_project_domain
  @openstack_project_domain
end

#openstack_project_domain_idObject (readonly)

Returns the value of attribute openstack_project_domain_id.



16
17
18
# File 'lib/fog/openstack/core.rb', line 16

def openstack_project_domain_id
  @openstack_project_domain_id
end

#openstack_project_idObject (readonly)

Returns the value of attribute openstack_project_id.



15
16
17
# File 'lib/fog/openstack/core.rb', line 15

def openstack_project_id
  @openstack_project_id
end

#openstack_user_domainObject (readonly)

Returns the value of attribute openstack_user_domain.



11
12
13
# File 'lib/fog/openstack/core.rb', line 11

def openstack_user_domain
  @openstack_user_domain
end

#openstack_user_domain_idObject (readonly)

Returns the value of attribute openstack_user_domain_id.



14
15
16
# File 'lib/fog/openstack/core.rb', line 14

def openstack_user_domain_id
  @openstack_user_domain_id
end

Instance Method Details

#credentialsObject



50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/fog/openstack/core.rb', line 50

def credentials
options =  {
  :provider                    => 'openstack',
  :openstack_auth_url          => @openstack_auth_uri.to_s,
  :openstack_auth_token        => @auth_token,
  :openstack_identity_endpoint => @openstack_identity_public_endpoint,
  :current_user                => @current_user,
  :current_user_id             => @current_user_id,
  :current_tenant              => @current_tenant,
  :unscoped_token              => @unscoped_token}
  openstack_options.merge options
end

#initialize_identity(options) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/fog/openstack/core.rb', line 19

def initialize_identity options
  # Create @openstack_* instance variables from all :openstack_* options
  options.select{|x|x.to_s.start_with? 'openstack'}.each do |openstack_param, value|
    instance_variable_set "@#{openstack_param}".to_sym, value
  end

  @auth_token        ||= options[:openstack_auth_token]
  @openstack_identity_public_endpoint = options[:openstack_identity_endpoint]

  @openstack_auth_uri    = URI.parse(options[:openstack_auth_url])
  @openstack_must_reauthenticate  = false
  @openstack_endpoint_type = options[:openstack_endpoint_type] || 'publicURL'

  @openstack_cache_ttl = options[:openstack_cache_ttl] || 0

  unless @auth_token
    missing_credentials = Array.new

    missing_credentials << :openstack_api_key unless @openstack_api_key
    unless @openstack_username || @openstack_userid
      missing_credentials << 'openstack_username or openstack_userid'
    end
    raise ArgumentError, "Missing required arguments: #{missing_credentials.join(', ')}" unless missing_credentials.empty?
  end

  @current_user = options[:current_user]
  @current_user_id = options[:current_user_id]
  @current_tenant = options[:current_tenant]

end

#reloadObject



63
64
65
# File 'lib/fog/openstack/core.rb', line 63

def reload
  @connection.reset
end