Class ThresholdRule.Builder

java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<BuilderT>
com.google.protobuf.GeneratedMessage.Builder<ThresholdRule.Builder>
com.google.cloud.billing.budgets.v1.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.GeneratedMessage.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.v1.ThresholdRule
  • Method Details

    • getDescriptor

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

      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable()
      Specified by:
      internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessage.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.GeneratedMessage.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.GeneratedMessage.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
    • 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>
    • mergeFrom

      public ThresholdRule.Builder mergeFrom(ThresholdRule other)
    • isInitialized

      public final boolean isInitialized()
      Specified by:
      isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
      Overrides:
      isInitialized in class com.google.protobuf.GeneratedMessage.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.v1.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.v1.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.v1.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.v1.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.v1.ThresholdRule.Basis spend_basis = 2 [(.google.api.field_behavior) = OPTIONAL];
      Returns:
      This builder for chaining.