Class: OracleCloud::ImageLists

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ImageLists

Returns a new instance of ImageLists.



22
23
24
# File 'lib/oraclecloud/imagelists.rb', line 22

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



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

def client
  @client
end

Instance Method Details

#allObject



26
27
28
# File 'lib/oraclecloud/imagelists.rb', line 26

def all
  public_imagelists + private_imagelists
end

#exist?(imagelist_name) ⇒ Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/oraclecloud/imagelists.rb', line 41

def exist?(imagelist_name)
  all.any? { |x| x.name == imagelist_name }
end

#private_imagelistsObject



36
37
38
39
# File 'lib/oraclecloud/imagelists.rb', line 36

def private_imagelists
  # TODO: tracked in PE-47
  []
end

#public_imagelistsObject



30
31
32
33
34
# File 'lib/oraclecloud/imagelists.rb', line 30

def public_imagelists
  client.http_get(:single, '/imagelist/oracle/public/')['result'].each_with_object([]) do |imagelist, memo|
    memo << OracleCloud::ImageList.new(imagelist)
  end
end