class Fog::Compute::Brightbox::LoadBalancer

Public Instance Methods

certificate=(cert_metadata) click to toggle source

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.

@private

# File lib/fog/brightbox/models/compute/load_balancer.rb, line 86
def certificate=(cert_metadata)
  if cert_metadata
    attributes[:certificate_valid_from] = time_or_original(cert_metadata["valid_from"])
    attributes[:certificate_expires_at] = time_or_original(cert_metadata["expires_at"])
    attributes[:certificate_issuer] = cert_metadata["issuer"]
    attributes[:certificate_subject] = cert_metadata["subject"]
    attributes[:certificate_enable_ssl3] = cert_metadata["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_at() click to toggle source

SSL cert metadata for expiration of certificate

# File lib/fog/brightbox/models/compute/load_balancer.rb, line 71
def certificate_expires_at
  attributes[:certificate_expires_at]
end
certificate_subject() click to toggle source

SSL cert metadata for subject

# File lib/fog/brightbox/models/compute/load_balancer.rb, line 76
def certificate_subject
  attributes[:certificate_subject]
end
destroy() click to toggle source
# File lib/fog/brightbox/models/compute/load_balancer.rb, line 64
def destroy
  requires :identity
  service.destroy_load_balancer(identity)
  true
end
ready?() click to toggle source
# File lib/fog/brightbox/models/compute/load_balancer.rb, line 41
def ready?
  status == "active"
end
save() click to toggle source
# File lib/fog/brightbox/models/compute/load_balancer.rb, line 45
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,
    :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?() click to toggle source
# File lib/fog/brightbox/models/compute/load_balancer.rb, line 102
def ssl3?
  !!attributes[:certificate_enable_ssl3]
end

Private Instance Methods

time_or_original(value) click to toggle source
# File lib/fog/brightbox/models/compute/load_balancer.rb, line 108
def time_or_original(value)
  Time.parse(value)
rescue TypeError, ArgumentError
  value
end