Class: Fog::Compute::Google::GlobalAddress

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

Overview

Represents an Address resource

Constant Summary collapse

IN_USE_STATE =
"IN_USE".freeze
RESERVED_STATE =
"RESERVED".freeze

Instance Method Summary collapse

Instance Method Details

#destroy(async = true) ⇒ Object


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

def destroy(async = true)
  requires :identity

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

#in_use?Boolean

Returns:

  • (Boolean)

52
53
54
# File 'lib/fog/compute/google/models/global_address.rb', line 52

def in_use?
  status == IN_USE_STATE
end

#reloadObject


44
45
46
47
48
49
50
# File 'lib/fog/compute/google/models/global_address.rb', line 44

def reload
  requires :identity

  data = collection.get(identity)
  merge_attributes(data.attributes)
  self
end

#saveObject


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

def save
  requires :identity

  data = service.insert_global_address(identity, attributes)
  operation = Fog::Compute::Google::Operations.new(:service => service)
                                              .get(data.name)
  operation.wait_for { !pending? }
  reload
end