Async::GRPC::XDSSourceAsyncGRPCXDSResourcesCluster

class Cluster

Represents a discovered cluster Based on envoy.config.cluster.v3.Cluster

Definitions

def initialize(data)

Initialize cluster from protobuf or hash

Signature

parameter data Object, Hash

Cluster protobuf or hash representation

Implementation

def initialize(data)
	if data.is_a?(Hash)
		@name = data[:name]
		@type = parse_type(data[:type])
		@load_balancer_policy = parse_load_balancer_policy(data[:load_balancer_policy] || data[:lb_policy])
		@health_checks = parse_health_checks(data[:health_checks] || [])
		@circuit_breakers = data[:circuit_breakers]
		@eds_cluster_config = data[:eds_cluster_config]
	else
		# Assume protobuf object
		@name = data.name
		@type = parse_type(data.type)
		@load_balancer_policy = parse_load_balancer_policy(data.lb_policy)
		@health_checks = parse_health_checks(data.health_checks || [])
		@circuit_breakers = data.circuit_breakers
		@eds_cluster_config = data.eds_cluster_config
	end
end

def self.from_proto(proto)

Create Cluster from protobuf message

Signature

parameter proto Envoy::Config::Cluster::V3::Cluster

Protobuf cluster

returns Cluster

Cluster instance

Implementation

def self.from_proto(proto)
	new(proto)
end