Class WeightedCluster.Builder

  • All Implemented Interfaces:
    com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, WeightedClusterOrBuilder, Cloneable
    Enclosing class:
    WeightedCluster

    public static final class WeightedCluster.Builder
    extends com.google.protobuf.GeneratedMessageV3.Builder<WeightedCluster.Builder>
    implements WeightedClusterOrBuilder
     Compared to the :ref:`cluster <envoy_api_field_route.RouteAction.cluster>` field that specifies a
     single upstream cluster as the target of a request, the :ref:`weighted_clusters
     <envoy_api_field_route.RouteAction.weighted_clusters>` option allows for specification of
     multiple upstream clusters along with weights that indicate the percentage of
     traffic to be forwarded to each cluster. The router selects an upstream cluster based on the
     weights.
     
    Protobuf type envoy.api.v2.route.WeightedCluster
    • Method Detail

      • getDescriptor

        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
      • internalGetFieldAccessorTable

        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
        Specified by:
        internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3.Builder<WeightedCluster.Builder>
      • clear

        public WeightedCluster.Builder clear()
        Specified by:
        clear in interface com.google.protobuf.Message.Builder
        Specified by:
        clear in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clear in class com.google.protobuf.GeneratedMessageV3.Builder<WeightedCluster.Builder>
      • getDescriptorForType

        public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
        Specified by:
        getDescriptorForType in interface com.google.protobuf.Message.Builder
        Specified by:
        getDescriptorForType in interface com.google.protobuf.MessageOrBuilder
        Overrides:
        getDescriptorForType in class com.google.protobuf.GeneratedMessageV3.Builder<WeightedCluster.Builder>
      • getDefaultInstanceForType

        public WeightedCluster getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder
      • build

        public WeightedCluster build()
        Specified by:
        build in interface com.google.protobuf.Message.Builder
        Specified by:
        build in interface com.google.protobuf.MessageLite.Builder
      • buildPartial

        public WeightedCluster buildPartial()
        Specified by:
        buildPartial in interface com.google.protobuf.Message.Builder
        Specified by:
        buildPartial in interface com.google.protobuf.MessageLite.Builder
      • clone

        public WeightedCluster.Builder clone()
        Specified by:
        clone in interface com.google.protobuf.Message.Builder
        Specified by:
        clone in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        clone in class com.google.protobuf.GeneratedMessageV3.Builder<WeightedCluster.Builder>
      • setField

        public WeightedCluster.Builder setField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                Object value)
        Specified by:
        setField in interface com.google.protobuf.Message.Builder
        Overrides:
        setField in class com.google.protobuf.GeneratedMessageV3.Builder<WeightedCluster.Builder>
      • clearField

        public WeightedCluster.Builder clearField​(com.google.protobuf.Descriptors.FieldDescriptor field)
        Specified by:
        clearField in interface com.google.protobuf.Message.Builder
        Overrides:
        clearField in class com.google.protobuf.GeneratedMessageV3.Builder<WeightedCluster.Builder>
      • clearOneof

        public WeightedCluster.Builder clearOneof​(com.google.protobuf.Descriptors.OneofDescriptor oneof)
        Specified by:
        clearOneof in interface com.google.protobuf.Message.Builder
        Overrides:
        clearOneof in class com.google.protobuf.GeneratedMessageV3.Builder<WeightedCluster.Builder>
      • setRepeatedField

        public WeightedCluster.Builder setRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                        int index,
                                                        Object value)
        Specified by:
        setRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        setRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<WeightedCluster.Builder>
      • addRepeatedField

        public WeightedCluster.Builder addRepeatedField​(com.google.protobuf.Descriptors.FieldDescriptor field,
                                                        Object value)
        Specified by:
        addRepeatedField in interface com.google.protobuf.Message.Builder
        Overrides:
        addRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<WeightedCluster.Builder>
      • mergeFrom

        public WeightedCluster.Builder mergeFrom​(com.google.protobuf.Message other)
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<WeightedCluster.Builder>
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessageV3.Builder<WeightedCluster.Builder>
      • mergeFrom

        public WeightedCluster.Builder mergeFrom​(com.google.protobuf.CodedInputStream input,
                                                 com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                          throws IOException
        Specified by:
        mergeFrom in interface com.google.protobuf.Message.Builder
        Specified by:
        mergeFrom in interface com.google.protobuf.MessageLite.Builder
        Overrides:
        mergeFrom in class com.google.protobuf.AbstractMessage.Builder<WeightedCluster.Builder>
        Throws:
        IOException
      • getClustersCount

        public int getClustersCount()
         Specifies one or more upstream clusters associated with the route.
         
        repeated .envoy.api.v2.route.WeightedCluster.ClusterWeight clusters = 1 [(.validate.rules) = { ... }
        Specified by:
        getClustersCount in interface WeightedClusterOrBuilder
      • setClusters

        public WeightedCluster.Builder setClusters​(int index,
                                                   WeightedCluster.ClusterWeight value)
         Specifies one or more upstream clusters associated with the route.
         
        repeated .envoy.api.v2.route.WeightedCluster.ClusterWeight clusters = 1 [(.validate.rules) = { ... }
      • addClusters

        public WeightedCluster.Builder addClusters​(WeightedCluster.ClusterWeight value)
         Specifies one or more upstream clusters associated with the route.
         
        repeated .envoy.api.v2.route.WeightedCluster.ClusterWeight clusters = 1 [(.validate.rules) = { ... }
      • addClusters

        public WeightedCluster.Builder addClusters​(int index,
                                                   WeightedCluster.ClusterWeight value)
         Specifies one or more upstream clusters associated with the route.
         
        repeated .envoy.api.v2.route.WeightedCluster.ClusterWeight clusters = 1 [(.validate.rules) = { ... }
      • clearClusters

        public WeightedCluster.Builder clearClusters()
         Specifies one or more upstream clusters associated with the route.
         
        repeated .envoy.api.v2.route.WeightedCluster.ClusterWeight clusters = 1 [(.validate.rules) = { ... }
      • removeClusters

        public WeightedCluster.Builder removeClusters​(int index)
         Specifies one or more upstream clusters associated with the route.
         
        repeated .envoy.api.v2.route.WeightedCluster.ClusterWeight clusters = 1 [(.validate.rules) = { ... }
      • getClustersBuilder

        public WeightedCluster.ClusterWeight.Builder getClustersBuilder​(int index)
         Specifies one or more upstream clusters associated with the route.
         
        repeated .envoy.api.v2.route.WeightedCluster.ClusterWeight clusters = 1 [(.validate.rules) = { ... }
      • addClustersBuilder

        public WeightedCluster.ClusterWeight.Builder addClustersBuilder()
         Specifies one or more upstream clusters associated with the route.
         
        repeated .envoy.api.v2.route.WeightedCluster.ClusterWeight clusters = 1 [(.validate.rules) = { ... }
      • addClustersBuilder

        public WeightedCluster.ClusterWeight.Builder addClustersBuilder​(int index)
         Specifies one or more upstream clusters associated with the route.
         
        repeated .envoy.api.v2.route.WeightedCluster.ClusterWeight clusters = 1 [(.validate.rules) = { ... }
      • getClustersBuilderList

        public List<WeightedCluster.ClusterWeight.Builder> getClustersBuilderList()
         Specifies one or more upstream clusters associated with the route.
         
        repeated .envoy.api.v2.route.WeightedCluster.ClusterWeight clusters = 1 [(.validate.rules) = { ... }
      • hasTotalWeight

        public boolean hasTotalWeight()
         Specifies the total weight across all clusters. The sum of all cluster weights must equal this
         value, which must be greater than 0. Defaults to 100.
         
        .google.protobuf.UInt32Value total_weight = 3 [(.validate.rules) = { ... }
        Specified by:
        hasTotalWeight in interface WeightedClusterOrBuilder
        Returns:
        Whether the totalWeight field is set.
      • getTotalWeight

        public com.google.protobuf.UInt32Value getTotalWeight()
         Specifies the total weight across all clusters. The sum of all cluster weights must equal this
         value, which must be greater than 0. Defaults to 100.
         
        .google.protobuf.UInt32Value total_weight = 3 [(.validate.rules) = { ... }
        Specified by:
        getTotalWeight in interface WeightedClusterOrBuilder
        Returns:
        The totalWeight.
      • setTotalWeight

        public WeightedCluster.Builder setTotalWeight​(com.google.protobuf.UInt32Value value)
         Specifies the total weight across all clusters. The sum of all cluster weights must equal this
         value, which must be greater than 0. Defaults to 100.
         
        .google.protobuf.UInt32Value total_weight = 3 [(.validate.rules) = { ... }
      • setTotalWeight

        public WeightedCluster.Builder setTotalWeight​(com.google.protobuf.UInt32Value.Builder builderForValue)
         Specifies the total weight across all clusters. The sum of all cluster weights must equal this
         value, which must be greater than 0. Defaults to 100.
         
        .google.protobuf.UInt32Value total_weight = 3 [(.validate.rules) = { ... }
      • mergeTotalWeight

        public WeightedCluster.Builder mergeTotalWeight​(com.google.protobuf.UInt32Value value)
         Specifies the total weight across all clusters. The sum of all cluster weights must equal this
         value, which must be greater than 0. Defaults to 100.
         
        .google.protobuf.UInt32Value total_weight = 3 [(.validate.rules) = { ... }
      • clearTotalWeight

        public WeightedCluster.Builder clearTotalWeight()
         Specifies the total weight across all clusters. The sum of all cluster weights must equal this
         value, which must be greater than 0. Defaults to 100.
         
        .google.protobuf.UInt32Value total_weight = 3 [(.validate.rules) = { ... }
      • getTotalWeightBuilder

        public com.google.protobuf.UInt32Value.Builder getTotalWeightBuilder()
         Specifies the total weight across all clusters. The sum of all cluster weights must equal this
         value, which must be greater than 0. Defaults to 100.
         
        .google.protobuf.UInt32Value total_weight = 3 [(.validate.rules) = { ... }
      • getTotalWeightOrBuilder

        public com.google.protobuf.UInt32ValueOrBuilder getTotalWeightOrBuilder()
         Specifies the total weight across all clusters. The sum of all cluster weights must equal this
         value, which must be greater than 0. Defaults to 100.
         
        .google.protobuf.UInt32Value total_weight = 3 [(.validate.rules) = { ... }
        Specified by:
        getTotalWeightOrBuilder in interface WeightedClusterOrBuilder
      • getRuntimeKeyPrefix

        public String getRuntimeKeyPrefix()
         Specifies the runtime key prefix that should be used to construct the
         runtime keys associated with each cluster. When the *runtime_key_prefix* is
         specified, the router will look for weights associated with each upstream
         cluster under the key *runtime_key_prefix* + "." + *cluster[i].name* where
         *cluster[i]* denotes an entry in the clusters array field. If the runtime
         key for the cluster does not exist, the value specified in the
         configuration file will be used as the default weight. See the :ref:`runtime documentation
         <operations_runtime>` for how key names map to the underlying implementation.
         
        string runtime_key_prefix = 2;
        Specified by:
        getRuntimeKeyPrefix in interface WeightedClusterOrBuilder
        Returns:
        The runtimeKeyPrefix.
      • getRuntimeKeyPrefixBytes

        public com.google.protobuf.ByteString getRuntimeKeyPrefixBytes()
         Specifies the runtime key prefix that should be used to construct the
         runtime keys associated with each cluster. When the *runtime_key_prefix* is
         specified, the router will look for weights associated with each upstream
         cluster under the key *runtime_key_prefix* + "." + *cluster[i].name* where
         *cluster[i]* denotes an entry in the clusters array field. If the runtime
         key for the cluster does not exist, the value specified in the
         configuration file will be used as the default weight. See the :ref:`runtime documentation
         <operations_runtime>` for how key names map to the underlying implementation.
         
        string runtime_key_prefix = 2;
        Specified by:
        getRuntimeKeyPrefixBytes in interface WeightedClusterOrBuilder
        Returns:
        The bytes for runtimeKeyPrefix.
      • setRuntimeKeyPrefix

        public WeightedCluster.Builder setRuntimeKeyPrefix​(String value)
         Specifies the runtime key prefix that should be used to construct the
         runtime keys associated with each cluster. When the *runtime_key_prefix* is
         specified, the router will look for weights associated with each upstream
         cluster under the key *runtime_key_prefix* + "." + *cluster[i].name* where
         *cluster[i]* denotes an entry in the clusters array field. If the runtime
         key for the cluster does not exist, the value specified in the
         configuration file will be used as the default weight. See the :ref:`runtime documentation
         <operations_runtime>` for how key names map to the underlying implementation.
         
        string runtime_key_prefix = 2;
        Parameters:
        value - The runtimeKeyPrefix to set.
        Returns:
        This builder for chaining.
      • clearRuntimeKeyPrefix

        public WeightedCluster.Builder clearRuntimeKeyPrefix()
         Specifies the runtime key prefix that should be used to construct the
         runtime keys associated with each cluster. When the *runtime_key_prefix* is
         specified, the router will look for weights associated with each upstream
         cluster under the key *runtime_key_prefix* + "." + *cluster[i].name* where
         *cluster[i]* denotes an entry in the clusters array field. If the runtime
         key for the cluster does not exist, the value specified in the
         configuration file will be used as the default weight. See the :ref:`runtime documentation
         <operations_runtime>` for how key names map to the underlying implementation.
         
        string runtime_key_prefix = 2;
        Returns:
        This builder for chaining.
      • setRuntimeKeyPrefixBytes

        public WeightedCluster.Builder setRuntimeKeyPrefixBytes​(com.google.protobuf.ByteString value)
         Specifies the runtime key prefix that should be used to construct the
         runtime keys associated with each cluster. When the *runtime_key_prefix* is
         specified, the router will look for weights associated with each upstream
         cluster under the key *runtime_key_prefix* + "." + *cluster[i].name* where
         *cluster[i]* denotes an entry in the clusters array field. If the runtime
         key for the cluster does not exist, the value specified in the
         configuration file will be used as the default weight. See the :ref:`runtime documentation
         <operations_runtime>` for how key names map to the underlying implementation.
         
        string runtime_key_prefix = 2;
        Parameters:
        value - The bytes for runtimeKeyPrefix to set.
        Returns:
        This builder for chaining.
      • setUnknownFields

        public final WeightedCluster.Builder setUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        setUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        setUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<WeightedCluster.Builder>
      • mergeUnknownFields

        public final WeightedCluster.Builder mergeUnknownFields​(com.google.protobuf.UnknownFieldSet unknownFields)
        Specified by:
        mergeUnknownFields in interface com.google.protobuf.Message.Builder
        Overrides:
        mergeUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<WeightedCluster.Builder>