Class: OracleCloud::Instances

Inherits:
Assets
  • Object
show all
Defined in:
lib/oraclecloud/instances.rb

Instance Attribute Summary

Attributes inherited from Assets

#asset_klass, #asset_type, #client, #create_opts

Instance Method Summary collapse

Methods inherited from Assets

#all_asset_ids_by_container, #asset_ids_for_container, #by_name, #containers, #create, #create_request_payload, #directory, #ids_from_results, #initialize, #strip_identity_domain, #validate!, #validate_create_options!

Constructor Details

This class inherits a constructor from OracleCloud::Assets

Instance Method Details

#allObject



29
30
31
32
33
34
35
36
37
# File 'lib/oraclecloud/instances.rb', line 29

def all
  all_asset_ids_by_container.each_with_object([]) do |(container, instance_names), memo|
    instance_names.each do |instance_name|
      id   = instance_id_by_name(container, instance_name)
      path = "#{container}/#{instance_name}/#{id}"
      memo << OracleCloud::Instance.new(client, path)
    end
  end
end

#instance_id_by_name(container, name) ⇒ Object



25
26
27
# File 'lib/oraclecloud/instances.rb', line 25

def instance_id_by_name(container, name)
  directory("#{container}/#{name}").first
end

#local_initObject



20
21
22
23
# File 'lib/oraclecloud/instances.rb', line 20

def local_init
  @asset_type  = 'instance'
  @asset_klass = OracleCloud::Instance
end