class Fog::Compute::Google::Network

Represents a Network resource

@see developers.google.com/compute/docs/reference/latest/networks

Public Instance Methods

destroy(async = true) click to toggle source
# File lib/fog/compute/google/models/network.rb, line 41
def destroy(async = true)
  requires :identity

  data = service.delete_network(identity)
  operation = Fog::Compute::Google::Operations.new(:service => service)
                                              .get(data.name)
  operation.wait_for { ready? } unless async
  operation
end
get_as_interface_config(access_config = nil) click to toggle source

Returns a ready API structure for insert_instance, used in insert_server request.

# File lib/fog/compute/google/models/network.rb, line 52
def get_as_interface_config(access_config = nil)
  network_interface = { :network => self_link }
  network_interface[:access_configs] = [access_config] if access_config
  network_interface
end
save() click to toggle source
# File lib/fog/compute/google/models/network.rb, line 29
def save
  requires :identity, :ipv4_range

  data = service.insert_network(identity, attributes)
  operation = Fog::Compute::Google::Operations.new(:service => service)
                                              .get(data.name)
  # Since network has no "state" we can query, we have to wait for the operation to finish
  # TODO: change back to async when there's a proper state API
  operation.wait_for { ready? }
  reload
end