Sha256: 1015a1b48e35dc208e4765d4464a610c4535b2c10018d8832e9dd785d15ac92b
Contents?: true
Size: 1.65 KB
Versions: 4
Compression:
Stored size: 1.65 KB
Contents
module Fog module Compute class Google ## # Represents a Network resource # # @see https://developers.google.com/compute/docs/reference/latest/networks class Network < Fog::Model identity :name attribute :kind attribute :id attribute :ipv4_range, :aliases => "IPv4Range" attribute :creation_timestamp, :aliases => "creationTimestamp" attribute :description attribute :gateway_ipv4, :aliases => "gatewayIPv4" attribute :self_link, :aliases => "selfLink" def save requires :identity, :ipv4_range data = service.insert_network(identity, ipv4_range, attributes) operation = Fog::Compute::Google::Operations.new(:service => service).get(data.body["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 def destroy(async = true) requires :identity data = service.delete_network(identity) operation = Fog::Compute::Google::Operations.new(:service => service).get(data.body["name"]) operation.wait_for { ready? } unless async operation end # Returns a ready API structure for insert_instance, used in insert_server request. def get_as_interface_config(access_config = nil) network_interface = { "network" => self_link } network_interface["accessConfigs"] = [access_config] if access_config network_interface end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems