Class: Fog::Compute::Google::Subnetwork

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/compute/google/models/subnetwork.rb

Overview

Represents a Subnetwork resource

Instance Method Summary collapse

Instance Method Details

#destroy(async = true) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/fog/compute/google/models/subnetwork.rb', line 33

def destroy(async = true)
  requires :identity, :region

  data = service.delete_subnetwork(identity, region)
  operation = Fog::Compute::Google::Operations.new(:service => service)
                                              .get(data.name, nil, data.region)
  operation.wait_for { ready? } unless async
  operation
end

#expand_ip_cidr_range(range, async = true) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/fog/compute/google/models/subnetwork.rb', line 48

def expand_ip_cidr_range(range, async = true)
  requires :identity, :region

  data = service.expand_subnetwork_ip_cidr_range(
    identity, region, range
  )
  operation = Fog::Compute::Google::Operations.new(:service => service)
                                              .get(data.name, nil, data.region)
  operation.wait_for { ready? } unless async
  reload
end

#reloadObject



73
74
75
76
77
78
79
# File 'lib/fog/compute/google/models/subnetwork.rb', line 73

def reload
  requires :identity, :region

  data = collection.get(identity, region.split("/")[-1])
  merge_attributes(data.attributes)
  self
end

#saveObject



23
24
25
26
27
28
29
30
31
# File 'lib/fog/compute/google/models/subnetwork.rb', line 23

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.name, nil, data.region)
  operation.wait_for { ready? }
  reload
end

#set_private_ip_google_access(access, async = true) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/fog/compute/google/models/subnetwork.rb', line 60

def set_private_ip_google_access(access, async = true)
  requires :identity, :region

  data = service.set_subnetwork_private_ip_google_access(
    identity, region, access
  )
  operation = Fog::Compute::Google::Operations.new(:service => service)
                                              .get(data.name, nil, data.region)

  operation.wait_for { ready? } unless async
  reload
end

#update_interface_config(network_interface) ⇒ Object



43
44
45
46
# File 'lib/fog/compute/google/models/subnetwork.rb', line 43

def update_interface_config(network_interface)
  network_interface["subnetwork"] = self_link if network_interface
  network_interface
end