44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'lib/loadbalancer.rb', line 44
def create(*args)
CivoCLI::Config.set_api_auth
backends = {}
options[:backend].each do | key, value |
backends[key] = value
end
backendarray = []
backendarray << backends
loadbalancer = Civo::LoadBalancer.create(hostname: options[:hostname] ||= nil,
protocol: options[:protocol],
tls_certificate: options[:tls_certificate],
tls_key: options[:tls_key],
port: options[:port],
max_request_size: options[:max_request_size],
policy: options[:policy],
health_check_path: options[:health_check_path],
fail_timeout: options[:fail_timeout],
max_conns: options[:max_conns],
ignore_invalid_backend_tls: options[:ignore_invalid_backend_tls],
backends: backendarray)
puts "Created a new Load Balancer with hostname #{loadbalancer.hostname.colorize(:green)}"
rescue Flexirest::HTTPException => e
puts e.result.reason.colorize(:red)
exit 1
end
|