Class: Fog::Compute::Google::TargetHttpsProxy

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

Constant Summary collapse

RUNNING_STATE =
"READY".freeze

Instance Method Summary collapse

Instance Method Details

#destroy(async = true) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/fog/compute/google/models/target_https_proxy.rb', line 30

def destroy(async = true)
  requires :identity

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

#ready?Boolean

Returns:

  • (Boolean)


64
65
66
67
68
69
70
71
72
# File 'lib/fog/compute/google/models/target_https_proxy.rb', line 64

def ready?
  requires :identity

  service.get_target_https_proxy(identity)
  true
rescue ::Google::Apis::ClientError => e
  raise e unless e.status_code == 404
  false
end

#reloadObject



74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/fog/compute/google/models/target_https_proxy.rb', line 74

def reload
  requires :identity

  return unless data = begin
    collection.get(identity)
  rescue Excon::Errors::SocketError
    nil
  end

  new_attributes = data.attributes
  merge_attributes(new_attributes)
  self
end

#saveObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/fog/compute/google/models/target_https_proxy.rb', line 15

def save
  requires :identity, :url_map, :ssl_certificates

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

#set_ssl_certificates(ssl_certificates, async = true) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/fog/compute/google/models/target_https_proxy.rb', line 52

def set_ssl_certificates(ssl_certificates, async = true)
  requires :identity

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

#set_url_map(url_map, async = true) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/fog/compute/google/models/target_https_proxy.rb', line 40

def set_url_map(url_map, async = true)
  requires :identity

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