Class: ConohaApi::Client

Inherits:
Object
  • Object
show all
Includes:
Authentication, Compute, Identity, Configurable, Connection
Defined in:
lib/conoha_api/client.rb,
lib/conoha_api/client/compute.rb,
lib/conoha_api/client/identity.rb

Defined Under Namespace

Modules: Compute, Identity

Constant Summary

Constants included from Identity

Identity::SERVICE

Constants included from Compute

Compute::SERVICE

Instance Attribute Summary

Attributes included from Authentication

#token_expire_time

Attributes included from Configurable

#api_endpoint, #connection_options, #login, #middleware, #password, #proxy, #raise_error, #tenant_id

Attributes included from Connection

#current_connection

Instance Method Summary collapse

Methods included from Identity

#identity_version, #tokens

Methods included from Compute

#add_keypair, #add_server, #change_console_keymap, #change_network_adapter, #change_strage_controller, #change_video_device, #confirm_resize, #create_image, #delete_keypair, #delete_server, #flavor, #flavors, #flavors_detail, #force_stop_server, #get_web_console, #image, #images, #images_detail, #keypair, #keypairs, #mount_iso_image, #reboot_server, #rebuild_server, #resize, #revert_resize, #server, #servers, #servers_detail, #start_server, #stop_server, #unmount_iso_image, #vnc

Methods included from Authentication

#ready_for_authentication?, #token_expired?, #token_expires

Methods included from Configurable

#configure, keys

Methods included from Connection

#delete, #get, #post, #put

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



21
22
23
24
25
26
# File 'lib/conoha_api/client.rb', line 21

def initialize(options = {})
  Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", options[key] || ConohaApi.instance_variable_get(:"@#{key}"))
  end
  credential
end

Instance Method Details

#credentialObject



32
33
34
35
# File 'lib/conoha_api/client.rb', line 32

def credential
  @credential = nil if token_expired?
  @credential ||= auth
end

#endpointsObject



28
29
30
# File 'lib/conoha_api/client.rb', line 28

def endpoints
  @@endpoints
end