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 83
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"]
  else
    attributes[:certificate_valid_from] = nil
    attributes[:certificate_expires_at] = nil
    attributes[:certificate_issuer] = nil
    attributes[:certificate_subject] = 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 68
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 73
def certificate_subject
  attributes[:certificate_subject]
end
destroy() click to toggle source
# File lib/fog/brightbox/models/compute/load_balancer.rb, line 61
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 40
def ready?
  status == 'active'
end
save() click to toggle source
# File lib/fog/brightbox/models/compute/load_balancer.rb, line 44
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,
    :certificate_pem => certificate_pem,
    :certificate_private_key => certificate_private_key
  }.delete_if { |k, v| v.nil? || v == "" }
  data = service.create_load_balancer(options)
  merge_attributes(data)
  true
end

Private Instance Methods

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