Module: Fog::OpenStack::Core

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#auth_tokenObject

Returns the value of attribute auth_token.



59
60
61
# File 'lib/fog/openstack/core.rb', line 59

def auth_token
  @auth_token
end

#auth_token_expirationObject (readonly)

Returns the value of attribute auth_token_expiration.



60
61
62
# File 'lib/fog/openstack/core.rb', line 60

def auth_token_expiration
  @auth_token_expiration
end

#current_tenantObject (readonly)

Returns the value of attribute current_tenant.



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

def current_tenant
  @current_tenant
end

#current_userObject (readonly)

Returns the value of attribute current_user.



61
62
63
# File 'lib/fog/openstack/core.rb', line 61

def current_user
  @current_user
end

#current_user_idObject (readonly)

Returns the value of attribute current_user_id.



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

def current_user_id
  @current_user_id
end

#openstack_domain_idObject (readonly)

Returns the value of attribute openstack_domain_id.



67
68
69
# File 'lib/fog/openstack/core.rb', line 67

def openstack_domain_id
  @openstack_domain_id
end

#openstack_domain_nameObject (readonly)

Returns the value of attribute openstack_domain_name.



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

def openstack_domain_name
  @openstack_domain_name
end

#openstack_project_domainObject (readonly)

Returns the value of attribute openstack_project_domain.



66
67
68
# File 'lib/fog/openstack/core.rb', line 66

def openstack_project_domain
  @openstack_project_domain
end

#openstack_project_domain_idObject (readonly)

Returns the value of attribute openstack_project_domain_id.



69
70
71
# File 'lib/fog/openstack/core.rb', line 69

def openstack_project_domain_id
  @openstack_project_domain_id
end

#openstack_user_domainObject (readonly)

Returns the value of attribute openstack_user_domain.



65
66
67
# File 'lib/fog/openstack/core.rb', line 65

def openstack_user_domain
  @openstack_user_domain
end

#openstack_user_domain_idObject (readonly)

Returns the value of attribute openstack_user_domain_id.



68
69
70
# File 'lib/fog/openstack/core.rb', line 68

def openstack_user_domain_id
  @openstack_user_domain_id
end

Instance Method Details

#credentialsObject



100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/fog/openstack/core.rb', line 100

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



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/fog/openstack/core.rb', line 71

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'

  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



113
114
115
# File 'lib/fog/openstack/core.rb', line 113

def reload
  @connection.reset
end