This commit adds the health check protocol support. This is needed once we start providing certificates. If the customer implements an application that runs HTTPS endpoints, we must use that. For that, we already provide the certificate to them. It's also possible that they don't want the health checks to be performed at the TCP level without any specific endpoint. This commit supports that as well.
33 lines
808 B
Ruby
33 lines
808 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Serializers::LoadBalancer < Serializers::Base
|
|
def self.serialize_internal(lb, options = {})
|
|
base = {
|
|
id: lb.ubid,
|
|
name: lb.name,
|
|
hostname: lb.hostname,
|
|
algorithm: lb.algorithm,
|
|
health_check_endpoint: lb.health_check_endpoint,
|
|
health_check_protocol: lb.health_check_protocol,
|
|
src_port: lb.src_port,
|
|
dst_port: lb.dst_port
|
|
}
|
|
|
|
if options[:include_path]
|
|
base[:path] = lb.path
|
|
end
|
|
|
|
if options[:detailed]
|
|
base[:subnet] = lb.private_subnet.name
|
|
base[:location] = lb.private_subnet.display_location
|
|
base[:vms] = lb.vms.map { _1.ubid } || []
|
|
end
|
|
|
|
if options[:vms_serialized]
|
|
base[:vms] = Serializers::Vm.serialize(lb.vms, {load_balancer: true})
|
|
end
|
|
|
|
base
|
|
end
|
|
end
|