Class: Fog::Brightbox::Compute::LoadBalancer

Inherits:
Model
  • Object
show all
Includes:
ResourceLocking
Defined in:
lib/fog/brightbox/models/compute/load_balancer.rb

Instance Method Summary collapse

Methods included from ResourceLocking

#lock!, #locked?, #unlock!

Methods included from ModelHelper

#collection_name, #resource_name

Instance Method Details

#certificate=(cert_metadata) ⇒ Object

Sets the certificate metadata from the JSON object that contains it.

It is used by fog’s attribute setting and should not be used for attempting to set a certificate on a load balancer.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/fog/brightbox/models/compute/load_balancer.rb', line 90

def certificate=()
  if 
    attributes[:certificate_valid_from] = time_or_original(["valid_from"])
    attributes[:certificate_expires_at] = time_or_original(["expires_at"])
    attributes[:certificate_issuer] = ["issuer"]
    attributes[:certificate_subject] = ["subject"]
    attributes[:certificate_enable_ssl3] = ["sslv3"]
  else
    attributes[:certificate_valid_from] = nil
    attributes[:certificate_expires_at] = nil
    attributes[:certificate_issuer] = nil
    attributes[:certificate_subject] = nil
    attributes[:certificate_enable_ssl3] = nil
  end
end

#certificate_expires_atObject

SSL cert metadata for expiration of certificate



75
76
77
# File 'lib/fog/brightbox/models/compute/load_balancer.rb', line 75

def certificate_expires_at
  attributes[:certificate_expires_at]
end

#certificate_subjectObject

SSL cert metadata for subject



80
81
82
# File 'lib/fog/brightbox/models/compute/load_balancer.rb', line 80

def certificate_subject
  attributes[:certificate_subject]
end

#destroyObject



68
69
70
71
72
# File 'lib/fog/brightbox/models/compute/load_balancer.rb', line 68

def destroy
  requires :identity
  service.delete_load_balancer(identity)
  true
end

#ready?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/fog/brightbox/models/compute/load_balancer.rb', line 44

def ready?
  status == "active"
end

#saveObject

Raises:

  • (Fog::Errors::Error)


48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/fog/brightbox/models/compute/load_balancer.rb', line 48

def save
  raise Fog::Errors::Error.new("Resaving an existing object may create a duplicate") if persisted?
  requires :nodes, :listeners, :healthcheck
  options = {
    :nodes => nodes,
    :listeners => listeners,
    :healthcheck => healthcheck,
    :policy => policy,
    :name => name,
    :domains => domains,
    :buffer_size => buffer_size,
    :certificate_pem => certificate_pem,
    :certificate_private_key => certificate_private_key,
    :sslv3 => ssl3?
  }.delete_if { |_k, v| v.nil? || v == "" }
  data = service.create_load_balancer(options)
  merge_attributes(data)
  true
end

#ssl3?Boolean

Returns:

  • (Boolean)


106
107
108
# File 'lib/fog/brightbox/models/compute/load_balancer.rb', line 106

def ssl3?
  !!attributes[:certificate_enable_ssl3]
end