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

Inherits:
Brightbox::Model show all
Defined in:
lib/fog/brightbox/models/compute/load_balancer.rb

Instance Method Summary collapse

Methods included from Brightbox::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.



82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/fog/brightbox/models/compute/load_balancer.rb', line 82

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"]
  else
    attributes[:certificate_valid_from] = nil
    attributes[:certificate_expires_at] = nil
    attributes[:certificate_issuer] = nil
    attributes[:certificate_subject] = nil
  end
end

#certificate_expires_atObject

SSL cert metadata for expiration of certificate



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

def certificate_expires_at
  attributes[:certificate_expires_at]
end

#certificate_subjectObject

SSL cert metadata for subject



72
73
74
# File 'lib/fog/brightbox/models/compute/load_balancer.rb', line 72

def certificate_subject
  attributes[:certificate_subject]
end

#destroyObject



60
61
62
63
64
# File 'lib/fog/brightbox/models/compute/load_balancer.rb', line 60

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

#ready?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/fog/brightbox/models/compute/load_balancer.rb', line 39

def ready?
  status == 'active'
end

#saveObject

Raises:

  • (Fog::Errors::Error)


43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/fog/brightbox/models/compute/load_balancer.rb', line 43

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