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

Inherits:
Brightbox::Model 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 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.



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

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



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

def certificate_expires_at
  attributes[:certificate_expires_at]
end

#certificate_subjectObject

SSL cert metadata for subject



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

def certificate_subject
  attributes[:certificate_subject]
end

#destroyObject



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

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

#ready?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/fog/brightbox/models/compute/load_balancer.rb', line 41

def ready?
  status == 'active'
end

#saveObject

Raises:

  • (Fog::Errors::Error)


45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# 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,
    :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