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

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

Instance Attribute Summary

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Model

#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Fog::Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Model

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.



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

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



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

def certificate_expires_at
  attributes[:certificate_expires_at]
end

#certificate_subjectObject

SSL cert metadata for subject



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

def certificate_subject
  attributes[:certificate_subject]
end

#destroyObject



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

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

#ready?Boolean

Returns:

  • (Boolean)


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

def ready?
  status == 'active'
end

#saveObject

Raises:



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