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.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/fog/brightbox/models/compute/load_balancer.rb', line 97

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



82
83
84
# File 'lib/fog/brightbox/models/compute/load_balancer.rb', line 82

def certificate_expires_at
  attributes[:certificate_expires_at]
end

#certificate_subjectObject

SSL cert metadata for subject



87
88
89
# File 'lib/fog/brightbox/models/compute/load_balancer.rb', line 87

def certificate_subject
  attributes[:certificate_subject]
end

#destroyObject



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

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

#ready?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/fog/brightbox/models/compute/load_balancer.rb', line 50

def ready?
  status == "active"
end

#saveObject

Raises:

  • (Fog::Errors::Error)


54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/fog/brightbox/models/compute/load_balancer.rb', line 54

def save
  raise Fog::Errors::Error, "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,
    ssl_minimum_version: ssl_minimum_version,
    sslv3: ssl3?
  }.delete_if { |_k, v| v.nil? || v == "" }
  data = service.create_load_balancer(options)
  merge_attributes(data)
  true
end

#ssl3?Boolean

Returns:

  • (Boolean)


113
114
115
# File 'lib/fog/brightbox/models/compute/load_balancer.rb', line 113

def ssl3?
  !!attributes[:certificate_enable_ssl3]
end