Class: Fog::Compute::Google::Subnetwork
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Google::Subnetwork
- Defined in:
- lib/fog/compute/google/models/subnetwork.rb
Overview
Represents a Subnetwork resource
Instance Method Summary collapse
- #destroy(async = true) ⇒ Object
- #reload ⇒ Object
- #save ⇒ Object
- #update_interface_config(network_interface) ⇒ Object
Instance Method Details
#destroy(async = true) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/fog/compute/google/models/subnetwork.rb', line 30 def destroy(async = true) requires :identity, :region data = service.delete_subnetwork(identity, region) operation = Fog::Compute::Google::Operations.new(:service => service).get(data.body["name"], nil, data.body["region"]) operation.wait_for { ready? } unless async operation end |
#reload ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/fog/compute/google/models/subnetwork.rb', line 44 def reload requires :identity, :region data = collection.get(identity, region.split("/")[-1]) merge_attributes(data.attributes) self end |
#save ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/fog/compute/google/models/subnetwork.rb', line 21 def save requires :identity, :network, :region, :ip_cidr_range data = service.insert_subnetwork(identity, region, network, ip_cidr_range, attributes) operation = Fog::Compute::Google::Operations.new(:service => service).get(data.body["name"], nil, data.body["region"]) operation.wait_for { !pending? } reload end |
#update_interface_config(network_interface) ⇒ Object
39 40 41 42 |
# File 'lib/fog/compute/google/models/subnetwork.rb', line 39 def update_interface_config(network_interface) network_interface["subnetwork"] = self_link if network_interface network_interface end |