Class: Fog::Compute::Google::Network
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Google::Network
- Defined in:
- lib/fog/compute/google/models/network.rb
Overview
Represents a Network resource
Instance Method Summary collapse
- #destroy(async = true) ⇒ Object
-
#get_as_interface_config(access_config = nil) ⇒ Object
Returns a ready API structure for insert_instance, used in insert_server request.
- #save ⇒ Object
Instance Method Details
#destroy(async = true) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# 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) ⇒ Object
Returns a ready API structure for insert_instance, used in insert_server request.
52 53 54 55 56 |
# 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 ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fog/compute/google/models/network.rb', line 29 def save requires :identity 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 |