Class: Async::GRPC::XDS::Resources::Cluster
- Inherits:
-
Object
- Object
- Async::GRPC::XDS::Resources::Cluster
- Defined in:
- lib/async/grpc/xds/resources.rb
Overview
Represents a discovered cluster Based on envoy.config.cluster.v3.Cluster
Instance Attribute Summary collapse
-
#circuit_breakers ⇒ Object
readonly
Returns the value of attribute circuit_breakers.
-
#eds_cluster_config ⇒ Object
readonly
Returns the value of attribute eds_cluster_config.
-
#health_checks ⇒ Object
readonly
Returns the value of attribute health_checks.
-
#load_balancer_policy ⇒ Object
readonly
Returns the value of attribute load_balancer_policy.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
-
.from_proto(proto) ⇒ Object
Create Cluster from protobuf message.
Instance Method Summary collapse
- #eds_cluster? ⇒ Boolean
-
#initialize(data) ⇒ Cluster
constructor
Initialize cluster from protobuf or hash.
Constructor Details
#initialize(data) ⇒ Cluster
Initialize cluster from protobuf or hash
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/async/grpc/xds/resources.rb', line 17 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 |
Instance Attribute Details
#circuit_breakers ⇒ Object (readonly)
Returns the value of attribute circuit_breakers.
13 14 15 |
# File 'lib/async/grpc/xds/resources.rb', line 13 def circuit_breakers @circuit_breakers end |
#eds_cluster_config ⇒ Object (readonly)
Returns the value of attribute eds_cluster_config.
13 14 15 |
# File 'lib/async/grpc/xds/resources.rb', line 13 def eds_cluster_config @eds_cluster_config end |
#health_checks ⇒ Object (readonly)
Returns the value of attribute health_checks.
13 14 15 |
# File 'lib/async/grpc/xds/resources.rb', line 13 def health_checks @health_checks end |
#load_balancer_policy ⇒ Object (readonly)
Returns the value of attribute load_balancer_policy.
13 14 15 |
# File 'lib/async/grpc/xds/resources.rb', line 13 def load_balancer_policy @load_balancer_policy end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/async/grpc/xds/resources.rb', line 13 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
13 14 15 |
# File 'lib/async/grpc/xds/resources.rb', line 13 def type @type end |
Class Method Details
.from_proto(proto) ⇒ Object
Create Cluster from protobuf message
39 40 41 |
# File 'lib/async/grpc/xds/resources.rb', line 39 def self.from_proto(proto) new(proto) end |
Instance Method Details
#eds_cluster? ⇒ Boolean
43 44 45 |
# File 'lib/async/grpc/xds/resources.rb', line 43 def eds_cluster? @type == :EDS end |