Class: GoogleCloudCompute::ComputeCollection

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
app/lib/google_cloud_compute/compute_collection.rb

Instance Method Summary collapse

Constructor Details

#initialize(client, zone, attrs) ⇒ ComputeCollection

Returns a new instance of ComputeCollection.



5
6
7
8
9
10
11
12
13
# File 'app/lib/google_cloud_compute/compute_collection.rb', line 5

def initialize(client, zone, attrs)
  instances = client.instances(zone, attrs)
  @virtual_machines = instances.map do |vm|
    ForemanGoogle::GoogleCompute.new client: client,
      zone: zone,
      identity: vm.id,
      instance: vm
  end
end

Instance Method Details

#all(_opts = {}) ⇒ Object



19
20
21
# File 'app/lib/google_cloud_compute/compute_collection.rb', line 19

def all(_opts = {})
  @virtual_machines
end

#each(&block) ⇒ Object



15
16
17
# File 'app/lib/google_cloud_compute/compute_collection.rb', line 15

def each(&block)
  @virtual_machines.each(&block)
end