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


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

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)

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

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


87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/fog/compute/google/models/target_https_proxy.rb', line 87

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


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/fog/compute/google/models/target_https_proxy.rb', line 24

def save
  requires :identity, :url_map, :ssl_certificates

  unless ssl_certificates.is_a?(Array)
    raise Fog::Errors::Error.new("ssl_certificates attribute must be an array")
  end

  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 { ready? }
  reload
end

#set_ssl_certificates(ssl_certificates, async = true) ⇒ Object


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

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


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

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

#ssl_certificatesArray<String>

Array of SSL Certificates , where 'cert_one' and 'cert_two' are instances of Fog::Compute::Google::SslCertificate

Examples:


[cert_one.self_link', cert_two.self_link]

Returns:

  • (Array<String>)

22
# File 'lib/fog/compute/google/models/target_https_proxy.rb', line 22

attribute :ssl_certificates, :aliases => "sslCertificates"