Class ThresholdRule.Builder

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

    public static final class ThresholdRule.Builder
    extends com.google.protobuf.GeneratedMessageV3.Builder<ThresholdRule.Builder>
    implements ThresholdRuleOrBuilder
     ThresholdRule contains the definition of a threshold. Threshold rules define
     the triggering events used to generate a budget notification email. When a
     threshold is crossed (spend exceeds the specified percentages of the
     budget), budget alert emails are sent to the email recipients you specify
     in the
     [NotificationsRule](#notificationsrule).
    
     Threshold rules also affect the fields included in the
     [JSON data
     object](https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#notification_format)
     sent to a Pub/Sub topic.
    
     Threshold rules are _required_ if using email notifications.
    
     Threshold rules are _optional_ if only setting a
     [`pubsubTopic` NotificationsRule](#NotificationsRule),
     unless you want your JSON data object to include data about the thresholds
     you set.
    
     For more information, see
     [set budget threshold rules and
     actions](https://cloud.google.com/billing/docs/how-to/budgets#budget-actions).
     
    Protobuf type google.cloud.billing.budgets.v1beta1.ThresholdRule
    • 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<ThresholdRule.Builder>
      • clear

        public ThresholdRule.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<ThresholdRule.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<ThresholdRule.Builder>
      • getDefaultInstanceForType

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

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

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

        public ThresholdRule.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<ThresholdRule.Builder>
      • setField

        public ThresholdRule.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<ThresholdRule.Builder>
      • clearField

        public ThresholdRule.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<ThresholdRule.Builder>
      • clearOneof

        public ThresholdRule.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<ThresholdRule.Builder>
      • setRepeatedField

        public ThresholdRule.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<ThresholdRule.Builder>
      • addRepeatedField

        public ThresholdRule.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<ThresholdRule.Builder>
      • mergeFrom

        public ThresholdRule.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<ThresholdRule.Builder>
      • isInitialized

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

        public ThresholdRule.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<ThresholdRule.Builder>
        Throws:
        IOException
      • getThresholdPercent

        public double getThresholdPercent()
         Required. Send an alert when this threshold is exceeded.
         This is a 1.0-based percentage, so 0.5 = 50%.
         Validation: non-negative number.
         
        double threshold_percent = 1 [(.google.api.field_behavior) = REQUIRED];
        Specified by:
        getThresholdPercent in interface ThresholdRuleOrBuilder
        Returns:
        The thresholdPercent.
      • setThresholdPercent

        public ThresholdRule.Builder setThresholdPercent​(double value)
         Required. Send an alert when this threshold is exceeded.
         This is a 1.0-based percentage, so 0.5 = 50%.
         Validation: non-negative number.
         
        double threshold_percent = 1 [(.google.api.field_behavior) = REQUIRED];
        Parameters:
        value - The thresholdPercent to set.
        Returns:
        This builder for chaining.
      • clearThresholdPercent

        public ThresholdRule.Builder clearThresholdPercent()
         Required. Send an alert when this threshold is exceeded.
         This is a 1.0-based percentage, so 0.5 = 50%.
         Validation: non-negative number.
         
        double threshold_percent = 1 [(.google.api.field_behavior) = REQUIRED];
        Returns:
        This builder for chaining.
      • getSpendBasisValue

        public int getSpendBasisValue()
         Optional. The type of basis used to determine if spend has passed the
         threshold. Behavior defaults to CURRENT_SPEND if not set.
         
        .google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis spend_basis = 2 [(.google.api.field_behavior) = OPTIONAL];
        Specified by:
        getSpendBasisValue in interface ThresholdRuleOrBuilder
        Returns:
        The enum numeric value on the wire for spendBasis.
      • setSpendBasisValue

        public ThresholdRule.Builder setSpendBasisValue​(int value)
         Optional. The type of basis used to determine if spend has passed the
         threshold. Behavior defaults to CURRENT_SPEND if not set.
         
        .google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis spend_basis = 2 [(.google.api.field_behavior) = OPTIONAL];
        Parameters:
        value - The enum numeric value on the wire for spendBasis to set.
        Returns:
        This builder for chaining.
      • getSpendBasis

        public ThresholdRule.Basis getSpendBasis()
         Optional. The type of basis used to determine if spend has passed the
         threshold. Behavior defaults to CURRENT_SPEND if not set.
         
        .google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis spend_basis = 2 [(.google.api.field_behavior) = OPTIONAL];
        Specified by:
        getSpendBasis in interface ThresholdRuleOrBuilder
        Returns:
        The spendBasis.
      • setSpendBasis

        public ThresholdRule.Builder setSpendBasis​(ThresholdRule.Basis value)
         Optional. The type of basis used to determine if spend has passed the
         threshold. Behavior defaults to CURRENT_SPEND if not set.
         
        .google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis spend_basis = 2 [(.google.api.field_behavior) = OPTIONAL];
        Parameters:
        value - The spendBasis to set.
        Returns:
        This builder for chaining.
      • clearSpendBasis

        public ThresholdRule.Builder clearSpendBasis()
         Optional. The type of basis used to determine if spend has passed the
         threshold. Behavior defaults to CURRENT_SPEND if not set.
         
        .google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis spend_basis = 2 [(.google.api.field_behavior) = OPTIONAL];
        Returns:
        This builder for chaining.
      • setUnknownFields

        public final ThresholdRule.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<ThresholdRule.Builder>
      • mergeUnknownFields

        public final ThresholdRule.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<ThresholdRule.Builder>