From ffc47887db4cbc97d626cee5dd3df17f19e60864 Mon Sep 17 00:00:00 2001 From: Jeff Ching Date: Wed, 28 Oct 2020 12:03:20 -0700 Subject: [PATCH] feat: add v1 client library (#290) * feat: start generating v1 client * feat: generate v1 client code --- google-cloud-billingbudgets-bom/pom.xml | 10 + google-cloud-billingbudgets/pom.xml | 9 + .../budgets/v1/BudgetServiceClient.java | 806 ++++++ .../budgets/v1/BudgetServiceSettings.java | 227 ++ .../billing/budgets/v1/package-info.java | 42 + .../budgets/v1/stub/BudgetServiceStub.java | 69 + .../v1/stub/BudgetServiceStubSettings.java | 454 +++ .../GrpcBudgetServiceCallableFactory.java | 115 + .../v1/stub/GrpcBudgetServiceStub.java | 282 ++ .../budgets/v1/BudgetServiceClientTest.java | 310 ++ .../billing/budgets/v1/MockBudgetService.java | 57 + .../budgets/v1/MockBudgetServiceImpl.java | 130 + grpc-google-cloud-billingbudgets-v1/pom.xml | 65 + .../billing/budgets/v1/BudgetServiceGrpc.java | 872 ++++++ pom.xml | 12 + .../clirr-ignored-differences.xml | 19 + proto-google-cloud-billingbudgets-v1/pom.xml | 42 + .../budgets/v1/BillingAccountName.java | 162 ++ .../cloud/billing/budgets/v1/Budget.java | 2548 ++++++++++++++++ .../billing/budgets/v1/BudgetAmount.java | 1174 ++++++++ .../budgets/v1/BudgetAmountOrBuilder.java | 106 + .../billing/budgets/v1/BudgetModelProto.java | 205 ++ .../cloud/billing/budgets/v1/BudgetName.java | 182 ++ .../billing/budgets/v1/BudgetOrBuilder.java | 306 ++ .../budgets/v1/BudgetServiceProto.java | 199 ++ .../budgets/v1/CreateBudgetRequest.java | 959 ++++++ .../v1/CreateBudgetRequestOrBuilder.java | 97 + .../budgets/v1/DeleteBudgetRequest.java | 658 +++++ .../v1/DeleteBudgetRequestOrBuilder.java | 56 + .../cloud/billing/budgets/v1/Filter.java | 2577 +++++++++++++++++ .../billing/budgets/v1/FilterOrBuilder.java | 418 +++ .../billing/budgets/v1/GetBudgetRequest.java | 657 +++++ .../budgets/v1/GetBudgetRequestOrBuilder.java | 56 + .../billing/budgets/v1/LastPeriodAmount.java | 464 +++ .../budgets/v1/LastPeriodAmountOrBuilder.java | 24 + .../budgets/v1/ListBudgetsRequest.java | 945 ++++++ .../v1/ListBudgetsRequestOrBuilder.java | 99 + .../budgets/v1/ListBudgetsResponse.java | 1136 ++++++++ .../v1/ListBudgetsResponseOrBuilder.java | 104 + .../billing/budgets/v1/NotificationsRule.java | 1410 +++++++++ .../v1/NotificationsRuleOrBuilder.java | 202 ++ .../billing/budgets/v1/ThresholdRule.java | 909 ++++++ .../budgets/v1/ThresholdRuleOrBuilder.java | 71 + .../budgets/v1/UpdateBudgetRequest.java | 1114 +++++++ .../v1/UpdateBudgetRequestOrBuilder.java | 122 + .../billing/budgets/v1/budget_model.proto | 228 ++ .../billing/budgets/v1/budget_service.proto | 182 ++ synth.metadata | 71 +- synth.py | 4 +- versions.txt | 2 + 50 files changed, 20955 insertions(+), 13 deletions(-) create mode 100644 google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/BudgetServiceClient.java create mode 100644 google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/BudgetServiceSettings.java create mode 100644 google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/package-info.java create mode 100644 google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/stub/BudgetServiceStub.java create mode 100644 google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/stub/BudgetServiceStubSettings.java create mode 100644 google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/stub/GrpcBudgetServiceCallableFactory.java create mode 100644 google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/stub/GrpcBudgetServiceStub.java create mode 100644 google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1/BudgetServiceClientTest.java create mode 100644 google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1/MockBudgetService.java create mode 100644 google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1/MockBudgetServiceImpl.java create mode 100644 grpc-google-cloud-billingbudgets-v1/pom.xml create mode 100644 grpc-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetServiceGrpc.java create mode 100644 proto-google-cloud-billingbudgets-v1/clirr-ignored-differences.xml create mode 100644 proto-google-cloud-billingbudgets-v1/pom.xml create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BillingAccountName.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/Budget.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetAmount.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetAmountOrBuilder.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetModelProto.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetName.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetOrBuilder.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetServiceProto.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/CreateBudgetRequest.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/CreateBudgetRequestOrBuilder.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/DeleteBudgetRequest.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/DeleteBudgetRequestOrBuilder.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/Filter.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/FilterOrBuilder.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/GetBudgetRequest.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/GetBudgetRequestOrBuilder.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/LastPeriodAmount.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/LastPeriodAmountOrBuilder.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ListBudgetsRequest.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ListBudgetsRequestOrBuilder.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ListBudgetsResponse.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ListBudgetsResponseOrBuilder.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/NotificationsRule.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/NotificationsRuleOrBuilder.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ThresholdRule.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ThresholdRuleOrBuilder.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/UpdateBudgetRequest.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/UpdateBudgetRequestOrBuilder.java create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/proto/google/cloud/billing/budgets/v1/budget_model.proto create mode 100644 proto-google-cloud-billingbudgets-v1/src/main/proto/google/cloud/billing/budgets/v1/budget_service.proto diff --git a/google-cloud-billingbudgets-bom/pom.xml b/google-cloud-billingbudgets-bom/pom.xml index b049a524..4f7aa1ce 100644 --- a/google-cloud-billingbudgets-bom/pom.xml +++ b/google-cloud-billingbudgets-bom/pom.xml @@ -65,11 +65,21 @@ grpc-google-cloud-billingbudgets-v1beta1 0.4.2-SNAPSHOT + + com.google.api.grpc + grpc-google-cloud-billingbudgets-v1 + 0.4.2-SNAPSHOT + com.google.api.grpc proto-google-cloud-billingbudgets-v1beta1 0.4.2-SNAPSHOT + + com.google.api.grpc + proto-google-cloud-billingbudgets-v1 + 0.4.2-SNAPSHOT + com.google.cloud google-cloud-billingbudgets diff --git a/google-cloud-billingbudgets/pom.xml b/google-cloud-billingbudgets/pom.xml index dfc99baf..0c8b4192 100644 --- a/google-cloud-billingbudgets/pom.xml +++ b/google-cloud-billingbudgets/pom.xml @@ -46,6 +46,10 @@ com.google.api.grpc proto-google-cloud-billingbudgets-v1beta1 + + com.google.api.grpc + proto-google-cloud-billingbudgets-v1 + com.google.guava guava @@ -74,6 +78,11 @@ grpc-google-cloud-billingbudgets-v1beta1 test + + com.google.api.grpc + grpc-google-cloud-billingbudgets-v1 + test + com.google.api diff --git a/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/BudgetServiceClient.java b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/BudgetServiceClient.java new file mode 100644 index 00000000..232055b0 --- /dev/null +++ b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/BudgetServiceClient.java @@ -0,0 +1,806 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.billing.budgets.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.billing.budgets.v1.stub.BudgetServiceStub; +import com.google.cloud.billing.budgets.v1.stub.BudgetServiceStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: BudgetService stores Cloud Billing budgets, which define a budget plan and + * rules to execute as we track spend against that plan. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

+ * 
+ * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+ *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+ *   Budget budget = Budget.newBuilder().build();
+ *   Budget response = budgetServiceClient.createBudget(parent, budget);
+ * }
+ * 
+ * 
+ * + *

Note: close() needs to be called on the budgetServiceClient object to clean up resources such + * as threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of BudgetServiceSettings to + * create(). For example: + * + *

To customize credentials: + * + *

+ * 
+ * BudgetServiceSettings budgetServiceSettings =
+ *     BudgetServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * BudgetServiceClient budgetServiceClient =
+ *     BudgetServiceClient.create(budgetServiceSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * BudgetServiceSettings budgetServiceSettings =
+ *     BudgetServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * BudgetServiceClient budgetServiceClient =
+ *     BudgetServiceClient.create(budgetServiceSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class BudgetServiceClient implements BackgroundResource { + private final BudgetServiceSettings settings; + private final BudgetServiceStub stub; + + /** Constructs an instance of BudgetServiceClient with default settings. */ + public static final BudgetServiceClient create() throws IOException { + return create(BudgetServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of BudgetServiceClient, using the given settings. The channels are + * created based on the settings passed in, or defaults for any settings that are not set. + */ + public static final BudgetServiceClient create(BudgetServiceSettings settings) + throws IOException { + return new BudgetServiceClient(settings); + } + + /** + * Constructs an instance of BudgetServiceClient, using the given stub for making calls. This is + * for advanced usage - prefer to use BudgetServiceSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final BudgetServiceClient create(BudgetServiceStub stub) { + return new BudgetServiceClient(stub); + } + + /** + * Constructs an instance of BudgetServiceClient, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected BudgetServiceClient(BudgetServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((BudgetServiceStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected BudgetServiceClient(BudgetServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final BudgetServiceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public BudgetServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new budget. See [Quotas and limits](https://cloud.google.com/billing/quotas) for more + * information on the limits of the number of budgets you can create. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   Budget budget = Budget.newBuilder().build();
+   *   Budget response = budgetServiceClient.createBudget(parent, budget);
+   * }
+   * 
+ * + * @param parent Required. The name of the billing account to create the budget in. Values are of + * the form `billingAccounts/{billingAccountId}`. + * @param budget Required. Budget to create. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Budget createBudget(BillingAccountName parent, Budget budget) { + CreateBudgetRequest request = + CreateBudgetRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setBudget(budget) + .build(); + return createBudget(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new budget. See [Quotas and limits](https://cloud.google.com/billing/quotas) for more + * information on the limits of the number of budgets you can create. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   Budget budget = Budget.newBuilder().build();
+   *   Budget response = budgetServiceClient.createBudget(parent.toString(), budget);
+   * }
+   * 
+ * + * @param parent Required. The name of the billing account to create the budget in. Values are of + * the form `billingAccounts/{billingAccountId}`. + * @param budget Required. Budget to create. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Budget createBudget(String parent, Budget budget) { + CreateBudgetRequest request = + CreateBudgetRequest.newBuilder().setParent(parent).setBudget(budget).build(); + return createBudget(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new budget. See [Quotas and limits](https://cloud.google.com/billing/quotas) for more + * information on the limits of the number of budgets you can create. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   Budget budget = Budget.newBuilder().build();
+   *   CreateBudgetRequest request = CreateBudgetRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .setBudget(budget)
+   *     .build();
+   *   Budget response = budgetServiceClient.createBudget(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Budget createBudget(CreateBudgetRequest request) { + return createBudgetCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new budget. See [Quotas and limits](https://cloud.google.com/billing/quotas) for more + * information on the limits of the number of budgets you can create. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   Budget budget = Budget.newBuilder().build();
+   *   CreateBudgetRequest request = CreateBudgetRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .setBudget(budget)
+   *     .build();
+   *   ApiFuture<Budget> future = budgetServiceClient.createBudgetCallable().futureCall(request);
+   *   // Do something
+   *   Budget response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable createBudgetCallable() { + return stub.createBudgetCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a budget and returns the updated budget. + * + *

WARNING: There are some fields exposed on the Google Cloud Console that aren't available on + * this API. Budget fields that are not exposed in this API will not be changed by this method. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   Budget budget = Budget.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   Budget response = budgetServiceClient.updateBudget(budget, updateMask);
+   * }
+   * 
+ * + * @param budget Required. The updated budget object. The budget to update is specified by the + * budget name in the budget. + * @param updateMask Optional. Indicates which fields in the provided budget to update. Read-only + * fields (such as `name`) cannot be changed. If this is not provided, then only fields with + * non-default values from the request are updated. See + * https://developers.google.com/protocol-buffers/docs/proto3#default for more details about + * default values. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Budget updateBudget(Budget budget, FieldMask updateMask) { + UpdateBudgetRequest request = + UpdateBudgetRequest.newBuilder().setBudget(budget).setUpdateMask(updateMask).build(); + return updateBudget(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a budget and returns the updated budget. + * + *

WARNING: There are some fields exposed on the Google Cloud Console that aren't available on + * this API. Budget fields that are not exposed in this API will not be changed by this method. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   Budget budget = Budget.newBuilder().build();
+   *   UpdateBudgetRequest request = UpdateBudgetRequest.newBuilder()
+   *     .setBudget(budget)
+   *     .build();
+   *   Budget response = budgetServiceClient.updateBudget(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Budget updateBudget(UpdateBudgetRequest request) { + return updateBudgetCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a budget and returns the updated budget. + * + *

WARNING: There are some fields exposed on the Google Cloud Console that aren't available on + * this API. Budget fields that are not exposed in this API will not be changed by this method. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   Budget budget = Budget.newBuilder().build();
+   *   UpdateBudgetRequest request = UpdateBudgetRequest.newBuilder()
+   *     .setBudget(budget)
+   *     .build();
+   *   ApiFuture<Budget> future = budgetServiceClient.updateBudgetCallable().futureCall(request);
+   *   // Do something
+   *   Budget response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable updateBudgetCallable() { + return stub.updateBudgetCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns a budget. + * + *

WARNING: There are some fields exposed on the Google Cloud Console that aren't available on + * this API. When reading from the API, you will not see these fields in the return value, though + * they may have been set in the Cloud Console. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BudgetName name = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]");
+   *   Budget response = budgetServiceClient.getBudget(name);
+   * }
+   * 
+ * + * @param name Required. Name of budget to get. Values are of the form + * `billingAccounts/{billingAccountId}/budgets/{budgetId}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Budget getBudget(BudgetName name) { + GetBudgetRequest request = + GetBudgetRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getBudget(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns a budget. + * + *

WARNING: There are some fields exposed on the Google Cloud Console that aren't available on + * this API. When reading from the API, you will not see these fields in the return value, though + * they may have been set in the Cloud Console. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BudgetName name = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]");
+   *   Budget response = budgetServiceClient.getBudget(name.toString());
+   * }
+   * 
+ * + * @param name Required. Name of budget to get. Values are of the form + * `billingAccounts/{billingAccountId}/budgets/{budgetId}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Budget getBudget(String name) { + GetBudgetRequest request = GetBudgetRequest.newBuilder().setName(name).build(); + return getBudget(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns a budget. + * + *

WARNING: There are some fields exposed on the Google Cloud Console that aren't available on + * this API. When reading from the API, you will not see these fields in the return value, though + * they may have been set in the Cloud Console. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BudgetName name = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]");
+   *   GetBudgetRequest request = GetBudgetRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   Budget response = budgetServiceClient.getBudget(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Budget getBudget(GetBudgetRequest request) { + return getBudgetCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns a budget. + * + *

WARNING: There are some fields exposed on the Google Cloud Console that aren't available on + * this API. When reading from the API, you will not see these fields in the return value, though + * they may have been set in the Cloud Console. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BudgetName name = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]");
+   *   GetBudgetRequest request = GetBudgetRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<Budget> future = budgetServiceClient.getBudgetCallable().futureCall(request);
+   *   // Do something
+   *   Budget response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable getBudgetCallable() { + return stub.getBudgetCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns a list of budgets for a billing account. + * + *

WARNING: There are some fields exposed on the Google Cloud Console that aren't available on + * this API. When reading from the API, you will not see these fields in the return value, though + * they may have been set in the Cloud Console. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   for (Budget element : budgetServiceClient.listBudgets(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param parent Required. Name of billing account to list budgets under. Values are of the form + * `billingAccounts/{billingAccountId}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListBudgetsPagedResponse listBudgets(BillingAccountName parent) { + ListBudgetsRequest request = + ListBudgetsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listBudgets(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns a list of budgets for a billing account. + * + *

WARNING: There are some fields exposed on the Google Cloud Console that aren't available on + * this API. When reading from the API, you will not see these fields in the return value, though + * they may have been set in the Cloud Console. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   for (Budget element : budgetServiceClient.listBudgets(parent.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param parent Required. Name of billing account to list budgets under. Values are of the form + * `billingAccounts/{billingAccountId}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListBudgetsPagedResponse listBudgets(String parent) { + ListBudgetsRequest request = ListBudgetsRequest.newBuilder().setParent(parent).build(); + return listBudgets(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns a list of budgets for a billing account. + * + *

WARNING: There are some fields exposed on the Google Cloud Console that aren't available on + * this API. When reading from the API, you will not see these fields in the return value, though + * they may have been set in the Cloud Console. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   ListBudgetsRequest request = ListBudgetsRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   for (Budget element : budgetServiceClient.listBudgets(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListBudgetsPagedResponse listBudgets(ListBudgetsRequest request) { + return listBudgetsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns a list of budgets for a billing account. + * + *

WARNING: There are some fields exposed on the Google Cloud Console that aren't available on + * this API. When reading from the API, you will not see these fields in the return value, though + * they may have been set in the Cloud Console. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   ListBudgetsRequest request = ListBudgetsRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   ApiFuture<ListBudgetsPagedResponse> future = budgetServiceClient.listBudgetsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Budget element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listBudgetsPagedCallable() { + return stub.listBudgetsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns a list of budgets for a billing account. + * + *

WARNING: There are some fields exposed on the Google Cloud Console that aren't available on + * this API. When reading from the API, you will not see these fields in the return value, though + * they may have been set in the Cloud Console. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   ListBudgetsRequest request = ListBudgetsRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   while (true) {
+   *     ListBudgetsResponse response = budgetServiceClient.listBudgetsCallable().call(request);
+   *     for (Budget element : response.getBudgetsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable listBudgetsCallable() { + return stub.listBudgetsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a budget. Returns successfully if already deleted. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BudgetName name = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]");
+   *   budgetServiceClient.deleteBudget(name);
+   * }
+   * 
+ * + * @param name Required. Name of the budget to delete. Values are of the form + * `billingAccounts/{billingAccountId}/budgets/{budgetId}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteBudget(BudgetName name) { + DeleteBudgetRequest request = + DeleteBudgetRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + deleteBudget(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a budget. Returns successfully if already deleted. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BudgetName name = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]");
+   *   budgetServiceClient.deleteBudget(name.toString());
+   * }
+   * 
+ * + * @param name Required. Name of the budget to delete. Values are of the form + * `billingAccounts/{billingAccountId}/budgets/{budgetId}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteBudget(String name) { + DeleteBudgetRequest request = DeleteBudgetRequest.newBuilder().setName(name).build(); + deleteBudget(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a budget. Returns successfully if already deleted. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BudgetName name = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]");
+   *   DeleteBudgetRequest request = DeleteBudgetRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   budgetServiceClient.deleteBudget(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteBudget(DeleteBudgetRequest request) { + deleteBudgetCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a budget. Returns successfully if already deleted. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BudgetName name = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]");
+   *   DeleteBudgetRequest request = DeleteBudgetRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<Void> future = budgetServiceClient.deleteBudgetCallable().futureCall(request);
+   *   // Do something
+   *   future.get();
+   * }
+   * 
+ */ + public final UnaryCallable deleteBudgetCallable() { + return stub.deleteBudgetCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListBudgetsPagedResponse + extends AbstractPagedListResponse< + ListBudgetsRequest, + ListBudgetsResponse, + Budget, + ListBudgetsPage, + ListBudgetsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListBudgetsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListBudgetsPagedResponse apply(ListBudgetsPage input) { + return new ListBudgetsPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private ListBudgetsPagedResponse(ListBudgetsPage page) { + super(page, ListBudgetsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListBudgetsPage + extends AbstractPage { + + private ListBudgetsPage( + PageContext context, + ListBudgetsResponse response) { + super(context, response); + } + + private static ListBudgetsPage createEmptyPage() { + return new ListBudgetsPage(null, null); + } + + @Override + protected ListBudgetsPage createPage( + PageContext context, + ListBudgetsResponse response) { + return new ListBudgetsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListBudgetsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListBudgetsRequest, + ListBudgetsResponse, + Budget, + ListBudgetsPage, + ListBudgetsFixedSizeCollection> { + + private ListBudgetsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListBudgetsFixedSizeCollection createEmptyCollection() { + return new ListBudgetsFixedSizeCollection(null, 0); + } + + @Override + protected ListBudgetsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListBudgetsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/BudgetServiceSettings.java b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/BudgetServiceSettings.java new file mode 100644 index 00000000..2d4daa88 --- /dev/null +++ b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/BudgetServiceSettings.java @@ -0,0 +1,227 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.billing.budgets.v1; + +import static com.google.cloud.billing.budgets.v1.BudgetServiceClient.ListBudgetsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.billing.budgets.v1.stub.BudgetServiceStubSettings; +import com.google.protobuf.Empty; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link BudgetServiceClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (billingbudgets.googleapis.com) and default port (443) are + * used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of createBudget to 30 seconds: + * + *

+ * 
+ * BudgetServiceSettings.Builder budgetServiceSettingsBuilder =
+ *     BudgetServiceSettings.newBuilder();
+ * budgetServiceSettingsBuilder
+ *     .createBudgetSettings()
+ *     .setRetrySettings(
+ *         budgetServiceSettingsBuilder.createBudgetSettings().getRetrySettings().toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * BudgetServiceSettings budgetServiceSettings = budgetServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class BudgetServiceSettings extends ClientSettings { + /** Returns the object with the settings used for calls to createBudget. */ + public UnaryCallSettings createBudgetSettings() { + return ((BudgetServiceStubSettings) getStubSettings()).createBudgetSettings(); + } + + /** Returns the object with the settings used for calls to updateBudget. */ + public UnaryCallSettings updateBudgetSettings() { + return ((BudgetServiceStubSettings) getStubSettings()).updateBudgetSettings(); + } + + /** Returns the object with the settings used for calls to getBudget. */ + public UnaryCallSettings getBudgetSettings() { + return ((BudgetServiceStubSettings) getStubSettings()).getBudgetSettings(); + } + + /** Returns the object with the settings used for calls to listBudgets. */ + public PagedCallSettings + listBudgetsSettings() { + return ((BudgetServiceStubSettings) getStubSettings()).listBudgetsSettings(); + } + + /** Returns the object with the settings used for calls to deleteBudget. */ + public UnaryCallSettings deleteBudgetSettings() { + return ((BudgetServiceStubSettings) getStubSettings()).deleteBudgetSettings(); + } + + public static final BudgetServiceSettings create(BudgetServiceStubSettings stub) + throws IOException { + return new BudgetServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return BudgetServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return BudgetServiceStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return BudgetServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return BudgetServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return BudgetServiceStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return BudgetServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return BudgetServiceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected BudgetServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for BudgetServiceSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(BudgetServiceStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(BudgetServiceStubSettings.newBuilder()); + } + + protected Builder(BudgetServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(BudgetServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public BudgetServiceStubSettings.Builder getStubSettingsBuilder() { + return ((BudgetServiceStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to createBudget. */ + public UnaryCallSettings.Builder createBudgetSettings() { + return getStubSettingsBuilder().createBudgetSettings(); + } + + /** Returns the builder for the settings used for calls to updateBudget. */ + public UnaryCallSettings.Builder updateBudgetSettings() { + return getStubSettingsBuilder().updateBudgetSettings(); + } + + /** Returns the builder for the settings used for calls to getBudget. */ + public UnaryCallSettings.Builder getBudgetSettings() { + return getStubSettingsBuilder().getBudgetSettings(); + } + + /** Returns the builder for the settings used for calls to listBudgets. */ + public PagedCallSettings.Builder< + ListBudgetsRequest, ListBudgetsResponse, ListBudgetsPagedResponse> + listBudgetsSettings() { + return getStubSettingsBuilder().listBudgetsSettings(); + } + + /** Returns the builder for the settings used for calls to deleteBudget. */ + public UnaryCallSettings.Builder deleteBudgetSettings() { + return getStubSettingsBuilder().deleteBudgetSettings(); + } + + @Override + public BudgetServiceSettings build() throws IOException { + return new BudgetServiceSettings(this); + } + } +} diff --git a/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/package-info.java b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/package-info.java new file mode 100644 index 00000000..6503546b --- /dev/null +++ b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/package-info.java @@ -0,0 +1,42 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * A client to Cloud Billing Budget API. + * + *

The interfaces provided are listed below, along with usage samples. + * + *

=================== BudgetServiceClient =================== + * + *

Service Description: BudgetService stores Cloud Billing budgets, which define a budget plan + * and rules to execute as we track spend against that plan. + * + *

Sample for BudgetServiceClient: + * + *

+ * 
+ * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+ *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+ *   Budget budget = Budget.newBuilder().build();
+ *   Budget response = budgetServiceClient.createBudget(parent, budget);
+ * }
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +package com.google.cloud.billing.budgets.v1; + +import javax.annotation.Generated; diff --git a/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/stub/BudgetServiceStub.java b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/stub/BudgetServiceStub.java new file mode 100644 index 00000000..0072ef6b --- /dev/null +++ b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/stub/BudgetServiceStub.java @@ -0,0 +1,69 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.billing.budgets.v1.stub; + +import static com.google.cloud.billing.budgets.v1.BudgetServiceClient.ListBudgetsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.billing.budgets.v1.Budget; +import com.google.cloud.billing.budgets.v1.CreateBudgetRequest; +import com.google.cloud.billing.budgets.v1.DeleteBudgetRequest; +import com.google.cloud.billing.budgets.v1.GetBudgetRequest; +import com.google.cloud.billing.budgets.v1.ListBudgetsRequest; +import com.google.cloud.billing.budgets.v1.ListBudgetsResponse; +import com.google.cloud.billing.budgets.v1.UpdateBudgetRequest; +import com.google.protobuf.Empty; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for Cloud Billing Budget API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class BudgetServiceStub implements BackgroundResource { + + public UnaryCallable createBudgetCallable() { + throw new UnsupportedOperationException("Not implemented: createBudgetCallable()"); + } + + public UnaryCallable updateBudgetCallable() { + throw new UnsupportedOperationException("Not implemented: updateBudgetCallable()"); + } + + public UnaryCallable getBudgetCallable() { + throw new UnsupportedOperationException("Not implemented: getBudgetCallable()"); + } + + public UnaryCallable listBudgetsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listBudgetsPagedCallable()"); + } + + public UnaryCallable listBudgetsCallable() { + throw new UnsupportedOperationException("Not implemented: listBudgetsCallable()"); + } + + public UnaryCallable deleteBudgetCallable() { + throw new UnsupportedOperationException("Not implemented: deleteBudgetCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/stub/BudgetServiceStubSettings.java b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/stub/BudgetServiceStubSettings.java new file mode 100644 index 00000000..24063a51 --- /dev/null +++ b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/stub/BudgetServiceStubSettings.java @@ -0,0 +1,454 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.billing.budgets.v1.stub; + +import static com.google.cloud.billing.budgets.v1.BudgetServiceClient.ListBudgetsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.billing.budgets.v1.Budget; +import com.google.cloud.billing.budgets.v1.CreateBudgetRequest; +import com.google.cloud.billing.budgets.v1.DeleteBudgetRequest; +import com.google.cloud.billing.budgets.v1.GetBudgetRequest; +import com.google.cloud.billing.budgets.v1.ListBudgetsRequest; +import com.google.cloud.billing.budgets.v1.ListBudgetsResponse; +import com.google.cloud.billing.budgets.v1.UpdateBudgetRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.protobuf.Empty; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link BudgetServiceStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (billingbudgets.googleapis.com) and default port (443) are + * used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of createBudget to 30 seconds: + * + *

+ * 
+ * BudgetServiceStubSettings.Builder budgetServiceSettingsBuilder =
+ *     BudgetServiceStubSettings.newBuilder();
+ * budgetServiceSettingsBuilder
+ *     .createBudgetSettings()
+ *     .setRetrySettings(
+ *         budgetServiceSettingsBuilder.createBudgetSettings().getRetrySettings().toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * BudgetServiceStubSettings budgetServiceSettings = budgetServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class BudgetServiceStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-billing") + .add("https://www.googleapis.com/auth/cloud-platform") + .build(); + + private final UnaryCallSettings createBudgetSettings; + private final UnaryCallSettings updateBudgetSettings; + private final UnaryCallSettings getBudgetSettings; + private final PagedCallSettings + listBudgetsSettings; + private final UnaryCallSettings deleteBudgetSettings; + + /** Returns the object with the settings used for calls to createBudget. */ + public UnaryCallSettings createBudgetSettings() { + return createBudgetSettings; + } + + /** Returns the object with the settings used for calls to updateBudget. */ + public UnaryCallSettings updateBudgetSettings() { + return updateBudgetSettings; + } + + /** Returns the object with the settings used for calls to getBudget. */ + public UnaryCallSettings getBudgetSettings() { + return getBudgetSettings; + } + + /** Returns the object with the settings used for calls to listBudgets. */ + public PagedCallSettings + listBudgetsSettings() { + return listBudgetsSettings; + } + + /** Returns the object with the settings used for calls to deleteBudget. */ + public UnaryCallSettings deleteBudgetSettings() { + return deleteBudgetSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public BudgetServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcBudgetServiceStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + getTransportChannelProvider().getTransportName()); + } + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "billingbudgets.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(BudgetServiceStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected BudgetServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + createBudgetSettings = settingsBuilder.createBudgetSettings().build(); + updateBudgetSettings = settingsBuilder.updateBudgetSettings().build(); + getBudgetSettings = settingsBuilder.getBudgetSettings().build(); + listBudgetsSettings = settingsBuilder.listBudgetsSettings().build(); + deleteBudgetSettings = settingsBuilder.deleteBudgetSettings().build(); + } + + private static final PagedListDescriptor + LIST_BUDGETS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListBudgetsRequest injectToken(ListBudgetsRequest payload, String token) { + return ListBudgetsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListBudgetsRequest injectPageSize(ListBudgetsRequest payload, int pageSize) { + return ListBudgetsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListBudgetsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListBudgetsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListBudgetsResponse payload) { + return payload.getBudgetsList() != null + ? payload.getBudgetsList() + : ImmutableList.of(); + } + }; + + private static final PagedListResponseFactory< + ListBudgetsRequest, ListBudgetsResponse, ListBudgetsPagedResponse> + LIST_BUDGETS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListBudgetsRequest, ListBudgetsResponse, ListBudgetsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListBudgetsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_BUDGETS_PAGE_STR_DESC, request, context); + return ListBudgetsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for BudgetServiceStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder createBudgetSettings; + private final UnaryCallSettings.Builder updateBudgetSettings; + private final UnaryCallSettings.Builder getBudgetSettings; + private final PagedCallSettings.Builder< + ListBudgetsRequest, ListBudgetsResponse, ListBudgetsPagedResponse> + listBudgetsSettings; + private final UnaryCallSettings.Builder deleteBudgetSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "retry_policy_1_codes", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); + definitions.put( + "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(60000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(60000L)) + .setTotalTimeout(Duration.ofMillis(60000L)) + .build(); + definitions.put("retry_policy_1_params", settings); + settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); + definitions.put("no_retry_params", settings); + settings = + RetrySettings.newBuilder() + .setInitialRpcTimeout(Duration.ofMillis(60000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(60000L)) + .setTotalTimeout(Duration.ofMillis(60000L)) + .build(); + definitions.put("no_retry_1_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + createBudgetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateBudgetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getBudgetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listBudgetsSettings = PagedCallSettings.newBuilder(LIST_BUDGETS_PAGE_STR_FACT); + + deleteBudgetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createBudgetSettings, + updateBudgetSettings, + getBudgetSettings, + listBudgetsSettings, + deleteBudgetSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .createBudgetSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + + builder + .updateBudgetSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + + builder + .getBudgetSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + + builder + .listBudgetsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + + builder + .deleteBudgetSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); + + return builder; + } + + protected Builder(BudgetServiceStubSettings settings) { + super(settings); + + createBudgetSettings = settings.createBudgetSettings.toBuilder(); + updateBudgetSettings = settings.updateBudgetSettings.toBuilder(); + getBudgetSettings = settings.getBudgetSettings.toBuilder(); + listBudgetsSettings = settings.listBudgetsSettings.toBuilder(); + deleteBudgetSettings = settings.deleteBudgetSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createBudgetSettings, + updateBudgetSettings, + getBudgetSettings, + listBudgetsSettings, + deleteBudgetSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to createBudget. */ + public UnaryCallSettings.Builder createBudgetSettings() { + return createBudgetSettings; + } + + /** Returns the builder for the settings used for calls to updateBudget. */ + public UnaryCallSettings.Builder updateBudgetSettings() { + return updateBudgetSettings; + } + + /** Returns the builder for the settings used for calls to getBudget. */ + public UnaryCallSettings.Builder getBudgetSettings() { + return getBudgetSettings; + } + + /** Returns the builder for the settings used for calls to listBudgets. */ + public PagedCallSettings.Builder< + ListBudgetsRequest, ListBudgetsResponse, ListBudgetsPagedResponse> + listBudgetsSettings() { + return listBudgetsSettings; + } + + /** Returns the builder for the settings used for calls to deleteBudget. */ + public UnaryCallSettings.Builder deleteBudgetSettings() { + return deleteBudgetSettings; + } + + @Override + public BudgetServiceStubSettings build() throws IOException { + return new BudgetServiceStubSettings(this); + } + } +} diff --git a/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/stub/GrpcBudgetServiceCallableFactory.java b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/stub/GrpcBudgetServiceCallableFactory.java new file mode 100644 index 00000000..9cc10b27 --- /dev/null +++ b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/stub/GrpcBudgetServiceCallableFactory.java @@ -0,0 +1,115 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.billing.budgets.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * gRPC callable factory implementation for Cloud Billing Budget API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class GrpcBudgetServiceCallableFactory implements GrpcStubCallableFactory { + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings pagedCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable( + grpcCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, batchingCallSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings operationCallSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, operationCallSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } +} diff --git a/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/stub/GrpcBudgetServiceStub.java b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/stub/GrpcBudgetServiceStub.java new file mode 100644 index 00000000..e14c4752 --- /dev/null +++ b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/stub/GrpcBudgetServiceStub.java @@ -0,0 +1,282 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.billing.budgets.v1.stub; + +import static com.google.cloud.billing.budgets.v1.BudgetServiceClient.ListBudgetsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.RequestParamsExtractor; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.billing.budgets.v1.Budget; +import com.google.cloud.billing.budgets.v1.CreateBudgetRequest; +import com.google.cloud.billing.budgets.v1.DeleteBudgetRequest; +import com.google.cloud.billing.budgets.v1.GetBudgetRequest; +import com.google.cloud.billing.budgets.v1.ListBudgetsRequest; +import com.google.cloud.billing.budgets.v1.ListBudgetsResponse; +import com.google.cloud.billing.budgets.v1.UpdateBudgetRequest; +import com.google.common.collect.ImmutableMap; +import com.google.protobuf.Empty; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * gRPC stub implementation for Cloud Billing Budget API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class GrpcBudgetServiceStub extends BudgetServiceStub { + + private static final MethodDescriptor createBudgetMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.billing.budgets.v1.BudgetService/CreateBudget") + .setRequestMarshaller(ProtoUtils.marshaller(CreateBudgetRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Budget.getDefaultInstance())) + .build(); + private static final MethodDescriptor updateBudgetMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.billing.budgets.v1.BudgetService/UpdateBudget") + .setRequestMarshaller(ProtoUtils.marshaller(UpdateBudgetRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Budget.getDefaultInstance())) + .build(); + private static final MethodDescriptor getBudgetMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.billing.budgets.v1.BudgetService/GetBudget") + .setRequestMarshaller(ProtoUtils.marshaller(GetBudgetRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Budget.getDefaultInstance())) + .build(); + private static final MethodDescriptor + listBudgetsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.billing.budgets.v1.BudgetService/ListBudgets") + .setRequestMarshaller(ProtoUtils.marshaller(ListBudgetsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListBudgetsResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor deleteBudgetMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.billing.budgets.v1.BudgetService/DeleteBudget") + .setRequestMarshaller(ProtoUtils.marshaller(DeleteBudgetRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable createBudgetCallable; + private final UnaryCallable updateBudgetCallable; + private final UnaryCallable getBudgetCallable; + private final UnaryCallable listBudgetsCallable; + private final UnaryCallable + listBudgetsPagedCallable; + private final UnaryCallable deleteBudgetCallable; + + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcBudgetServiceStub create(BudgetServiceStubSettings settings) + throws IOException { + return new GrpcBudgetServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcBudgetServiceStub create(ClientContext clientContext) throws IOException { + return new GrpcBudgetServiceStub(BudgetServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcBudgetServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcBudgetServiceStub( + BudgetServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcBudgetServiceStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GrpcBudgetServiceStub(BudgetServiceStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcBudgetServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcBudgetServiceStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected GrpcBudgetServiceStub( + BudgetServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + GrpcCallSettings createBudgetTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createBudgetMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(CreateBudgetRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings updateBudgetTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateBudgetMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(UpdateBudgetRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("budget.name", String.valueOf(request.getBudget().getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings getBudgetTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getBudgetMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetBudgetRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings listBudgetsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listBudgetsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ListBudgetsRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings deleteBudgetTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteBudgetMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(DeleteBudgetRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + + this.createBudgetCallable = + callableFactory.createUnaryCallable( + createBudgetTransportSettings, settings.createBudgetSettings(), clientContext); + this.updateBudgetCallable = + callableFactory.createUnaryCallable( + updateBudgetTransportSettings, settings.updateBudgetSettings(), clientContext); + this.getBudgetCallable = + callableFactory.createUnaryCallable( + getBudgetTransportSettings, settings.getBudgetSettings(), clientContext); + this.listBudgetsCallable = + callableFactory.createUnaryCallable( + listBudgetsTransportSettings, settings.listBudgetsSettings(), clientContext); + this.listBudgetsPagedCallable = + callableFactory.createPagedCallable( + listBudgetsTransportSettings, settings.listBudgetsSettings(), clientContext); + this.deleteBudgetCallable = + callableFactory.createUnaryCallable( + deleteBudgetTransportSettings, settings.deleteBudgetSettings(), clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public UnaryCallable createBudgetCallable() { + return createBudgetCallable; + } + + public UnaryCallable updateBudgetCallable() { + return updateBudgetCallable; + } + + public UnaryCallable getBudgetCallable() { + return getBudgetCallable; + } + + public UnaryCallable listBudgetsPagedCallable() { + return listBudgetsPagedCallable; + } + + public UnaryCallable listBudgetsCallable() { + return listBudgetsCallable; + } + + public UnaryCallable deleteBudgetCallable() { + return deleteBudgetCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1/BudgetServiceClientTest.java b/google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1/BudgetServiceClientTest.java new file mode 100644 index 00000000..84f4cb14 --- /dev/null +++ b/google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1/BudgetServiceClientTest.java @@ -0,0 +1,310 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.billing.budgets.v1; + +import static com.google.cloud.billing.budgets.v1.BudgetServiceClient.ListBudgetsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.common.collect.Lists; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import io.grpc.Status; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class BudgetServiceClientTest { + private static MockBudgetService mockBudgetService; + private static MockServiceHelper serviceHelper; + private BudgetServiceClient client; + private LocalChannelProvider channelProvider; + + @BeforeClass + public static void startStaticServer() { + mockBudgetService = new MockBudgetService(); + serviceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), Arrays.asList(mockBudgetService)); + serviceHelper.start(); + } + + @AfterClass + public static void stopServer() { + serviceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + serviceHelper.reset(); + channelProvider = serviceHelper.createChannelProvider(); + BudgetServiceSettings settings = + BudgetServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = BudgetServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void createBudgetTest() { + BudgetName name = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]"); + String displayName = "displayName1615086568"; + String etag = "etag3123477"; + Budget expectedResponse = + Budget.newBuilder() + .setName(name.toString()) + .setDisplayName(displayName) + .setEtag(etag) + .build(); + mockBudgetService.addResponse(expectedResponse); + + BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]"); + Budget budget = Budget.newBuilder().build(); + + Budget actualResponse = client.createBudget(parent, budget); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBudgetService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateBudgetRequest actualRequest = (CreateBudgetRequest) actualRequests.get(0); + + Assert.assertEquals(parent, BillingAccountName.parse(actualRequest.getParent())); + Assert.assertEquals(budget, actualRequest.getBudget()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void createBudgetExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockBudgetService.addException(exception); + + try { + BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]"); + Budget budget = Budget.newBuilder().build(); + + client.createBudget(parent, budget); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateBudgetTest() { + BudgetName name = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]"); + String displayName = "displayName1615086568"; + String etag = "etag3123477"; + Budget expectedResponse = + Budget.newBuilder() + .setName(name.toString()) + .setDisplayName(displayName) + .setEtag(etag) + .build(); + mockBudgetService.addResponse(expectedResponse); + + Budget budget = Budget.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Budget actualResponse = client.updateBudget(budget, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBudgetService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateBudgetRequest actualRequest = (UpdateBudgetRequest) actualRequests.get(0); + + Assert.assertEquals(budget, actualRequest.getBudget()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void updateBudgetExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockBudgetService.addException(exception); + + try { + Budget budget = Budget.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + client.updateBudget(budget, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getBudgetTest() { + BudgetName name2 = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]"); + String displayName = "displayName1615086568"; + String etag = "etag3123477"; + Budget expectedResponse = + Budget.newBuilder() + .setName(name2.toString()) + .setDisplayName(displayName) + .setEtag(etag) + .build(); + mockBudgetService.addResponse(expectedResponse); + + BudgetName name = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]"); + + Budget actualResponse = client.getBudget(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBudgetService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetBudgetRequest actualRequest = (GetBudgetRequest) actualRequests.get(0); + + Assert.assertEquals(name, BudgetName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void getBudgetExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockBudgetService.addException(exception); + + try { + BudgetName name = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]"); + + client.getBudget(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listBudgetsTest() { + String nextPageToken = ""; + Budget budgetsElement = Budget.newBuilder().build(); + List budgets = Arrays.asList(budgetsElement); + ListBudgetsResponse expectedResponse = + ListBudgetsResponse.newBuilder() + .setNextPageToken(nextPageToken) + .addAllBudgets(budgets) + .build(); + mockBudgetService.addResponse(expectedResponse); + + BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]"); + + ListBudgetsPagedResponse pagedListResponse = client.listBudgets(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getBudgetsList().get(0), resources.get(0)); + + List actualRequests = mockBudgetService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListBudgetsRequest actualRequest = (ListBudgetsRequest) actualRequests.get(0); + + Assert.assertEquals(parent, BillingAccountName.parse(actualRequest.getParent())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void listBudgetsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockBudgetService.addException(exception); + + try { + BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]"); + + client.listBudgets(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteBudgetTest() { + Empty expectedResponse = Empty.newBuilder().build(); + mockBudgetService.addResponse(expectedResponse); + + BudgetName name = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]"); + + client.deleteBudget(name); + + List actualRequests = mockBudgetService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteBudgetRequest actualRequest = (DeleteBudgetRequest) actualRequests.get(0); + + Assert.assertEquals(name, BudgetName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void deleteBudgetExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockBudgetService.addException(exception); + + try { + BudgetName name = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]"); + + client.deleteBudget(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1/MockBudgetService.java b/google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1/MockBudgetService.java new file mode 100644 index 00000000..ea8e247a --- /dev/null +++ b/google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1/MockBudgetService.java @@ -0,0 +1,57 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.billing.budgets.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockBudgetService implements MockGrpcService { + private final MockBudgetServiceImpl serviceImpl; + + public MockBudgetService() { + serviceImpl = new MockBudgetServiceImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1/MockBudgetServiceImpl.java b/google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1/MockBudgetServiceImpl.java new file mode 100644 index 00000000..48a3f464 --- /dev/null +++ b/google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1/MockBudgetServiceImpl.java @@ -0,0 +1,130 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.billing.budgets.v1; + +import com.google.api.core.BetaApi; +import com.google.cloud.billing.budgets.v1.BudgetServiceGrpc.BudgetServiceImplBase; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Empty; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockBudgetServiceImpl extends BudgetServiceImplBase { + private List requests; + private Queue responses; + + public MockBudgetServiceImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void createBudget(CreateBudgetRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Budget) { + requests.add(request); + responseObserver.onNext((Budget) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void updateBudget(UpdateBudgetRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Budget) { + requests.add(request); + responseObserver.onNext((Budget) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void getBudget(GetBudgetRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Budget) { + requests.add(request); + responseObserver.onNext((Budget) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void listBudgets( + ListBudgetsRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ListBudgetsResponse) { + requests.add(request); + responseObserver.onNext((ListBudgetsResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void deleteBudget(DeleteBudgetRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Empty) { + requests.add(request); + responseObserver.onNext((Empty) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } +} diff --git a/grpc-google-cloud-billingbudgets-v1/pom.xml b/grpc-google-cloud-billingbudgets-v1/pom.xml new file mode 100644 index 00000000..9d3092d5 --- /dev/null +++ b/grpc-google-cloud-billingbudgets-v1/pom.xml @@ -0,0 +1,65 @@ + + 4.0.0 + com.google.api.grpc + grpc-google-cloud-billingbudgets-v1 + 0.4.2-SNAPSHOT + grpc-google-cloud-billingbudgets-v1 + GRPC library for grpc-google-cloud-billingbudgets-v1 + + com.google.cloud + google-cloud-billingbudgets-parent + 0.4.2-SNAPSHOT + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-cloud-billingbudgets-v1 + + + com.google.guava + guava + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + \ No newline at end of file diff --git a/grpc-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetServiceGrpc.java b/grpc-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetServiceGrpc.java new file mode 100644 index 00000000..dc5eb87d --- /dev/null +++ b/grpc-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetServiceGrpc.java @@ -0,0 +1,872 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.billing.budgets.v1; + +import static io.grpc.MethodDescriptor.generateFullMethodName; +import static io.grpc.stub.ClientCalls.asyncUnaryCall; +import static io.grpc.stub.ClientCalls.blockingUnaryCall; +import static io.grpc.stub.ClientCalls.futureUnaryCall; +import static io.grpc.stub.ServerCalls.asyncUnaryCall; +import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; + +/** + * + * + *
+ * BudgetService stores Cloud Billing budgets, which define a
+ * budget plan and rules to execute as we track spend against that plan.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/billing/budgets/v1/budget_service.proto") +public final class BudgetServiceGrpc { + + private BudgetServiceGrpc() {} + + public static final String SERVICE_NAME = "google.cloud.billing.budgets.v1.BudgetService"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1.CreateBudgetRequest, + com.google.cloud.billing.budgets.v1.Budget> + getCreateBudgetMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CreateBudget", + requestType = com.google.cloud.billing.budgets.v1.CreateBudgetRequest.class, + responseType = com.google.cloud.billing.budgets.v1.Budget.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1.CreateBudgetRequest, + com.google.cloud.billing.budgets.v1.Budget> + getCreateBudgetMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1.CreateBudgetRequest, + com.google.cloud.billing.budgets.v1.Budget> + getCreateBudgetMethod; + if ((getCreateBudgetMethod = BudgetServiceGrpc.getCreateBudgetMethod) == null) { + synchronized (BudgetServiceGrpc.class) { + if ((getCreateBudgetMethod = BudgetServiceGrpc.getCreateBudgetMethod) == null) { + BudgetServiceGrpc.getCreateBudgetMethod = + getCreateBudgetMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CreateBudget")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.budgets.v1.CreateBudgetRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.budgets.v1.Budget.getDefaultInstance())) + .setSchemaDescriptor( + new BudgetServiceMethodDescriptorSupplier("CreateBudget")) + .build(); + } + } + } + return getCreateBudgetMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1.UpdateBudgetRequest, + com.google.cloud.billing.budgets.v1.Budget> + getUpdateBudgetMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdateBudget", + requestType = com.google.cloud.billing.budgets.v1.UpdateBudgetRequest.class, + responseType = com.google.cloud.billing.budgets.v1.Budget.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1.UpdateBudgetRequest, + com.google.cloud.billing.budgets.v1.Budget> + getUpdateBudgetMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1.UpdateBudgetRequest, + com.google.cloud.billing.budgets.v1.Budget> + getUpdateBudgetMethod; + if ((getUpdateBudgetMethod = BudgetServiceGrpc.getUpdateBudgetMethod) == null) { + synchronized (BudgetServiceGrpc.class) { + if ((getUpdateBudgetMethod = BudgetServiceGrpc.getUpdateBudgetMethod) == null) { + BudgetServiceGrpc.getUpdateBudgetMethod = + getUpdateBudgetMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UpdateBudget")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.budgets.v1.UpdateBudgetRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.budgets.v1.Budget.getDefaultInstance())) + .setSchemaDescriptor( + new BudgetServiceMethodDescriptorSupplier("UpdateBudget")) + .build(); + } + } + } + return getUpdateBudgetMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1.GetBudgetRequest, + com.google.cloud.billing.budgets.v1.Budget> + getGetBudgetMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetBudget", + requestType = com.google.cloud.billing.budgets.v1.GetBudgetRequest.class, + responseType = com.google.cloud.billing.budgets.v1.Budget.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1.GetBudgetRequest, + com.google.cloud.billing.budgets.v1.Budget> + getGetBudgetMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1.GetBudgetRequest, + com.google.cloud.billing.budgets.v1.Budget> + getGetBudgetMethod; + if ((getGetBudgetMethod = BudgetServiceGrpc.getGetBudgetMethod) == null) { + synchronized (BudgetServiceGrpc.class) { + if ((getGetBudgetMethod = BudgetServiceGrpc.getGetBudgetMethod) == null) { + BudgetServiceGrpc.getGetBudgetMethod = + getGetBudgetMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetBudget")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.budgets.v1.GetBudgetRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.budgets.v1.Budget.getDefaultInstance())) + .setSchemaDescriptor(new BudgetServiceMethodDescriptorSupplier("GetBudget")) + .build(); + } + } + } + return getGetBudgetMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1.ListBudgetsRequest, + com.google.cloud.billing.budgets.v1.ListBudgetsResponse> + getListBudgetsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListBudgets", + requestType = com.google.cloud.billing.budgets.v1.ListBudgetsRequest.class, + responseType = com.google.cloud.billing.budgets.v1.ListBudgetsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1.ListBudgetsRequest, + com.google.cloud.billing.budgets.v1.ListBudgetsResponse> + getListBudgetsMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1.ListBudgetsRequest, + com.google.cloud.billing.budgets.v1.ListBudgetsResponse> + getListBudgetsMethod; + if ((getListBudgetsMethod = BudgetServiceGrpc.getListBudgetsMethod) == null) { + synchronized (BudgetServiceGrpc.class) { + if ((getListBudgetsMethod = BudgetServiceGrpc.getListBudgetsMethod) == null) { + BudgetServiceGrpc.getListBudgetsMethod = + getListBudgetsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListBudgets")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.budgets.v1.ListBudgetsRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.budgets.v1.ListBudgetsResponse + .getDefaultInstance())) + .setSchemaDescriptor(new BudgetServiceMethodDescriptorSupplier("ListBudgets")) + .build(); + } + } + } + return getListBudgetsMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1.DeleteBudgetRequest, com.google.protobuf.Empty> + getDeleteBudgetMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DeleteBudget", + requestType = com.google.cloud.billing.budgets.v1.DeleteBudgetRequest.class, + responseType = com.google.protobuf.Empty.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1.DeleteBudgetRequest, com.google.protobuf.Empty> + getDeleteBudgetMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1.DeleteBudgetRequest, com.google.protobuf.Empty> + getDeleteBudgetMethod; + if ((getDeleteBudgetMethod = BudgetServiceGrpc.getDeleteBudgetMethod) == null) { + synchronized (BudgetServiceGrpc.class) { + if ((getDeleteBudgetMethod = BudgetServiceGrpc.getDeleteBudgetMethod) == null) { + BudgetServiceGrpc.getDeleteBudgetMethod = + getDeleteBudgetMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "DeleteBudget")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.budgets.v1.DeleteBudgetRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.protobuf.Empty.getDefaultInstance())) + .setSchemaDescriptor( + new BudgetServiceMethodDescriptorSupplier("DeleteBudget")) + .build(); + } + } + } + return getDeleteBudgetMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static BudgetServiceStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public BudgetServiceStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new BudgetServiceStub(channel, callOptions); + } + }; + return BudgetServiceStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static BudgetServiceBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public BudgetServiceBlockingStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new BudgetServiceBlockingStub(channel, callOptions); + } + }; + return BudgetServiceBlockingStub.newStub(factory, channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static BudgetServiceFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public BudgetServiceFutureStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new BudgetServiceFutureStub(channel, callOptions); + } + }; + return BudgetServiceFutureStub.newStub(factory, channel); + } + + /** + * + * + *
+   * BudgetService stores Cloud Billing budgets, which define a
+   * budget plan and rules to execute as we track spend against that plan.
+   * 
+ */ + public abstract static class BudgetServiceImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Creates a new budget. See
+     * [Quotas and limits](https://cloud.google.com/billing/quotas)
+     * for more information on the limits of the number of budgets you can create.
+     * 
+ */ + public void createBudget( + com.google.cloud.billing.budgets.v1.CreateBudgetRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getCreateBudgetMethod(), responseObserver); + } + + /** + * + * + *
+     * Updates a budget and returns the updated budget.
+     * WARNING: There are some fields exposed on the Google Cloud Console that
+     * aren't available on this API. Budget fields that are not exposed in
+     * this API will not be changed by this method.
+     * 
+ */ + public void updateBudget( + com.google.cloud.billing.budgets.v1.UpdateBudgetRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getUpdateBudgetMethod(), responseObserver); + } + + /** + * + * + *
+     * Returns a budget.
+     * WARNING: There are some fields exposed on the Google Cloud Console that
+     * aren't available on this API. When reading from the API, you will not
+     * see these fields in the return value, though they may have been set
+     * in the Cloud Console.
+     * 
+ */ + public void getBudget( + com.google.cloud.billing.budgets.v1.GetBudgetRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getGetBudgetMethod(), responseObserver); + } + + /** + * + * + *
+     * Returns a list of budgets for a billing account.
+     * WARNING: There are some fields exposed on the Google Cloud Console that
+     * aren't available on this API. When reading from the API, you will not
+     * see these fields in the return value, though they may have been set
+     * in the Cloud Console.
+     * 
+ */ + public void listBudgets( + com.google.cloud.billing.budgets.v1.ListBudgetsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getListBudgetsMethod(), responseObserver); + } + + /** + * + * + *
+     * Deletes a budget. Returns successfully if already deleted.
+     * 
+ */ + public void deleteBudget( + com.google.cloud.billing.budgets.v1.DeleteBudgetRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getDeleteBudgetMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getCreateBudgetMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.billing.budgets.v1.CreateBudgetRequest, + com.google.cloud.billing.budgets.v1.Budget>(this, METHODID_CREATE_BUDGET))) + .addMethod( + getUpdateBudgetMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.billing.budgets.v1.UpdateBudgetRequest, + com.google.cloud.billing.budgets.v1.Budget>(this, METHODID_UPDATE_BUDGET))) + .addMethod( + getGetBudgetMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.billing.budgets.v1.GetBudgetRequest, + com.google.cloud.billing.budgets.v1.Budget>(this, METHODID_GET_BUDGET))) + .addMethod( + getListBudgetsMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.billing.budgets.v1.ListBudgetsRequest, + com.google.cloud.billing.budgets.v1.ListBudgetsResponse>( + this, METHODID_LIST_BUDGETS))) + .addMethod( + getDeleteBudgetMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.billing.budgets.v1.DeleteBudgetRequest, + com.google.protobuf.Empty>(this, METHODID_DELETE_BUDGET))) + .build(); + } + } + + /** + * + * + *
+   * BudgetService stores Cloud Billing budgets, which define a
+   * budget plan and rules to execute as we track spend against that plan.
+   * 
+ */ + public static final class BudgetServiceStub + extends io.grpc.stub.AbstractAsyncStub { + private BudgetServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected BudgetServiceStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new BudgetServiceStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a new budget. See
+     * [Quotas and limits](https://cloud.google.com/billing/quotas)
+     * for more information on the limits of the number of budgets you can create.
+     * 
+ */ + public void createBudget( + com.google.cloud.billing.budgets.v1.CreateBudgetRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getCreateBudgetMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Updates a budget and returns the updated budget.
+     * WARNING: There are some fields exposed on the Google Cloud Console that
+     * aren't available on this API. Budget fields that are not exposed in
+     * this API will not be changed by this method.
+     * 
+ */ + public void updateBudget( + com.google.cloud.billing.budgets.v1.UpdateBudgetRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getUpdateBudgetMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Returns a budget.
+     * WARNING: There are some fields exposed on the Google Cloud Console that
+     * aren't available on this API. When reading from the API, you will not
+     * see these fields in the return value, though they may have been set
+     * in the Cloud Console.
+     * 
+ */ + public void getBudget( + com.google.cloud.billing.budgets.v1.GetBudgetRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getGetBudgetMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * Returns a list of budgets for a billing account.
+     * WARNING: There are some fields exposed on the Google Cloud Console that
+     * aren't available on this API. When reading from the API, you will not
+     * see these fields in the return value, though they may have been set
+     * in the Cloud Console.
+     * 
+ */ + public void listBudgets( + com.google.cloud.billing.budgets.v1.ListBudgetsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getListBudgetsMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Deletes a budget. Returns successfully if already deleted.
+     * 
+ */ + public void deleteBudget( + com.google.cloud.billing.budgets.v1.DeleteBudgetRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getDeleteBudgetMethod(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * + * + *
+   * BudgetService stores Cloud Billing budgets, which define a
+   * budget plan and rules to execute as we track spend against that plan.
+   * 
+ */ + public static final class BudgetServiceBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private BudgetServiceBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected BudgetServiceBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new BudgetServiceBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a new budget. See
+     * [Quotas and limits](https://cloud.google.com/billing/quotas)
+     * for more information on the limits of the number of budgets you can create.
+     * 
+ */ + public com.google.cloud.billing.budgets.v1.Budget createBudget( + com.google.cloud.billing.budgets.v1.CreateBudgetRequest request) { + return blockingUnaryCall(getChannel(), getCreateBudgetMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Updates a budget and returns the updated budget.
+     * WARNING: There are some fields exposed on the Google Cloud Console that
+     * aren't available on this API. Budget fields that are not exposed in
+     * this API will not be changed by this method.
+     * 
+ */ + public com.google.cloud.billing.budgets.v1.Budget updateBudget( + com.google.cloud.billing.budgets.v1.UpdateBudgetRequest request) { + return blockingUnaryCall(getChannel(), getUpdateBudgetMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Returns a budget.
+     * WARNING: There are some fields exposed on the Google Cloud Console that
+     * aren't available on this API. When reading from the API, you will not
+     * see these fields in the return value, though they may have been set
+     * in the Cloud Console.
+     * 
+ */ + public com.google.cloud.billing.budgets.v1.Budget getBudget( + com.google.cloud.billing.budgets.v1.GetBudgetRequest request) { + return blockingUnaryCall(getChannel(), getGetBudgetMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Returns a list of budgets for a billing account.
+     * WARNING: There are some fields exposed on the Google Cloud Console that
+     * aren't available on this API. When reading from the API, you will not
+     * see these fields in the return value, though they may have been set
+     * in the Cloud Console.
+     * 
+ */ + public com.google.cloud.billing.budgets.v1.ListBudgetsResponse listBudgets( + com.google.cloud.billing.budgets.v1.ListBudgetsRequest request) { + return blockingUnaryCall(getChannel(), getListBudgetsMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Deletes a budget. Returns successfully if already deleted.
+     * 
+ */ + public com.google.protobuf.Empty deleteBudget( + com.google.cloud.billing.budgets.v1.DeleteBudgetRequest request) { + return blockingUnaryCall(getChannel(), getDeleteBudgetMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * BudgetService stores Cloud Billing budgets, which define a
+   * budget plan and rules to execute as we track spend against that plan.
+   * 
+ */ + public static final class BudgetServiceFutureStub + extends io.grpc.stub.AbstractFutureStub { + private BudgetServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected BudgetServiceFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new BudgetServiceFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a new budget. See
+     * [Quotas and limits](https://cloud.google.com/billing/quotas)
+     * for more information on the limits of the number of budgets you can create.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.billing.budgets.v1.Budget> + createBudget(com.google.cloud.billing.budgets.v1.CreateBudgetRequest request) { + return futureUnaryCall( + getChannel().newCall(getCreateBudgetMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Updates a budget and returns the updated budget.
+     * WARNING: There are some fields exposed on the Google Cloud Console that
+     * aren't available on this API. Budget fields that are not exposed in
+     * this API will not be changed by this method.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.billing.budgets.v1.Budget> + updateBudget(com.google.cloud.billing.budgets.v1.UpdateBudgetRequest request) { + return futureUnaryCall( + getChannel().newCall(getUpdateBudgetMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Returns a budget.
+     * WARNING: There are some fields exposed on the Google Cloud Console that
+     * aren't available on this API. When reading from the API, you will not
+     * see these fields in the return value, though they may have been set
+     * in the Cloud Console.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.billing.budgets.v1.Budget> + getBudget(com.google.cloud.billing.budgets.v1.GetBudgetRequest request) { + return futureUnaryCall(getChannel().newCall(getGetBudgetMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Returns a list of budgets for a billing account.
+     * WARNING: There are some fields exposed on the Google Cloud Console that
+     * aren't available on this API. When reading from the API, you will not
+     * see these fields in the return value, though they may have been set
+     * in the Cloud Console.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.billing.budgets.v1.ListBudgetsResponse> + listBudgets(com.google.cloud.billing.budgets.v1.ListBudgetsRequest request) { + return futureUnaryCall( + getChannel().newCall(getListBudgetsMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Deletes a budget. Returns successfully if already deleted.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + deleteBudget(com.google.cloud.billing.budgets.v1.DeleteBudgetRequest request) { + return futureUnaryCall( + getChannel().newCall(getDeleteBudgetMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_CREATE_BUDGET = 0; + private static final int METHODID_UPDATE_BUDGET = 1; + private static final int METHODID_GET_BUDGET = 2; + private static final int METHODID_LIST_BUDGETS = 3; + private static final int METHODID_DELETE_BUDGET = 4; + + private static final class MethodHandlers + implements io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final BudgetServiceImplBase serviceImpl; + private final int methodId; + + MethodHandlers(BudgetServiceImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_CREATE_BUDGET: + serviceImpl.createBudget( + (com.google.cloud.billing.budgets.v1.CreateBudgetRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_UPDATE_BUDGET: + serviceImpl.updateBudget( + (com.google.cloud.billing.budgets.v1.UpdateBudgetRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_GET_BUDGET: + serviceImpl.getBudget( + (com.google.cloud.billing.budgets.v1.GetBudgetRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_LIST_BUDGETS: + serviceImpl.listBudgets( + (com.google.cloud.billing.budgets.v1.ListBudgetsRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_DELETE_BUDGET: + serviceImpl.deleteBudget( + (com.google.cloud.billing.budgets.v1.DeleteBudgetRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + private abstract static class BudgetServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + BudgetServiceBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("BudgetService"); + } + } + + private static final class BudgetServiceFileDescriptorSupplier + extends BudgetServiceBaseDescriptorSupplier { + BudgetServiceFileDescriptorSupplier() {} + } + + private static final class BudgetServiceMethodDescriptorSupplier + extends BudgetServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + BudgetServiceMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (BudgetServiceGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new BudgetServiceFileDescriptorSupplier()) + .addMethod(getCreateBudgetMethod()) + .addMethod(getUpdateBudgetMethod()) + .addMethod(getGetBudgetMethod()) + .addMethod(getListBudgetsMethod()) + .addMethod(getDeleteBudgetMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/pom.xml b/pom.xml index 898123b2..034c688a 100644 --- a/pom.xml +++ b/pom.xml @@ -72,11 +72,21 @@ proto-google-cloud-billingbudgets-v1beta1 0.4.2-SNAPSHOT + + com.google.api.grpc + proto-google-cloud-billingbudgets-v1 + 0.4.2-SNAPSHOT + com.google.api.grpc grpc-google-cloud-billingbudgets-v1beta1 0.4.2-SNAPSHOT + + com.google.api.grpc + grpc-google-cloud-billingbudgets-v1 + 0.4.2-SNAPSHOT + com.google.cloud google-cloud-billingbudgets @@ -125,7 +135,9 @@ proto-google-cloud-billingbudgets-v1beta1 + proto-google-cloud-billingbudgets-v1 grpc-google-cloud-billingbudgets-v1beta1 + grpc-google-cloud-billingbudgets-v1 google-cloud-billingbudgets google-cloud-billingbudgets-bom diff --git a/proto-google-cloud-billingbudgets-v1/clirr-ignored-differences.xml b/proto-google-cloud-billingbudgets-v1/clirr-ignored-differences.xml new file mode 100644 index 00000000..5b1dbff4 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/clirr-ignored-differences.xml @@ -0,0 +1,19 @@ + + + + + 7012 + com/google/cloud/billing/budgets/v1/*OrBuilder + * get*(*) + + + 7012 + com/google/cloud/billing/budgets/v1/*OrBuilder + boolean contains*(*) + + + 7012 + com/google/cloud/billing/budgets/v1/*OrBuilder + boolean has*(*) + + diff --git a/proto-google-cloud-billingbudgets-v1/pom.xml b/proto-google-cloud-billingbudgets-v1/pom.xml new file mode 100644 index 00000000..88c4a53a --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/pom.xml @@ -0,0 +1,42 @@ + + 4.0.0 + com.google.api.grpc + proto-google-cloud-billingbudgets-v1 + 0.4.2-SNAPSHOT + proto-google-cloud-billingbudgets-v1 + PROTO library for proto-google-cloud-billingbudgets-v1 + + com.google.cloud + google-cloud-billingbudgets-parent + 0.4.2-SNAPSHOT + + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api + api-common + + + com.google.guava + guava + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + \ No newline at end of file diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BillingAccountName.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BillingAccountName.java new file mode 100644 index 00000000..aadcc950 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BillingAccountName.java @@ -0,0 +1,162 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.billing.budgets.v1; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** AUTO-GENERATED DOCUMENTATION AND CLASS */ +@javax.annotation.Generated("by GAPIC protoc plugin") +public class BillingAccountName implements ResourceName { + + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("billingAccounts/{billing_account}"); + + private volatile Map fieldValuesMap; + + private final String billingAccount; + + public String getBillingAccount() { + return billingAccount; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private BillingAccountName(Builder builder) { + billingAccount = Preconditions.checkNotNull(builder.getBillingAccount()); + } + + public static BillingAccountName of(String billingAccount) { + return newBuilder().setBillingAccount(billingAccount).build(); + } + + public static String format(String billingAccount) { + return newBuilder().setBillingAccount(billingAccount).build().toString(); + } + + public static BillingAccountName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "BillingAccountName.parse: formattedString not in valid format"); + return of(matchMap.get("billing_account")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList(values.size()); + for (BillingAccountName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("billingAccount", billingAccount); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate("billing_account", billingAccount); + } + + /** Builder for BillingAccountName. */ + public static class Builder { + + private String billingAccount; + + public String getBillingAccount() { + return billingAccount; + } + + public Builder setBillingAccount(String billingAccount) { + this.billingAccount = billingAccount; + return this; + } + + private Builder() {} + + private Builder(BillingAccountName billingAccountName) { + billingAccount = billingAccountName.billingAccount; + } + + public BillingAccountName build() { + return new BillingAccountName(this); + } + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof BillingAccountName) { + BillingAccountName that = (BillingAccountName) o; + return (this.billingAccount.equals(that.billingAccount)); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= billingAccount.hashCode(); + return h; + } +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/Budget.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/Budget.java new file mode 100644 index 00000000..e4680a30 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/Budget.java @@ -0,0 +1,2548 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_model.proto + +package com.google.cloud.billing.budgets.v1; + +/** + * + * + *
+ * A budget is a plan that describes what you expect to spend on Cloud
+ * projects, plus the rules to execute as spend is tracked against that plan,
+ * (for example, send an alert when 90% of the target spend is met).
+ * Currently all plans are monthly budgets so the usage period(s) tracked are
+ * implied (calendar months of usage back-to-back).
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.Budget} + */ +public final class Budget extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1.Budget) + BudgetOrBuilder { + private static final long serialVersionUID = 0L; + // Use Budget.newBuilder() to construct. + private Budget(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Budget() { + name_ = ""; + displayName_ = ""; + thresholdRules_ = java.util.Collections.emptyList(); + etag_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Budget(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Budget( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + displayName_ = s; + break; + } + case 26: + { + com.google.cloud.billing.budgets.v1.Filter.Builder subBuilder = null; + if (budgetFilter_ != null) { + subBuilder = budgetFilter_.toBuilder(); + } + budgetFilter_ = + input.readMessage( + com.google.cloud.billing.budgets.v1.Filter.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(budgetFilter_); + budgetFilter_ = subBuilder.buildPartial(); + } + + break; + } + case 34: + { + com.google.cloud.billing.budgets.v1.BudgetAmount.Builder subBuilder = null; + if (amount_ != null) { + subBuilder = amount_.toBuilder(); + } + amount_ = + input.readMessage( + com.google.cloud.billing.budgets.v1.BudgetAmount.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(amount_); + amount_ = subBuilder.buildPartial(); + } + + break; + } + case 42: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + thresholdRules_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + thresholdRules_.add( + input.readMessage( + com.google.cloud.billing.budgets.v1.ThresholdRule.parser(), + extensionRegistry)); + break; + } + case 50: + { + com.google.cloud.billing.budgets.v1.NotificationsRule.Builder subBuilder = null; + if (notificationsRule_ != null) { + subBuilder = notificationsRule_.toBuilder(); + } + notificationsRule_ = + input.readMessage( + com.google.cloud.billing.budgets.v1.NotificationsRule.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(notificationsRule_); + notificationsRule_ = subBuilder.buildPartial(); + } + + break; + } + case 58: + { + java.lang.String s = input.readStringRequireUtf8(); + + etag_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + thresholdRules_ = java.util.Collections.unmodifiableList(thresholdRules_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_Budget_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_Budget_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.Budget.class, + com.google.cloud.billing.budgets.v1.Budget.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Output only. Resource name of the budget.
+   * The resource name implies the scope of a budget. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. Resource name of the budget.
+   * The resource name implies the scope of a budget. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DISPLAY_NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object displayName_; + /** + * + * + *
+   * User data for display name in UI. The name must be less than or equal to 60
+   * characters.
+   * 
+ * + * string display_name = 2; + * + * @return The displayName. + */ + @java.lang.Override + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } + } + /** + * + * + *
+   * User data for display name in UI. The name must be less than or equal to 60
+   * characters.
+   * 
+ * + * string display_name = 2; + * + * @return The bytes for displayName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int BUDGET_FILTER_FIELD_NUMBER = 3; + private com.google.cloud.billing.budgets.v1.Filter budgetFilter_; + /** + * + * + *
+   * Optional. Filters that define which resources are used to compute
+   * the actual spend against the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the budgetFilter field is set. + */ + @java.lang.Override + public boolean hasBudgetFilter() { + return budgetFilter_ != null; + } + /** + * + * + *
+   * Optional. Filters that define which resources are used to compute
+   * the actual spend against the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The budgetFilter. + */ + @java.lang.Override + public com.google.cloud.billing.budgets.v1.Filter getBudgetFilter() { + return budgetFilter_ == null + ? com.google.cloud.billing.budgets.v1.Filter.getDefaultInstance() + : budgetFilter_; + } + /** + * + * + *
+   * Optional. Filters that define which resources are used to compute
+   * the actual spend against the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.cloud.billing.budgets.v1.FilterOrBuilder getBudgetFilterOrBuilder() { + return getBudgetFilter(); + } + + public static final int AMOUNT_FIELD_NUMBER = 4; + private com.google.cloud.billing.budgets.v1.BudgetAmount amount_; + /** + * + * + *
+   * Required. Budgeted amount.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the amount field is set. + */ + @java.lang.Override + public boolean hasAmount() { + return amount_ != null; + } + /** + * + * + *
+   * Required. Budgeted amount.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The amount. + */ + @java.lang.Override + public com.google.cloud.billing.budgets.v1.BudgetAmount getAmount() { + return amount_ == null + ? com.google.cloud.billing.budgets.v1.BudgetAmount.getDefaultInstance() + : amount_; + } + /** + * + * + *
+   * Required. Budgeted amount.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.billing.budgets.v1.BudgetAmountOrBuilder getAmountOrBuilder() { + return getAmount(); + } + + public static final int THRESHOLD_RULES_FIELD_NUMBER = 5; + private java.util.List thresholdRules_; + /** + * + * + *
+   * Optional. Rules that trigger alerts (notifications of thresholds
+   * being crossed) when spend exceeds the specified percentages of the budget.
+   * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.List getThresholdRulesList() { + return thresholdRules_; + } + /** + * + * + *
+   * Optional. Rules that trigger alerts (notifications of thresholds
+   * being crossed) when spend exceeds the specified percentages of the budget.
+   * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.List + getThresholdRulesOrBuilderList() { + return thresholdRules_; + } + /** + * + * + *
+   * Optional. Rules that trigger alerts (notifications of thresholds
+   * being crossed) when spend exceeds the specified percentages of the budget.
+   * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public int getThresholdRulesCount() { + return thresholdRules_.size(); + } + /** + * + * + *
+   * Optional. Rules that trigger alerts (notifications of thresholds
+   * being crossed) when spend exceeds the specified percentages of the budget.
+   * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.cloud.billing.budgets.v1.ThresholdRule getThresholdRules(int index) { + return thresholdRules_.get(index); + } + /** + * + * + *
+   * Optional. Rules that trigger alerts (notifications of thresholds
+   * being crossed) when spend exceeds the specified percentages of the budget.
+   * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.cloud.billing.budgets.v1.ThresholdRuleOrBuilder getThresholdRulesOrBuilder( + int index) { + return thresholdRules_.get(index); + } + + public static final int NOTIFICATIONS_RULE_FIELD_NUMBER = 6; + private com.google.cloud.billing.budgets.v1.NotificationsRule notificationsRule_; + /** + * + * + *
+   * Optional. Rules to apply to notifications sent based on budget spend and
+   * thresholds.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.NotificationsRule notifications_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the notificationsRule field is set. + */ + @java.lang.Override + public boolean hasNotificationsRule() { + return notificationsRule_ != null; + } + /** + * + * + *
+   * Optional. Rules to apply to notifications sent based on budget spend and
+   * thresholds.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.NotificationsRule notifications_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The notificationsRule. + */ + @java.lang.Override + public com.google.cloud.billing.budgets.v1.NotificationsRule getNotificationsRule() { + return notificationsRule_ == null + ? com.google.cloud.billing.budgets.v1.NotificationsRule.getDefaultInstance() + : notificationsRule_; + } + /** + * + * + *
+   * Optional. Rules to apply to notifications sent based on budget spend and
+   * thresholds.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.NotificationsRule notifications_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.cloud.billing.budgets.v1.NotificationsRuleOrBuilder + getNotificationsRuleOrBuilder() { + return getNotificationsRule(); + } + + public static final int ETAG_FIELD_NUMBER = 7; + private volatile java.lang.Object etag_; + /** + * + * + *
+   * Optional. Etag to validate that the object is unchanged for a
+   * read-modify-write operation.
+   * An empty etag will cause an update to overwrite other changes.
+   * 
+ * + * string etag = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. Etag to validate that the object is unchanged for a
+   * read-modify-write operation.
+   * An empty etag will cause an update to overwrite other changes.
+   * 
+ * + * string etag = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!getDisplayNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, displayName_); + } + if (budgetFilter_ != null) { + output.writeMessage(3, getBudgetFilter()); + } + if (amount_ != null) { + output.writeMessage(4, getAmount()); + } + for (int i = 0; i < thresholdRules_.size(); i++) { + output.writeMessage(5, thresholdRules_.get(i)); + } + if (notificationsRule_ != null) { + output.writeMessage(6, getNotificationsRule()); + } + if (!getEtagBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 7, etag_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!getDisplayNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, displayName_); + } + if (budgetFilter_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getBudgetFilter()); + } + if (amount_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getAmount()); + } + for (int i = 0; i < thresholdRules_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, thresholdRules_.get(i)); + } + if (notificationsRule_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getNotificationsRule()); + } + if (!getEtagBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, etag_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1.Budget)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1.Budget other = + (com.google.cloud.billing.budgets.v1.Budget) obj; + + if (!getName().equals(other.getName())) return false; + if (!getDisplayName().equals(other.getDisplayName())) return false; + if (hasBudgetFilter() != other.hasBudgetFilter()) return false; + if (hasBudgetFilter()) { + if (!getBudgetFilter().equals(other.getBudgetFilter())) return false; + } + if (hasAmount() != other.hasAmount()) return false; + if (hasAmount()) { + if (!getAmount().equals(other.getAmount())) return false; + } + if (!getThresholdRulesList().equals(other.getThresholdRulesList())) return false; + if (hasNotificationsRule() != other.hasNotificationsRule()) return false; + if (hasNotificationsRule()) { + if (!getNotificationsRule().equals(other.getNotificationsRule())) return false; + } + if (!getEtag().equals(other.getEtag())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + DISPLAY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getDisplayName().hashCode(); + if (hasBudgetFilter()) { + hash = (37 * hash) + BUDGET_FILTER_FIELD_NUMBER; + hash = (53 * hash) + getBudgetFilter().hashCode(); + } + if (hasAmount()) { + hash = (37 * hash) + AMOUNT_FIELD_NUMBER; + hash = (53 * hash) + getAmount().hashCode(); + } + if (getThresholdRulesCount() > 0) { + hash = (37 * hash) + THRESHOLD_RULES_FIELD_NUMBER; + hash = (53 * hash) + getThresholdRulesList().hashCode(); + } + if (hasNotificationsRule()) { + hash = (37 * hash) + NOTIFICATIONS_RULE_FIELD_NUMBER; + hash = (53 * hash) + getNotificationsRule().hashCode(); + } + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1.Budget parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.Budget parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.Budget parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.Budget parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.Budget parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.Budget parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.Budget parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.Budget parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.Budget parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.Budget parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.Budget parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.Budget parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.billing.budgets.v1.Budget prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * A budget is a plan that describes what you expect to spend on Cloud
+   * projects, plus the rules to execute as spend is tracked against that plan,
+   * (for example, send an alert when 90% of the target spend is met).
+   * Currently all plans are monthly budgets so the usage period(s) tracked are
+   * implied (calendar months of usage back-to-back).
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.Budget} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1.Budget) + com.google.cloud.billing.budgets.v1.BudgetOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_Budget_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_Budget_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.Budget.class, + com.google.cloud.billing.budgets.v1.Budget.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1.Budget.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getThresholdRulesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + displayName_ = ""; + + if (budgetFilterBuilder_ == null) { + budgetFilter_ = null; + } else { + budgetFilter_ = null; + budgetFilterBuilder_ = null; + } + if (amountBuilder_ == null) { + amount_ = null; + } else { + amount_ = null; + amountBuilder_ = null; + } + if (thresholdRulesBuilder_ == null) { + thresholdRules_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + thresholdRulesBuilder_.clear(); + } + if (notificationsRuleBuilder_ == null) { + notificationsRule_ = null; + } else { + notificationsRule_ = null; + notificationsRuleBuilder_ = null; + } + etag_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_Budget_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.Budget getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1.Budget.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.Budget build() { + com.google.cloud.billing.budgets.v1.Budget result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.Budget buildPartial() { + com.google.cloud.billing.budgets.v1.Budget result = + new com.google.cloud.billing.budgets.v1.Budget(this); + int from_bitField0_ = bitField0_; + result.name_ = name_; + result.displayName_ = displayName_; + if (budgetFilterBuilder_ == null) { + result.budgetFilter_ = budgetFilter_; + } else { + result.budgetFilter_ = budgetFilterBuilder_.build(); + } + if (amountBuilder_ == null) { + result.amount_ = amount_; + } else { + result.amount_ = amountBuilder_.build(); + } + if (thresholdRulesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + thresholdRules_ = java.util.Collections.unmodifiableList(thresholdRules_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.thresholdRules_ = thresholdRules_; + } else { + result.thresholdRules_ = thresholdRulesBuilder_.build(); + } + if (notificationsRuleBuilder_ == null) { + result.notificationsRule_ = notificationsRule_; + } else { + result.notificationsRule_ = notificationsRuleBuilder_.build(); + } + result.etag_ = etag_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1.Budget) { + return mergeFrom((com.google.cloud.billing.budgets.v1.Budget) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1.Budget other) { + if (other == com.google.cloud.billing.budgets.v1.Budget.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getDisplayName().isEmpty()) { + displayName_ = other.displayName_; + onChanged(); + } + if (other.hasBudgetFilter()) { + mergeBudgetFilter(other.getBudgetFilter()); + } + if (other.hasAmount()) { + mergeAmount(other.getAmount()); + } + if (thresholdRulesBuilder_ == null) { + if (!other.thresholdRules_.isEmpty()) { + if (thresholdRules_.isEmpty()) { + thresholdRules_ = other.thresholdRules_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureThresholdRulesIsMutable(); + thresholdRules_.addAll(other.thresholdRules_); + } + onChanged(); + } + } else { + if (!other.thresholdRules_.isEmpty()) { + if (thresholdRulesBuilder_.isEmpty()) { + thresholdRulesBuilder_.dispose(); + thresholdRulesBuilder_ = null; + thresholdRules_ = other.thresholdRules_; + bitField0_ = (bitField0_ & ~0x00000001); + thresholdRulesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getThresholdRulesFieldBuilder() + : null; + } else { + thresholdRulesBuilder_.addAllMessages(other.thresholdRules_); + } + } + } + if (other.hasNotificationsRule()) { + mergeNotificationsRule(other.getNotificationsRule()); + } + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1.Budget parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.billing.budgets.v1.Budget) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Output only. Resource name of the budget.
+     * The resource name implies the scope of a budget. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. Resource name of the budget.
+     * The resource name implies the scope of a budget. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. Resource name of the budget.
+     * The resource name implies the scope of a budget. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Resource name of the budget.
+     * The resource name implies the scope of a budget. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Resource name of the budget.
+     * The resource name implies the scope of a budget. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object displayName_ = ""; + /** + * + * + *
+     * User data for display name in UI. The name must be less than or equal to 60
+     * characters.
+     * 
+ * + * string display_name = 2; + * + * @return The displayName. + */ + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * User data for display name in UI. The name must be less than or equal to 60
+     * characters.
+     * 
+ * + * string display_name = 2; + * + * @return The bytes for displayName. + */ + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * User data for display name in UI. The name must be less than or equal to 60
+     * characters.
+     * 
+ * + * string display_name = 2; + * + * @param value The displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + displayName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * User data for display name in UI. The name must be less than or equal to 60
+     * characters.
+     * 
+ * + * string display_name = 2; + * + * @return This builder for chaining. + */ + public Builder clearDisplayName() { + + displayName_ = getDefaultInstance().getDisplayName(); + onChanged(); + return this; + } + /** + * + * + *
+     * User data for display name in UI. The name must be less than or equal to 60
+     * characters.
+     * 
+ * + * string display_name = 2; + * + * @param value The bytes for displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + displayName_ = value; + onChanged(); + return this; + } + + private com.google.cloud.billing.budgets.v1.Filter budgetFilter_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1.Filter, + com.google.cloud.billing.budgets.v1.Filter.Builder, + com.google.cloud.billing.budgets.v1.FilterOrBuilder> + budgetFilterBuilder_; + /** + * + * + *
+     * Optional. Filters that define which resources are used to compute
+     * the actual spend against the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the budgetFilter field is set. + */ + public boolean hasBudgetFilter() { + return budgetFilterBuilder_ != null || budgetFilter_ != null; + } + /** + * + * + *
+     * Optional. Filters that define which resources are used to compute
+     * the actual spend against the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The budgetFilter. + */ + public com.google.cloud.billing.budgets.v1.Filter getBudgetFilter() { + if (budgetFilterBuilder_ == null) { + return budgetFilter_ == null + ? com.google.cloud.billing.budgets.v1.Filter.getDefaultInstance() + : budgetFilter_; + } else { + return budgetFilterBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Optional. Filters that define which resources are used to compute
+     * the actual spend against the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setBudgetFilter(com.google.cloud.billing.budgets.v1.Filter value) { + if (budgetFilterBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + budgetFilter_ = value; + onChanged(); + } else { + budgetFilterBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Optional. Filters that define which resources are used to compute
+     * the actual spend against the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setBudgetFilter( + com.google.cloud.billing.budgets.v1.Filter.Builder builderForValue) { + if (budgetFilterBuilder_ == null) { + budgetFilter_ = builderForValue.build(); + onChanged(); + } else { + budgetFilterBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Optional. Filters that define which resources are used to compute
+     * the actual spend against the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeBudgetFilter(com.google.cloud.billing.budgets.v1.Filter value) { + if (budgetFilterBuilder_ == null) { + if (budgetFilter_ != null) { + budgetFilter_ = + com.google.cloud.billing.budgets.v1.Filter.newBuilder(budgetFilter_) + .mergeFrom(value) + .buildPartial(); + } else { + budgetFilter_ = value; + } + onChanged(); + } else { + budgetFilterBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Optional. Filters that define which resources are used to compute
+     * the actual spend against the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearBudgetFilter() { + if (budgetFilterBuilder_ == null) { + budgetFilter_ = null; + onChanged(); + } else { + budgetFilter_ = null; + budgetFilterBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Optional. Filters that define which resources are used to compute
+     * the actual spend against the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.billing.budgets.v1.Filter.Builder getBudgetFilterBuilder() { + + onChanged(); + return getBudgetFilterFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional. Filters that define which resources are used to compute
+     * the actual spend against the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.billing.budgets.v1.FilterOrBuilder getBudgetFilterOrBuilder() { + if (budgetFilterBuilder_ != null) { + return budgetFilterBuilder_.getMessageOrBuilder(); + } else { + return budgetFilter_ == null + ? com.google.cloud.billing.budgets.v1.Filter.getDefaultInstance() + : budgetFilter_; + } + } + /** + * + * + *
+     * Optional. Filters that define which resources are used to compute
+     * the actual spend against the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1.Filter, + com.google.cloud.billing.budgets.v1.Filter.Builder, + com.google.cloud.billing.budgets.v1.FilterOrBuilder> + getBudgetFilterFieldBuilder() { + if (budgetFilterBuilder_ == null) { + budgetFilterBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1.Filter, + com.google.cloud.billing.budgets.v1.Filter.Builder, + com.google.cloud.billing.budgets.v1.FilterOrBuilder>( + getBudgetFilter(), getParentForChildren(), isClean()); + budgetFilter_ = null; + } + return budgetFilterBuilder_; + } + + private com.google.cloud.billing.budgets.v1.BudgetAmount amount_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1.BudgetAmount, + com.google.cloud.billing.budgets.v1.BudgetAmount.Builder, + com.google.cloud.billing.budgets.v1.BudgetAmountOrBuilder> + amountBuilder_; + /** + * + * + *
+     * Required. Budgeted amount.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the amount field is set. + */ + public boolean hasAmount() { + return amountBuilder_ != null || amount_ != null; + } + /** + * + * + *
+     * Required. Budgeted amount.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The amount. + */ + public com.google.cloud.billing.budgets.v1.BudgetAmount getAmount() { + if (amountBuilder_ == null) { + return amount_ == null + ? com.google.cloud.billing.budgets.v1.BudgetAmount.getDefaultInstance() + : amount_; + } else { + return amountBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. Budgeted amount.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setAmount(com.google.cloud.billing.budgets.v1.BudgetAmount value) { + if (amountBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + amount_ = value; + onChanged(); + } else { + amountBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. Budgeted amount.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setAmount( + com.google.cloud.billing.budgets.v1.BudgetAmount.Builder builderForValue) { + if (amountBuilder_ == null) { + amount_ = builderForValue.build(); + onChanged(); + } else { + amountBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. Budgeted amount.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeAmount(com.google.cloud.billing.budgets.v1.BudgetAmount value) { + if (amountBuilder_ == null) { + if (amount_ != null) { + amount_ = + com.google.cloud.billing.budgets.v1.BudgetAmount.newBuilder(amount_) + .mergeFrom(value) + .buildPartial(); + } else { + amount_ = value; + } + onChanged(); + } else { + amountBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. Budgeted amount.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearAmount() { + if (amountBuilder_ == null) { + amount_ = null; + onChanged(); + } else { + amount_ = null; + amountBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. Budgeted amount.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1.BudgetAmount.Builder getAmountBuilder() { + + onChanged(); + return getAmountFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. Budgeted amount.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1.BudgetAmountOrBuilder getAmountOrBuilder() { + if (amountBuilder_ != null) { + return amountBuilder_.getMessageOrBuilder(); + } else { + return amount_ == null + ? com.google.cloud.billing.budgets.v1.BudgetAmount.getDefaultInstance() + : amount_; + } + } + /** + * + * + *
+     * Required. Budgeted amount.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1.BudgetAmount, + com.google.cloud.billing.budgets.v1.BudgetAmount.Builder, + com.google.cloud.billing.budgets.v1.BudgetAmountOrBuilder> + getAmountFieldBuilder() { + if (amountBuilder_ == null) { + amountBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1.BudgetAmount, + com.google.cloud.billing.budgets.v1.BudgetAmount.Builder, + com.google.cloud.billing.budgets.v1.BudgetAmountOrBuilder>( + getAmount(), getParentForChildren(), isClean()); + amount_ = null; + } + return amountBuilder_; + } + + private java.util.List thresholdRules_ = + java.util.Collections.emptyList(); + + private void ensureThresholdRulesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + thresholdRules_ = + new java.util.ArrayList( + thresholdRules_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.budgets.v1.ThresholdRule, + com.google.cloud.billing.budgets.v1.ThresholdRule.Builder, + com.google.cloud.billing.budgets.v1.ThresholdRuleOrBuilder> + thresholdRulesBuilder_; + + /** + * + * + *
+     * Optional. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public java.util.List + getThresholdRulesList() { + if (thresholdRulesBuilder_ == null) { + return java.util.Collections.unmodifiableList(thresholdRules_); + } else { + return thresholdRulesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Optional. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public int getThresholdRulesCount() { + if (thresholdRulesBuilder_ == null) { + return thresholdRules_.size(); + } else { + return thresholdRulesBuilder_.getCount(); + } + } + /** + * + * + *
+     * Optional. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.billing.budgets.v1.ThresholdRule getThresholdRules(int index) { + if (thresholdRulesBuilder_ == null) { + return thresholdRules_.get(index); + } else { + return thresholdRulesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Optional. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setThresholdRules( + int index, com.google.cloud.billing.budgets.v1.ThresholdRule value) { + if (thresholdRulesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureThresholdRulesIsMutable(); + thresholdRules_.set(index, value); + onChanged(); + } else { + thresholdRulesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Optional. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setThresholdRules( + int index, com.google.cloud.billing.budgets.v1.ThresholdRule.Builder builderForValue) { + if (thresholdRulesBuilder_ == null) { + ensureThresholdRulesIsMutable(); + thresholdRules_.set(index, builderForValue.build()); + onChanged(); + } else { + thresholdRulesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Optional. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addThresholdRules(com.google.cloud.billing.budgets.v1.ThresholdRule value) { + if (thresholdRulesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureThresholdRulesIsMutable(); + thresholdRules_.add(value); + onChanged(); + } else { + thresholdRulesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Optional. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addThresholdRules( + int index, com.google.cloud.billing.budgets.v1.ThresholdRule value) { + if (thresholdRulesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureThresholdRulesIsMutable(); + thresholdRules_.add(index, value); + onChanged(); + } else { + thresholdRulesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Optional. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addThresholdRules( + com.google.cloud.billing.budgets.v1.ThresholdRule.Builder builderForValue) { + if (thresholdRulesBuilder_ == null) { + ensureThresholdRulesIsMutable(); + thresholdRules_.add(builderForValue.build()); + onChanged(); + } else { + thresholdRulesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Optional. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addThresholdRules( + int index, com.google.cloud.billing.budgets.v1.ThresholdRule.Builder builderForValue) { + if (thresholdRulesBuilder_ == null) { + ensureThresholdRulesIsMutable(); + thresholdRules_.add(index, builderForValue.build()); + onChanged(); + } else { + thresholdRulesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Optional. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addAllThresholdRules( + java.lang.Iterable values) { + if (thresholdRulesBuilder_ == null) { + ensureThresholdRulesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, thresholdRules_); + onChanged(); + } else { + thresholdRulesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Optional. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearThresholdRules() { + if (thresholdRulesBuilder_ == null) { + thresholdRules_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + thresholdRulesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Optional. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder removeThresholdRules(int index) { + if (thresholdRulesBuilder_ == null) { + ensureThresholdRulesIsMutable(); + thresholdRules_.remove(index); + onChanged(); + } else { + thresholdRulesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Optional. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.billing.budgets.v1.ThresholdRule.Builder getThresholdRulesBuilder( + int index) { + return getThresholdRulesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Optional. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.billing.budgets.v1.ThresholdRuleOrBuilder getThresholdRulesOrBuilder( + int index) { + if (thresholdRulesBuilder_ == null) { + return thresholdRules_.get(index); + } else { + return thresholdRulesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Optional. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public java.util.List + getThresholdRulesOrBuilderList() { + if (thresholdRulesBuilder_ != null) { + return thresholdRulesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(thresholdRules_); + } + } + /** + * + * + *
+     * Optional. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.billing.budgets.v1.ThresholdRule.Builder addThresholdRulesBuilder() { + return getThresholdRulesFieldBuilder() + .addBuilder(com.google.cloud.billing.budgets.v1.ThresholdRule.getDefaultInstance()); + } + /** + * + * + *
+     * Optional. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.billing.budgets.v1.ThresholdRule.Builder addThresholdRulesBuilder( + int index) { + return getThresholdRulesFieldBuilder() + .addBuilder( + index, com.google.cloud.billing.budgets.v1.ThresholdRule.getDefaultInstance()); + } + /** + * + * + *
+     * Optional. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public java.util.List + getThresholdRulesBuilderList() { + return getThresholdRulesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.budgets.v1.ThresholdRule, + com.google.cloud.billing.budgets.v1.ThresholdRule.Builder, + com.google.cloud.billing.budgets.v1.ThresholdRuleOrBuilder> + getThresholdRulesFieldBuilder() { + if (thresholdRulesBuilder_ == null) { + thresholdRulesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.budgets.v1.ThresholdRule, + com.google.cloud.billing.budgets.v1.ThresholdRule.Builder, + com.google.cloud.billing.budgets.v1.ThresholdRuleOrBuilder>( + thresholdRules_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + thresholdRules_ = null; + } + return thresholdRulesBuilder_; + } + + private com.google.cloud.billing.budgets.v1.NotificationsRule notificationsRule_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1.NotificationsRule, + com.google.cloud.billing.budgets.v1.NotificationsRule.Builder, + com.google.cloud.billing.budgets.v1.NotificationsRuleOrBuilder> + notificationsRuleBuilder_; + /** + * + * + *
+     * Optional. Rules to apply to notifications sent based on budget spend and
+     * thresholds.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.NotificationsRule notifications_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the notificationsRule field is set. + */ + public boolean hasNotificationsRule() { + return notificationsRuleBuilder_ != null || notificationsRule_ != null; + } + /** + * + * + *
+     * Optional. Rules to apply to notifications sent based on budget spend and
+     * thresholds.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.NotificationsRule notifications_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The notificationsRule. + */ + public com.google.cloud.billing.budgets.v1.NotificationsRule getNotificationsRule() { + if (notificationsRuleBuilder_ == null) { + return notificationsRule_ == null + ? com.google.cloud.billing.budgets.v1.NotificationsRule.getDefaultInstance() + : notificationsRule_; + } else { + return notificationsRuleBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Optional. Rules to apply to notifications sent based on budget spend and
+     * thresholds.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.NotificationsRule notifications_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setNotificationsRule( + com.google.cloud.billing.budgets.v1.NotificationsRule value) { + if (notificationsRuleBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + notificationsRule_ = value; + onChanged(); + } else { + notificationsRuleBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Optional. Rules to apply to notifications sent based on budget spend and
+     * thresholds.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.NotificationsRule notifications_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setNotificationsRule( + com.google.cloud.billing.budgets.v1.NotificationsRule.Builder builderForValue) { + if (notificationsRuleBuilder_ == null) { + notificationsRule_ = builderForValue.build(); + onChanged(); + } else { + notificationsRuleBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Optional. Rules to apply to notifications sent based on budget spend and
+     * thresholds.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.NotificationsRule notifications_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeNotificationsRule( + com.google.cloud.billing.budgets.v1.NotificationsRule value) { + if (notificationsRuleBuilder_ == null) { + if (notificationsRule_ != null) { + notificationsRule_ = + com.google.cloud.billing.budgets.v1.NotificationsRule.newBuilder(notificationsRule_) + .mergeFrom(value) + .buildPartial(); + } else { + notificationsRule_ = value; + } + onChanged(); + } else { + notificationsRuleBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Optional. Rules to apply to notifications sent based on budget spend and
+     * thresholds.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.NotificationsRule notifications_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearNotificationsRule() { + if (notificationsRuleBuilder_ == null) { + notificationsRule_ = null; + onChanged(); + } else { + notificationsRule_ = null; + notificationsRuleBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Optional. Rules to apply to notifications sent based on budget spend and
+     * thresholds.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.NotificationsRule notifications_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.billing.budgets.v1.NotificationsRule.Builder + getNotificationsRuleBuilder() { + + onChanged(); + return getNotificationsRuleFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional. Rules to apply to notifications sent based on budget spend and
+     * thresholds.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.NotificationsRule notifications_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.billing.budgets.v1.NotificationsRuleOrBuilder + getNotificationsRuleOrBuilder() { + if (notificationsRuleBuilder_ != null) { + return notificationsRuleBuilder_.getMessageOrBuilder(); + } else { + return notificationsRule_ == null + ? com.google.cloud.billing.budgets.v1.NotificationsRule.getDefaultInstance() + : notificationsRule_; + } + } + /** + * + * + *
+     * Optional. Rules to apply to notifications sent based on budget spend and
+     * thresholds.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.NotificationsRule notifications_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1.NotificationsRule, + com.google.cloud.billing.budgets.v1.NotificationsRule.Builder, + com.google.cloud.billing.budgets.v1.NotificationsRuleOrBuilder> + getNotificationsRuleFieldBuilder() { + if (notificationsRuleBuilder_ == null) { + notificationsRuleBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1.NotificationsRule, + com.google.cloud.billing.budgets.v1.NotificationsRule.Builder, + com.google.cloud.billing.budgets.v1.NotificationsRuleOrBuilder>( + getNotificationsRule(), getParentForChildren(), isClean()); + notificationsRule_ = null; + } + return notificationsRuleBuilder_; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * Optional. Etag to validate that the object is unchanged for a
+     * read-modify-write operation.
+     * An empty etag will cause an update to overwrite other changes.
+     * 
+ * + * string etag = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. Etag to validate that the object is unchanged for a
+     * read-modify-write operation.
+     * An empty etag will cause an update to overwrite other changes.
+     * 
+ * + * string etag = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. Etag to validate that the object is unchanged for a
+     * read-modify-write operation.
+     * An empty etag will cause an update to overwrite other changes.
+     * 
+ * + * string etag = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Etag to validate that the object is unchanged for a
+     * read-modify-write operation.
+     * An empty etag will cause an update to overwrite other changes.
+     * 
+ * + * string etag = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Etag to validate that the object is unchanged for a
+     * read-modify-write operation.
+     * An empty etag will cause an update to overwrite other changes.
+     * 
+ * + * string etag = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + etag_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1.Budget) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1.Budget) + private static final com.google.cloud.billing.budgets.v1.Budget DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1.Budget(); + } + + public static com.google.cloud.billing.budgets.v1.Budget getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Budget parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Budget(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.Budget getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetAmount.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetAmount.java new file mode 100644 index 00000000..a14e11fe --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetAmount.java @@ -0,0 +1,1174 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_model.proto + +package com.google.cloud.billing.budgets.v1; + +/** + * + * + *
+ * The budgeted amount for each usage period.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.BudgetAmount} + */ +public final class BudgetAmount extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1.BudgetAmount) + BudgetAmountOrBuilder { + private static final long serialVersionUID = 0L; + // Use BudgetAmount.newBuilder() to construct. + private BudgetAmount(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BudgetAmount() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new BudgetAmount(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BudgetAmount( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.type.Money.Builder subBuilder = null; + if (budgetAmountCase_ == 1) { + subBuilder = ((com.google.type.Money) budgetAmount_).toBuilder(); + } + budgetAmount_ = input.readMessage(com.google.type.Money.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.type.Money) budgetAmount_); + budgetAmount_ = subBuilder.buildPartial(); + } + budgetAmountCase_ = 1; + break; + } + case 18: + { + com.google.cloud.billing.budgets.v1.LastPeriodAmount.Builder subBuilder = null; + if (budgetAmountCase_ == 2) { + subBuilder = + ((com.google.cloud.billing.budgets.v1.LastPeriodAmount) budgetAmount_) + .toBuilder(); + } + budgetAmount_ = + input.readMessage( + com.google.cloud.billing.budgets.v1.LastPeriodAmount.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom( + (com.google.cloud.billing.budgets.v1.LastPeriodAmount) budgetAmount_); + budgetAmount_ = subBuilder.buildPartial(); + } + budgetAmountCase_ = 2; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_BudgetAmount_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_BudgetAmount_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.BudgetAmount.class, + com.google.cloud.billing.budgets.v1.BudgetAmount.Builder.class); + } + + private int budgetAmountCase_ = 0; + private java.lang.Object budgetAmount_; + + public enum BudgetAmountCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + SPECIFIED_AMOUNT(1), + LAST_PERIOD_AMOUNT(2), + BUDGETAMOUNT_NOT_SET(0); + private final int value; + + private BudgetAmountCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static BudgetAmountCase valueOf(int value) { + return forNumber(value); + } + + public static BudgetAmountCase forNumber(int value) { + switch (value) { + case 1: + return SPECIFIED_AMOUNT; + case 2: + return LAST_PERIOD_AMOUNT; + case 0: + return BUDGETAMOUNT_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public BudgetAmountCase getBudgetAmountCase() { + return BudgetAmountCase.forNumber(budgetAmountCase_); + } + + public static final int SPECIFIED_AMOUNT_FIELD_NUMBER = 1; + /** + * + * + *
+   * A specified amount to use as the budget.
+   * `currency_code` is optional. If specified, it must match the
+   * currency of the billing account. The `currency_code` is provided on
+   * output.
+   * 
+ * + * .google.type.Money specified_amount = 1; + * + * @return Whether the specifiedAmount field is set. + */ + @java.lang.Override + public boolean hasSpecifiedAmount() { + return budgetAmountCase_ == 1; + } + /** + * + * + *
+   * A specified amount to use as the budget.
+   * `currency_code` is optional. If specified, it must match the
+   * currency of the billing account. The `currency_code` is provided on
+   * output.
+   * 
+ * + * .google.type.Money specified_amount = 1; + * + * @return The specifiedAmount. + */ + @java.lang.Override + public com.google.type.Money getSpecifiedAmount() { + if (budgetAmountCase_ == 1) { + return (com.google.type.Money) budgetAmount_; + } + return com.google.type.Money.getDefaultInstance(); + } + /** + * + * + *
+   * A specified amount to use as the budget.
+   * `currency_code` is optional. If specified, it must match the
+   * currency of the billing account. The `currency_code` is provided on
+   * output.
+   * 
+ * + * .google.type.Money specified_amount = 1; + */ + @java.lang.Override + public com.google.type.MoneyOrBuilder getSpecifiedAmountOrBuilder() { + if (budgetAmountCase_ == 1) { + return (com.google.type.Money) budgetAmount_; + } + return com.google.type.Money.getDefaultInstance(); + } + + public static final int LAST_PERIOD_AMOUNT_FIELD_NUMBER = 2; + /** + * + * + *
+   * Use the last period's actual spend as the budget for the present period.
+   * 
+ * + * .google.cloud.billing.budgets.v1.LastPeriodAmount last_period_amount = 2; + * + * @return Whether the lastPeriodAmount field is set. + */ + @java.lang.Override + public boolean hasLastPeriodAmount() { + return budgetAmountCase_ == 2; + } + /** + * + * + *
+   * Use the last period's actual spend as the budget for the present period.
+   * 
+ * + * .google.cloud.billing.budgets.v1.LastPeriodAmount last_period_amount = 2; + * + * @return The lastPeriodAmount. + */ + @java.lang.Override + public com.google.cloud.billing.budgets.v1.LastPeriodAmount getLastPeriodAmount() { + if (budgetAmountCase_ == 2) { + return (com.google.cloud.billing.budgets.v1.LastPeriodAmount) budgetAmount_; + } + return com.google.cloud.billing.budgets.v1.LastPeriodAmount.getDefaultInstance(); + } + /** + * + * + *
+   * Use the last period's actual spend as the budget for the present period.
+   * 
+ * + * .google.cloud.billing.budgets.v1.LastPeriodAmount last_period_amount = 2; + */ + @java.lang.Override + public com.google.cloud.billing.budgets.v1.LastPeriodAmountOrBuilder + getLastPeriodAmountOrBuilder() { + if (budgetAmountCase_ == 2) { + return (com.google.cloud.billing.budgets.v1.LastPeriodAmount) budgetAmount_; + } + return com.google.cloud.billing.budgets.v1.LastPeriodAmount.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (budgetAmountCase_ == 1) { + output.writeMessage(1, (com.google.type.Money) budgetAmount_); + } + if (budgetAmountCase_ == 2) { + output.writeMessage(2, (com.google.cloud.billing.budgets.v1.LastPeriodAmount) budgetAmount_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (budgetAmountCase_ == 1) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 1, (com.google.type.Money) budgetAmount_); + } + if (budgetAmountCase_ == 2) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 2, (com.google.cloud.billing.budgets.v1.LastPeriodAmount) budgetAmount_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1.BudgetAmount)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1.BudgetAmount other = + (com.google.cloud.billing.budgets.v1.BudgetAmount) obj; + + if (!getBudgetAmountCase().equals(other.getBudgetAmountCase())) return false; + switch (budgetAmountCase_) { + case 1: + if (!getSpecifiedAmount().equals(other.getSpecifiedAmount())) return false; + break; + case 2: + if (!getLastPeriodAmount().equals(other.getLastPeriodAmount())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + switch (budgetAmountCase_) { + case 1: + hash = (37 * hash) + SPECIFIED_AMOUNT_FIELD_NUMBER; + hash = (53 * hash) + getSpecifiedAmount().hashCode(); + break; + case 2: + hash = (37 * hash) + LAST_PERIOD_AMOUNT_FIELD_NUMBER; + hash = (53 * hash) + getLastPeriodAmount().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1.BudgetAmount parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.BudgetAmount parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.BudgetAmount parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.BudgetAmount parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.BudgetAmount parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.BudgetAmount parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.BudgetAmount parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.BudgetAmount parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.BudgetAmount parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.BudgetAmount parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.BudgetAmount parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.BudgetAmount parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.billing.budgets.v1.BudgetAmount prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The budgeted amount for each usage period.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.BudgetAmount} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1.BudgetAmount) + com.google.cloud.billing.budgets.v1.BudgetAmountOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_BudgetAmount_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_BudgetAmount_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.BudgetAmount.class, + com.google.cloud.billing.budgets.v1.BudgetAmount.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1.BudgetAmount.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + budgetAmountCase_ = 0; + budgetAmount_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_BudgetAmount_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.BudgetAmount getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1.BudgetAmount.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.BudgetAmount build() { + com.google.cloud.billing.budgets.v1.BudgetAmount result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.BudgetAmount buildPartial() { + com.google.cloud.billing.budgets.v1.BudgetAmount result = + new com.google.cloud.billing.budgets.v1.BudgetAmount(this); + if (budgetAmountCase_ == 1) { + if (specifiedAmountBuilder_ == null) { + result.budgetAmount_ = budgetAmount_; + } else { + result.budgetAmount_ = specifiedAmountBuilder_.build(); + } + } + if (budgetAmountCase_ == 2) { + if (lastPeriodAmountBuilder_ == null) { + result.budgetAmount_ = budgetAmount_; + } else { + result.budgetAmount_ = lastPeriodAmountBuilder_.build(); + } + } + result.budgetAmountCase_ = budgetAmountCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1.BudgetAmount) { + return mergeFrom((com.google.cloud.billing.budgets.v1.BudgetAmount) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1.BudgetAmount other) { + if (other == com.google.cloud.billing.budgets.v1.BudgetAmount.getDefaultInstance()) + return this; + switch (other.getBudgetAmountCase()) { + case SPECIFIED_AMOUNT: + { + mergeSpecifiedAmount(other.getSpecifiedAmount()); + break; + } + case LAST_PERIOD_AMOUNT: + { + mergeLastPeriodAmount(other.getLastPeriodAmount()); + break; + } + case BUDGETAMOUNT_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1.BudgetAmount parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.billing.budgets.v1.BudgetAmount) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int budgetAmountCase_ = 0; + private java.lang.Object budgetAmount_; + + public BudgetAmountCase getBudgetAmountCase() { + return BudgetAmountCase.forNumber(budgetAmountCase_); + } + + public Builder clearBudgetAmount() { + budgetAmountCase_ = 0; + budgetAmount_ = null; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Money, com.google.type.Money.Builder, com.google.type.MoneyOrBuilder> + specifiedAmountBuilder_; + /** + * + * + *
+     * A specified amount to use as the budget.
+     * `currency_code` is optional. If specified, it must match the
+     * currency of the billing account. The `currency_code` is provided on
+     * output.
+     * 
+ * + * .google.type.Money specified_amount = 1; + * + * @return Whether the specifiedAmount field is set. + */ + @java.lang.Override + public boolean hasSpecifiedAmount() { + return budgetAmountCase_ == 1; + } + /** + * + * + *
+     * A specified amount to use as the budget.
+     * `currency_code` is optional. If specified, it must match the
+     * currency of the billing account. The `currency_code` is provided on
+     * output.
+     * 
+ * + * .google.type.Money specified_amount = 1; + * + * @return The specifiedAmount. + */ + @java.lang.Override + public com.google.type.Money getSpecifiedAmount() { + if (specifiedAmountBuilder_ == null) { + if (budgetAmountCase_ == 1) { + return (com.google.type.Money) budgetAmount_; + } + return com.google.type.Money.getDefaultInstance(); + } else { + if (budgetAmountCase_ == 1) { + return specifiedAmountBuilder_.getMessage(); + } + return com.google.type.Money.getDefaultInstance(); + } + } + /** + * + * + *
+     * A specified amount to use as the budget.
+     * `currency_code` is optional. If specified, it must match the
+     * currency of the billing account. The `currency_code` is provided on
+     * output.
+     * 
+ * + * .google.type.Money specified_amount = 1; + */ + public Builder setSpecifiedAmount(com.google.type.Money value) { + if (specifiedAmountBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + budgetAmount_ = value; + onChanged(); + } else { + specifiedAmountBuilder_.setMessage(value); + } + budgetAmountCase_ = 1; + return this; + } + /** + * + * + *
+     * A specified amount to use as the budget.
+     * `currency_code` is optional. If specified, it must match the
+     * currency of the billing account. The `currency_code` is provided on
+     * output.
+     * 
+ * + * .google.type.Money specified_amount = 1; + */ + public Builder setSpecifiedAmount(com.google.type.Money.Builder builderForValue) { + if (specifiedAmountBuilder_ == null) { + budgetAmount_ = builderForValue.build(); + onChanged(); + } else { + specifiedAmountBuilder_.setMessage(builderForValue.build()); + } + budgetAmountCase_ = 1; + return this; + } + /** + * + * + *
+     * A specified amount to use as the budget.
+     * `currency_code` is optional. If specified, it must match the
+     * currency of the billing account. The `currency_code` is provided on
+     * output.
+     * 
+ * + * .google.type.Money specified_amount = 1; + */ + public Builder mergeSpecifiedAmount(com.google.type.Money value) { + if (specifiedAmountBuilder_ == null) { + if (budgetAmountCase_ == 1 && budgetAmount_ != com.google.type.Money.getDefaultInstance()) { + budgetAmount_ = + com.google.type.Money.newBuilder((com.google.type.Money) budgetAmount_) + .mergeFrom(value) + .buildPartial(); + } else { + budgetAmount_ = value; + } + onChanged(); + } else { + if (budgetAmountCase_ == 1) { + specifiedAmountBuilder_.mergeFrom(value); + } + specifiedAmountBuilder_.setMessage(value); + } + budgetAmountCase_ = 1; + return this; + } + /** + * + * + *
+     * A specified amount to use as the budget.
+     * `currency_code` is optional. If specified, it must match the
+     * currency of the billing account. The `currency_code` is provided on
+     * output.
+     * 
+ * + * .google.type.Money specified_amount = 1; + */ + public Builder clearSpecifiedAmount() { + if (specifiedAmountBuilder_ == null) { + if (budgetAmountCase_ == 1) { + budgetAmountCase_ = 0; + budgetAmount_ = null; + onChanged(); + } + } else { + if (budgetAmountCase_ == 1) { + budgetAmountCase_ = 0; + budgetAmount_ = null; + } + specifiedAmountBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A specified amount to use as the budget.
+     * `currency_code` is optional. If specified, it must match the
+     * currency of the billing account. The `currency_code` is provided on
+     * output.
+     * 
+ * + * .google.type.Money specified_amount = 1; + */ + public com.google.type.Money.Builder getSpecifiedAmountBuilder() { + return getSpecifiedAmountFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * A specified amount to use as the budget.
+     * `currency_code` is optional. If specified, it must match the
+     * currency of the billing account. The `currency_code` is provided on
+     * output.
+     * 
+ * + * .google.type.Money specified_amount = 1; + */ + @java.lang.Override + public com.google.type.MoneyOrBuilder getSpecifiedAmountOrBuilder() { + if ((budgetAmountCase_ == 1) && (specifiedAmountBuilder_ != null)) { + return specifiedAmountBuilder_.getMessageOrBuilder(); + } else { + if (budgetAmountCase_ == 1) { + return (com.google.type.Money) budgetAmount_; + } + return com.google.type.Money.getDefaultInstance(); + } + } + /** + * + * + *
+     * A specified amount to use as the budget.
+     * `currency_code` is optional. If specified, it must match the
+     * currency of the billing account. The `currency_code` is provided on
+     * output.
+     * 
+ * + * .google.type.Money specified_amount = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Money, com.google.type.Money.Builder, com.google.type.MoneyOrBuilder> + getSpecifiedAmountFieldBuilder() { + if (specifiedAmountBuilder_ == null) { + if (!(budgetAmountCase_ == 1)) { + budgetAmount_ = com.google.type.Money.getDefaultInstance(); + } + specifiedAmountBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Money, + com.google.type.Money.Builder, + com.google.type.MoneyOrBuilder>( + (com.google.type.Money) budgetAmount_, getParentForChildren(), isClean()); + budgetAmount_ = null; + } + budgetAmountCase_ = 1; + onChanged(); + ; + return specifiedAmountBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1.LastPeriodAmount, + com.google.cloud.billing.budgets.v1.LastPeriodAmount.Builder, + com.google.cloud.billing.budgets.v1.LastPeriodAmountOrBuilder> + lastPeriodAmountBuilder_; + /** + * + * + *
+     * Use the last period's actual spend as the budget for the present period.
+     * 
+ * + * .google.cloud.billing.budgets.v1.LastPeriodAmount last_period_amount = 2; + * + * @return Whether the lastPeriodAmount field is set. + */ + @java.lang.Override + public boolean hasLastPeriodAmount() { + return budgetAmountCase_ == 2; + } + /** + * + * + *
+     * Use the last period's actual spend as the budget for the present period.
+     * 
+ * + * .google.cloud.billing.budgets.v1.LastPeriodAmount last_period_amount = 2; + * + * @return The lastPeriodAmount. + */ + @java.lang.Override + public com.google.cloud.billing.budgets.v1.LastPeriodAmount getLastPeriodAmount() { + if (lastPeriodAmountBuilder_ == null) { + if (budgetAmountCase_ == 2) { + return (com.google.cloud.billing.budgets.v1.LastPeriodAmount) budgetAmount_; + } + return com.google.cloud.billing.budgets.v1.LastPeriodAmount.getDefaultInstance(); + } else { + if (budgetAmountCase_ == 2) { + return lastPeriodAmountBuilder_.getMessage(); + } + return com.google.cloud.billing.budgets.v1.LastPeriodAmount.getDefaultInstance(); + } + } + /** + * + * + *
+     * Use the last period's actual spend as the budget for the present period.
+     * 
+ * + * .google.cloud.billing.budgets.v1.LastPeriodAmount last_period_amount = 2; + */ + public Builder setLastPeriodAmount(com.google.cloud.billing.budgets.v1.LastPeriodAmount value) { + if (lastPeriodAmountBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + budgetAmount_ = value; + onChanged(); + } else { + lastPeriodAmountBuilder_.setMessage(value); + } + budgetAmountCase_ = 2; + return this; + } + /** + * + * + *
+     * Use the last period's actual spend as the budget for the present period.
+     * 
+ * + * .google.cloud.billing.budgets.v1.LastPeriodAmount last_period_amount = 2; + */ + public Builder setLastPeriodAmount( + com.google.cloud.billing.budgets.v1.LastPeriodAmount.Builder builderForValue) { + if (lastPeriodAmountBuilder_ == null) { + budgetAmount_ = builderForValue.build(); + onChanged(); + } else { + lastPeriodAmountBuilder_.setMessage(builderForValue.build()); + } + budgetAmountCase_ = 2; + return this; + } + /** + * + * + *
+     * Use the last period's actual spend as the budget for the present period.
+     * 
+ * + * .google.cloud.billing.budgets.v1.LastPeriodAmount last_period_amount = 2; + */ + public Builder mergeLastPeriodAmount( + com.google.cloud.billing.budgets.v1.LastPeriodAmount value) { + if (lastPeriodAmountBuilder_ == null) { + if (budgetAmountCase_ == 2 + && budgetAmount_ + != com.google.cloud.billing.budgets.v1.LastPeriodAmount.getDefaultInstance()) { + budgetAmount_ = + com.google.cloud.billing.budgets.v1.LastPeriodAmount.newBuilder( + (com.google.cloud.billing.budgets.v1.LastPeriodAmount) budgetAmount_) + .mergeFrom(value) + .buildPartial(); + } else { + budgetAmount_ = value; + } + onChanged(); + } else { + if (budgetAmountCase_ == 2) { + lastPeriodAmountBuilder_.mergeFrom(value); + } + lastPeriodAmountBuilder_.setMessage(value); + } + budgetAmountCase_ = 2; + return this; + } + /** + * + * + *
+     * Use the last period's actual spend as the budget for the present period.
+     * 
+ * + * .google.cloud.billing.budgets.v1.LastPeriodAmount last_period_amount = 2; + */ + public Builder clearLastPeriodAmount() { + if (lastPeriodAmountBuilder_ == null) { + if (budgetAmountCase_ == 2) { + budgetAmountCase_ = 0; + budgetAmount_ = null; + onChanged(); + } + } else { + if (budgetAmountCase_ == 2) { + budgetAmountCase_ = 0; + budgetAmount_ = null; + } + lastPeriodAmountBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Use the last period's actual spend as the budget for the present period.
+     * 
+ * + * .google.cloud.billing.budgets.v1.LastPeriodAmount last_period_amount = 2; + */ + public com.google.cloud.billing.budgets.v1.LastPeriodAmount.Builder + getLastPeriodAmountBuilder() { + return getLastPeriodAmountFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Use the last period's actual spend as the budget for the present period.
+     * 
+ * + * .google.cloud.billing.budgets.v1.LastPeriodAmount last_period_amount = 2; + */ + @java.lang.Override + public com.google.cloud.billing.budgets.v1.LastPeriodAmountOrBuilder + getLastPeriodAmountOrBuilder() { + if ((budgetAmountCase_ == 2) && (lastPeriodAmountBuilder_ != null)) { + return lastPeriodAmountBuilder_.getMessageOrBuilder(); + } else { + if (budgetAmountCase_ == 2) { + return (com.google.cloud.billing.budgets.v1.LastPeriodAmount) budgetAmount_; + } + return com.google.cloud.billing.budgets.v1.LastPeriodAmount.getDefaultInstance(); + } + } + /** + * + * + *
+     * Use the last period's actual spend as the budget for the present period.
+     * 
+ * + * .google.cloud.billing.budgets.v1.LastPeriodAmount last_period_amount = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1.LastPeriodAmount, + com.google.cloud.billing.budgets.v1.LastPeriodAmount.Builder, + com.google.cloud.billing.budgets.v1.LastPeriodAmountOrBuilder> + getLastPeriodAmountFieldBuilder() { + if (lastPeriodAmountBuilder_ == null) { + if (!(budgetAmountCase_ == 2)) { + budgetAmount_ = com.google.cloud.billing.budgets.v1.LastPeriodAmount.getDefaultInstance(); + } + lastPeriodAmountBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1.LastPeriodAmount, + com.google.cloud.billing.budgets.v1.LastPeriodAmount.Builder, + com.google.cloud.billing.budgets.v1.LastPeriodAmountOrBuilder>( + (com.google.cloud.billing.budgets.v1.LastPeriodAmount) budgetAmount_, + getParentForChildren(), + isClean()); + budgetAmount_ = null; + } + budgetAmountCase_ = 2; + onChanged(); + ; + return lastPeriodAmountBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1.BudgetAmount) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1.BudgetAmount) + private static final com.google.cloud.billing.budgets.v1.BudgetAmount DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1.BudgetAmount(); + } + + public static com.google.cloud.billing.budgets.v1.BudgetAmount getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BudgetAmount parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BudgetAmount(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.BudgetAmount getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetAmountOrBuilder.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetAmountOrBuilder.java new file mode 100644 index 00000000..270569cc --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetAmountOrBuilder.java @@ -0,0 +1,106 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_model.proto + +package com.google.cloud.billing.budgets.v1; + +public interface BudgetAmountOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1.BudgetAmount) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A specified amount to use as the budget.
+   * `currency_code` is optional. If specified, it must match the
+   * currency of the billing account. The `currency_code` is provided on
+   * output.
+   * 
+ * + * .google.type.Money specified_amount = 1; + * + * @return Whether the specifiedAmount field is set. + */ + boolean hasSpecifiedAmount(); + /** + * + * + *
+   * A specified amount to use as the budget.
+   * `currency_code` is optional. If specified, it must match the
+   * currency of the billing account. The `currency_code` is provided on
+   * output.
+   * 
+ * + * .google.type.Money specified_amount = 1; + * + * @return The specifiedAmount. + */ + com.google.type.Money getSpecifiedAmount(); + /** + * + * + *
+   * A specified amount to use as the budget.
+   * `currency_code` is optional. If specified, it must match the
+   * currency of the billing account. The `currency_code` is provided on
+   * output.
+   * 
+ * + * .google.type.Money specified_amount = 1; + */ + com.google.type.MoneyOrBuilder getSpecifiedAmountOrBuilder(); + + /** + * + * + *
+   * Use the last period's actual spend as the budget for the present period.
+   * 
+ * + * .google.cloud.billing.budgets.v1.LastPeriodAmount last_period_amount = 2; + * + * @return Whether the lastPeriodAmount field is set. + */ + boolean hasLastPeriodAmount(); + /** + * + * + *
+   * Use the last period's actual spend as the budget for the present period.
+   * 
+ * + * .google.cloud.billing.budgets.v1.LastPeriodAmount last_period_amount = 2; + * + * @return The lastPeriodAmount. + */ + com.google.cloud.billing.budgets.v1.LastPeriodAmount getLastPeriodAmount(); + /** + * + * + *
+   * Use the last period's actual spend as the budget for the present period.
+   * 
+ * + * .google.cloud.billing.budgets.v1.LastPeriodAmount last_period_amount = 2; + */ + com.google.cloud.billing.budgets.v1.LastPeriodAmountOrBuilder getLastPeriodAmountOrBuilder(); + + public com.google.cloud.billing.budgets.v1.BudgetAmount.BudgetAmountCase getBudgetAmountCase(); +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetModelProto.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetModelProto.java new file mode 100644 index 00000000..056668d6 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetModelProto.java @@ -0,0 +1,205 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_model.proto + +package com.google.cloud.billing.budgets.v1; + +public final class BudgetModelProto { + private BudgetModelProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1_Budget_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1_Budget_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1_BudgetAmount_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1_BudgetAmount_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1_LastPeriodAmount_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1_LastPeriodAmount_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1_ThresholdRule_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1_ThresholdRule_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1_NotificationsRule_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1_NotificationsRule_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1_Filter_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1_Filter_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1_Filter_LabelsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1_Filter_LabelsEntry_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n2google/cloud/billing/budgets/v1/budget" + + "_model.proto\022\037google.cloud.billing.budge" + + "ts.v1\032\037google/api/field_behavior.proto\032\031" + + "google/api/resource.proto\032\034google/protob" + + "uf/struct.proto\032\027google/type/money.proto" + + "\"\317\003\n\006Budget\022\021\n\004name\030\001 \001(\tB\003\340A\003\022\024\n\014displa" + + "y_name\030\002 \001(\t\022C\n\rbudget_filter\030\003 \001(\0132\'.go" + + "ogle.cloud.billing.budgets.v1.FilterB\003\340A" + + "\001\022B\n\006amount\030\004 \001(\0132-.google.cloud.billing" + + ".budgets.v1.BudgetAmountB\003\340A\002\022L\n\017thresho" + + "ld_rules\030\005 \003(\0132..google.cloud.billing.bu" + + "dgets.v1.ThresholdRuleB\003\340A\001\022S\n\022notificat" + + "ions_rule\030\006 \001(\01322.google.cloud.billing.b" + + "udgets.v1.NotificationsRuleB\003\340A\001\022\021\n\004etag" + + "\030\007 \001(\tB\003\340A\001:]\352AZ\n$billingbudgets.googlea" + + "pis.com/Budget\0222billingAccounts/{billing" + + "_account}/budgets/{budget}\"\240\001\n\014BudgetAmo" + + "unt\022.\n\020specified_amount\030\001 \001(\0132\022.google.t" + + "ype.MoneyH\000\022O\n\022last_period_amount\030\002 \001(\0132" + + "1.google.cloud.billing.budgets.v1.LastPe" + + "riodAmountH\000B\017\n\rbudget_amount\"\022\n\020LastPer" + + "iodAmount\"\310\001\n\rThresholdRule\022\036\n\021threshold" + + "_percent\030\001 \001(\001B\003\340A\002\022N\n\013spend_basis\030\002 \001(\016" + + "24.google.cloud.billing.budgets.v1.Thres" + + "holdRule.BasisB\003\340A\001\"G\n\005Basis\022\025\n\021BASIS_UN" + + "SPECIFIED\020\000\022\021\n\rCURRENT_SPEND\020\001\022\024\n\020FORECA" + + "STED_SPEND\020\002\"\247\001\n\021NotificationsRule\022\031\n\014pu" + + "bsub_topic\030\001 \001(\tB\003\340A\001\022\033\n\016schema_version\030" + + "\002 \001(\tB\003\340A\001\022-\n monitoring_notification_ch" + + "annels\030\003 \003(\tB\003\340A\001\022+\n\036disable_default_iam" + + "_recipients\030\004 \001(\010B\003\340A\001\"\365\003\n\006Filter\022\025\n\010pro" + + "jects\030\001 \003(\tB\003\340A\001\022\031\n\014credit_types\030\007 \003(\tB\003" + + "\340A\001\022a\n\026credit_types_treatment\030\004 \001(\0162<.go" + + "ogle.cloud.billing.budgets.v1.Filter.Cre" + + "ditTypesTreatmentB\003\340A\001\022\025\n\010services\030\003 \003(\t" + + "B\003\340A\001\022\030\n\013subaccounts\030\005 \003(\tB\003\340A\001\022H\n\006label" + + "s\030\006 \003(\01323.google.cloud.billing.budgets.v" + + "1.Filter.LabelsEntryB\003\340A\001\032I\n\013LabelsEntry" + + "\022\013\n\003key\030\001 \001(\t\022)\n\005value\030\002 \001(\0132\032.google.pr" + + "otobuf.ListValue:\0028\001\"\217\001\n\024CreditTypesTrea" + + "tment\022&\n\"CREDIT_TYPES_TREATMENT_UNSPECIF" + + "IED\020\000\022\027\n\023INCLUDE_ALL_CREDITS\020\001\022\027\n\023EXCLUD" + + "E_ALL_CREDITS\020\002\022\035\n\031INCLUDE_SPECIFIED_CRE" + + "DITS\020\003B\201\001\n#com.google.cloud.billing.budg" + + "ets.v1B\020BudgetModelProtoP\001ZFgoogle.golan" + + "g.org/genproto/googleapis/cloud/billing/" + + "budgets/v1;budgetsb\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.api.ResourceProto.getDescriptor(), + com.google.protobuf.StructProto.getDescriptor(), + com.google.type.MoneyProto.getDescriptor(), + }); + internal_static_google_cloud_billing_budgets_v1_Budget_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_billing_budgets_v1_Budget_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1_Budget_descriptor, + new java.lang.String[] { + "Name", + "DisplayName", + "BudgetFilter", + "Amount", + "ThresholdRules", + "NotificationsRule", + "Etag", + }); + internal_static_google_cloud_billing_budgets_v1_BudgetAmount_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_cloud_billing_budgets_v1_BudgetAmount_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1_BudgetAmount_descriptor, + new java.lang.String[] { + "SpecifiedAmount", "LastPeriodAmount", "BudgetAmount", + }); + internal_static_google_cloud_billing_budgets_v1_LastPeriodAmount_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_cloud_billing_budgets_v1_LastPeriodAmount_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1_LastPeriodAmount_descriptor, + new java.lang.String[] {}); + internal_static_google_cloud_billing_budgets_v1_ThresholdRule_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_billing_budgets_v1_ThresholdRule_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1_ThresholdRule_descriptor, + new java.lang.String[] { + "ThresholdPercent", "SpendBasis", + }); + internal_static_google_cloud_billing_budgets_v1_NotificationsRule_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_billing_budgets_v1_NotificationsRule_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1_NotificationsRule_descriptor, + new java.lang.String[] { + "PubsubTopic", + "SchemaVersion", + "MonitoringNotificationChannels", + "DisableDefaultIamRecipients", + }); + internal_static_google_cloud_billing_budgets_v1_Filter_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_cloud_billing_budgets_v1_Filter_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1_Filter_descriptor, + new java.lang.String[] { + "Projects", + "CreditTypes", + "CreditTypesTreatment", + "Services", + "Subaccounts", + "Labels", + }); + internal_static_google_cloud_billing_budgets_v1_Filter_LabelsEntry_descriptor = + internal_static_google_cloud_billing_budgets_v1_Filter_descriptor.getNestedTypes().get(0); + internal_static_google_cloud_billing_budgets_v1_Filter_LabelsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1_Filter_LabelsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + registry.add(com.google.api.ResourceProto.resource); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.api.ResourceProto.getDescriptor(); + com.google.protobuf.StructProto.getDescriptor(); + com.google.type.MoneyProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetName.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetName.java new file mode 100644 index 00000000..e7b6d62e --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetName.java @@ -0,0 +1,182 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.billing.budgets.v1; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** AUTO-GENERATED DOCUMENTATION AND CLASS */ +@javax.annotation.Generated("by GAPIC protoc plugin") +public class BudgetName implements ResourceName { + + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("billingAccounts/{billing_account}/budgets/{budget}"); + + private volatile Map fieldValuesMap; + + private final String billingAccount; + private final String budget; + + public String getBillingAccount() { + return billingAccount; + } + + public String getBudget() { + return budget; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private BudgetName(Builder builder) { + billingAccount = Preconditions.checkNotNull(builder.getBillingAccount()); + budget = Preconditions.checkNotNull(builder.getBudget()); + } + + public static BudgetName of(String billingAccount, String budget) { + return newBuilder().setBillingAccount(billingAccount).setBudget(budget).build(); + } + + public static String format(String billingAccount, String budget) { + return newBuilder().setBillingAccount(billingAccount).setBudget(budget).build().toString(); + } + + public static BudgetName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "BudgetName.parse: formattedString not in valid format"); + return of(matchMap.get("billing_account"), matchMap.get("budget")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList(values.size()); + for (BudgetName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("billingAccount", billingAccount); + fieldMapBuilder.put("budget", budget); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate("billing_account", billingAccount, "budget", budget); + } + + /** Builder for BudgetName. */ + public static class Builder { + + private String billingAccount; + private String budget; + + public String getBillingAccount() { + return billingAccount; + } + + public String getBudget() { + return budget; + } + + public Builder setBillingAccount(String billingAccount) { + this.billingAccount = billingAccount; + return this; + } + + public Builder setBudget(String budget) { + this.budget = budget; + return this; + } + + private Builder() {} + + private Builder(BudgetName budgetName) { + billingAccount = budgetName.billingAccount; + budget = budgetName.budget; + } + + public BudgetName build() { + return new BudgetName(this); + } + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof BudgetName) { + BudgetName that = (BudgetName) o; + return (this.billingAccount.equals(that.billingAccount)) && (this.budget.equals(that.budget)); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= billingAccount.hashCode(); + h *= 1000003; + h ^= budget.hashCode(); + return h; + } +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetOrBuilder.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetOrBuilder.java new file mode 100644 index 00000000..7d30fad5 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetOrBuilder.java @@ -0,0 +1,306 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_model.proto + +package com.google.cloud.billing.budgets.v1; + +public interface BudgetOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1.Budget) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Output only. Resource name of the budget.
+   * The resource name implies the scope of a budget. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Output only. Resource name of the budget.
+   * The resource name implies the scope of a budget. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * User data for display name in UI. The name must be less than or equal to 60
+   * characters.
+   * 
+ * + * string display_name = 2; + * + * @return The displayName. + */ + java.lang.String getDisplayName(); + /** + * + * + *
+   * User data for display name in UI. The name must be less than or equal to 60
+   * characters.
+   * 
+ * + * string display_name = 2; + * + * @return The bytes for displayName. + */ + com.google.protobuf.ByteString getDisplayNameBytes(); + + /** + * + * + *
+   * Optional. Filters that define which resources are used to compute
+   * the actual spend against the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the budgetFilter field is set. + */ + boolean hasBudgetFilter(); + /** + * + * + *
+   * Optional. Filters that define which resources are used to compute
+   * the actual spend against the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The budgetFilter. + */ + com.google.cloud.billing.budgets.v1.Filter getBudgetFilter(); + /** + * + * + *
+   * Optional. Filters that define which resources are used to compute
+   * the actual spend against the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.cloud.billing.budgets.v1.FilterOrBuilder getBudgetFilterOrBuilder(); + + /** + * + * + *
+   * Required. Budgeted amount.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the amount field is set. + */ + boolean hasAmount(); + /** + * + * + *
+   * Required. Budgeted amount.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The amount. + */ + com.google.cloud.billing.budgets.v1.BudgetAmount getAmount(); + /** + * + * + *
+   * Required. Budgeted amount.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.billing.budgets.v1.BudgetAmountOrBuilder getAmountOrBuilder(); + + /** + * + * + *
+   * Optional. Rules that trigger alerts (notifications of thresholds
+   * being crossed) when spend exceeds the specified percentages of the budget.
+   * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + java.util.List getThresholdRulesList(); + /** + * + * + *
+   * Optional. Rules that trigger alerts (notifications of thresholds
+   * being crossed) when spend exceeds the specified percentages of the budget.
+   * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.cloud.billing.budgets.v1.ThresholdRule getThresholdRules(int index); + /** + * + * + *
+   * Optional. Rules that trigger alerts (notifications of thresholds
+   * being crossed) when spend exceeds the specified percentages of the budget.
+   * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + int getThresholdRulesCount(); + /** + * + * + *
+   * Optional. Rules that trigger alerts (notifications of thresholds
+   * being crossed) when spend exceeds the specified percentages of the budget.
+   * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + java.util.List + getThresholdRulesOrBuilderList(); + /** + * + * + *
+   * Optional. Rules that trigger alerts (notifications of thresholds
+   * being crossed) when spend exceeds the specified percentages of the budget.
+   * 
+ * + * + * repeated .google.cloud.billing.budgets.v1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.cloud.billing.budgets.v1.ThresholdRuleOrBuilder getThresholdRulesOrBuilder(int index); + + /** + * + * + *
+   * Optional. Rules to apply to notifications sent based on budget spend and
+   * thresholds.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.NotificationsRule notifications_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the notificationsRule field is set. + */ + boolean hasNotificationsRule(); + /** + * + * + *
+   * Optional. Rules to apply to notifications sent based on budget spend and
+   * thresholds.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.NotificationsRule notifications_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The notificationsRule. + */ + com.google.cloud.billing.budgets.v1.NotificationsRule getNotificationsRule(); + /** + * + * + *
+   * Optional. Rules to apply to notifications sent based on budget spend and
+   * thresholds.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.NotificationsRule notifications_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.cloud.billing.budgets.v1.NotificationsRuleOrBuilder getNotificationsRuleOrBuilder(); + + /** + * + * + *
+   * Optional. Etag to validate that the object is unchanged for a
+   * read-modify-write operation.
+   * An empty etag will cause an update to overwrite other changes.
+   * 
+ * + * string etag = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * Optional. Etag to validate that the object is unchanged for a
+   * read-modify-write operation.
+   * An empty etag will cause an update to overwrite other changes.
+   * 
+ * + * string etag = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetServiceProto.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetServiceProto.java new file mode 100644 index 00000000..0b65f9b2 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetServiceProto.java @@ -0,0 +1,199 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_service.proto + +package com.google.cloud.billing.budgets.v1; + +public final class BudgetServiceProto { + private BudgetServiceProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1_CreateBudgetRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1_CreateBudgetRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1_UpdateBudgetRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1_UpdateBudgetRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1_GetBudgetRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1_GetBudgetRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1_ListBudgetsRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1_ListBudgetsRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1_ListBudgetsResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1_ListBudgetsResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1_DeleteBudgetRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1_DeleteBudgetRequest_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n4google/cloud/billing/budgets/v1/budget" + + "_service.proto\022\037google.cloud.billing.bud" + + "gets.v1\032\034google/api/annotations.proto\032\027g" + + "oogle/api/client.proto\032\037google/api/field" + + "_behavior.proto\032\031google/api/resource.pro" + + "to\0322google/cloud/billing/budgets/v1/budg" + + "et_model.proto\032\033google/protobuf/empty.pr" + + "oto\032 google/protobuf/field_mask.proto\"\221\001" + + "\n\023CreateBudgetRequest\022<\n\006parent\030\001 \001(\tB,\340" + + "A\002\372A&\022$billingbudgets.googleapis.com/Bud" + + "get\022<\n\006budget\030\002 \001(\0132\'.google.cloud.billi" + + "ng.budgets.v1.BudgetB\003\340A\002\"\211\001\n\023UpdateBudg" + + "etRequest\022<\n\006budget\030\001 \001(\0132\'.google.cloud" + + ".billing.budgets.v1.BudgetB\003\340A\002\0224\n\013updat" + + "e_mask\030\002 \001(\0132\032.google.protobuf.FieldMask" + + "B\003\340A\001\"N\n\020GetBudgetRequest\022:\n\004name\030\001 \001(\tB" + + ",\340A\002\372A&\n$billingbudgets.googleapis.com/B" + + "udget\"\203\001\n\022ListBudgetsRequest\022<\n\006parent\030\001" + + " \001(\tB,\340A\002\372A&\022$billingbudgets.googleapis." + + "com/Budget\022\026\n\tpage_size\030\002 \001(\005B\003\340A\001\022\027\n\npa" + + "ge_token\030\003 \001(\tB\003\340A\001\"h\n\023ListBudgetsRespon" + + "se\0228\n\007budgets\030\001 \003(\0132\'.google.cloud.billi" + + "ng.budgets.v1.Budget\022\027\n\017next_page_token\030" + + "\002 \001(\t\"Q\n\023DeleteBudgetRequest\022:\n\004name\030\001 \001" + + "(\tB,\340A\002\372A&\n$billingbudgets.googleapis.co" + + "m/Budget2\367\007\n\rBudgetService\022\265\001\n\014CreateBud" + + "get\0224.google.cloud.billing.budgets.v1.Cr" + + "eateBudgetRequest\032\'.google.cloud.billing" + + ".budgets.v1.Budget\"F\202\323\344\223\0020\"&/v1/{parent=" + + "billingAccounts/*}/budgets:\006budget\332A\rpar" + + "ent,budget\022\301\001\n\014UpdateBudget\0224.google.clo" + + "ud.billing.budgets.v1.UpdateBudgetReques" + + "t\032\'.google.cloud.billing.budgets.v1.Budg" + + "et\"R\202\323\344\223\00272-/v1/{budget.name=billingAcco" + + "unts/*/budgets/*}:\006budget\332A\022budget,updat" + + "e_mask\022\236\001\n\tGetBudget\0221.google.cloud.bill" + + "ing.budgets.v1.GetBudgetRequest\032\'.google" + + ".cloud.billing.budgets.v1.Budget\"5\202\323\344\223\002(" + + "\022&/v1/{name=billingAccounts/*/budgets/*}" + + "\332A\004name\022\261\001\n\013ListBudgets\0223.google.cloud.b" + + "illing.budgets.v1.ListBudgetsRequest\0324.g" + + "oogle.cloud.billing.budgets.v1.ListBudge" + + "tsResponse\"7\202\323\344\223\002(\022&/v1/{parent=billingA" + + "ccounts/*}/budgets\332A\006parent\022\223\001\n\014DeleteBu" + + "dget\0224.google.cloud.billing.budgets.v1.D" + + "eleteBudgetRequest\032\026.google.protobuf.Emp" + + "ty\"5\202\323\344\223\002(*&/v1/{name=billingAccounts/*/" + + "budgets/*}\332A\004name\032\177\312A\035billingbudgets.goo" + + "gleapis.com\322A\\https://www.googleapis.com" + + "/auth/cloud-billing,https://www.googleap" + + "is.com/auth/cloud-platformB\203\001\n#com.googl" + + "e.cloud.billing.budgets.v1B\022BudgetServic" + + "eProtoP\001ZFgoogle.golang.org/genproto/goo" + + "gleapis/cloud/billing/budgets/v1;budgets" + + "b\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), + com.google.api.ClientProto.getDescriptor(), + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.api.ResourceProto.getDescriptor(), + com.google.cloud.billing.budgets.v1.BudgetModelProto.getDescriptor(), + com.google.protobuf.EmptyProto.getDescriptor(), + com.google.protobuf.FieldMaskProto.getDescriptor(), + }); + internal_static_google_cloud_billing_budgets_v1_CreateBudgetRequest_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_billing_budgets_v1_CreateBudgetRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1_CreateBudgetRequest_descriptor, + new java.lang.String[] { + "Parent", "Budget", + }); + internal_static_google_cloud_billing_budgets_v1_UpdateBudgetRequest_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_cloud_billing_budgets_v1_UpdateBudgetRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1_UpdateBudgetRequest_descriptor, + new java.lang.String[] { + "Budget", "UpdateMask", + }); + internal_static_google_cloud_billing_budgets_v1_GetBudgetRequest_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_cloud_billing_budgets_v1_GetBudgetRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1_GetBudgetRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_cloud_billing_budgets_v1_ListBudgetsRequest_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_billing_budgets_v1_ListBudgetsRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1_ListBudgetsRequest_descriptor, + new java.lang.String[] { + "Parent", "PageSize", "PageToken", + }); + internal_static_google_cloud_billing_budgets_v1_ListBudgetsResponse_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_billing_budgets_v1_ListBudgetsResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1_ListBudgetsResponse_descriptor, + new java.lang.String[] { + "Budgets", "NextPageToken", + }); + internal_static_google_cloud_billing_budgets_v1_DeleteBudgetRequest_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_cloud_billing_budgets_v1_DeleteBudgetRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1_DeleteBudgetRequest_descriptor, + new java.lang.String[] { + "Name", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.ClientProto.defaultHost); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + registry.add(com.google.api.AnnotationsProto.http); + registry.add(com.google.api.ClientProto.methodSignature); + registry.add(com.google.api.ClientProto.oauthScopes); + registry.add(com.google.api.ResourceProto.resourceReference); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.AnnotationsProto.getDescriptor(); + com.google.api.ClientProto.getDescriptor(); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.api.ResourceProto.getDescriptor(); + com.google.cloud.billing.budgets.v1.BudgetModelProto.getDescriptor(); + com.google.protobuf.EmptyProto.getDescriptor(); + com.google.protobuf.FieldMaskProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/CreateBudgetRequest.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/CreateBudgetRequest.java new file mode 100644 index 00000000..15f7b293 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/CreateBudgetRequest.java @@ -0,0 +1,959 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_service.proto + +package com.google.cloud.billing.budgets.v1; + +/** + * + * + *
+ * Request for CreateBudget
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.CreateBudgetRequest} + */ +public final class CreateBudgetRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1.CreateBudgetRequest) + CreateBudgetRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreateBudgetRequest.newBuilder() to construct. + private CreateBudgetRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreateBudgetRequest() { + parent_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CreateBudgetRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CreateBudgetRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 18: + { + com.google.cloud.billing.budgets.v1.Budget.Builder subBuilder = null; + if (budget_ != null) { + subBuilder = budget_.toBuilder(); + } + budget_ = + input.readMessage( + com.google.cloud.billing.budgets.v1.Budget.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(budget_); + budget_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_CreateBudgetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_CreateBudgetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.CreateBudgetRequest.class, + com.google.cloud.billing.budgets.v1.CreateBudgetRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The name of the billing account to create the budget in. Values
+   * are of the form `billingAccounts/{billingAccountId}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the billing account to create the budget in. Values
+   * are of the form `billingAccounts/{billingAccountId}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int BUDGET_FIELD_NUMBER = 2; + private com.google.cloud.billing.budgets.v1.Budget budget_; + /** + * + * + *
+   * Required. Budget to create.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the budget field is set. + */ + @java.lang.Override + public boolean hasBudget() { + return budget_ != null; + } + /** + * + * + *
+   * Required. Budget to create.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The budget. + */ + @java.lang.Override + public com.google.cloud.billing.budgets.v1.Budget getBudget() { + return budget_ == null + ? com.google.cloud.billing.budgets.v1.Budget.getDefaultInstance() + : budget_; + } + /** + * + * + *
+   * Required. Budget to create.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.billing.budgets.v1.BudgetOrBuilder getBudgetOrBuilder() { + return getBudget(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (budget_ != null) { + output.writeMessage(2, getBudget()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (budget_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getBudget()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1.CreateBudgetRequest)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1.CreateBudgetRequest other = + (com.google.cloud.billing.budgets.v1.CreateBudgetRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (hasBudget() != other.hasBudget()) return false; + if (hasBudget()) { + if (!getBudget().equals(other.getBudget())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + if (hasBudget()) { + hash = (37 * hash) + BUDGET_FIELD_NUMBER; + hash = (53 * hash) + getBudget().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1.CreateBudgetRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.CreateBudgetRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.CreateBudgetRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.CreateBudgetRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.CreateBudgetRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.CreateBudgetRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.CreateBudgetRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.CreateBudgetRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.CreateBudgetRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.CreateBudgetRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.CreateBudgetRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.CreateBudgetRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.billing.budgets.v1.CreateBudgetRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for CreateBudget
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.CreateBudgetRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1.CreateBudgetRequest) + com.google.cloud.billing.budgets.v1.CreateBudgetRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_CreateBudgetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_CreateBudgetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.CreateBudgetRequest.class, + com.google.cloud.billing.budgets.v1.CreateBudgetRequest.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1.CreateBudgetRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + if (budgetBuilder_ == null) { + budget_ = null; + } else { + budget_ = null; + budgetBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_CreateBudgetRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.CreateBudgetRequest getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1.CreateBudgetRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.CreateBudgetRequest build() { + com.google.cloud.billing.budgets.v1.CreateBudgetRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.CreateBudgetRequest buildPartial() { + com.google.cloud.billing.budgets.v1.CreateBudgetRequest result = + new com.google.cloud.billing.budgets.v1.CreateBudgetRequest(this); + result.parent_ = parent_; + if (budgetBuilder_ == null) { + result.budget_ = budget_; + } else { + result.budget_ = budgetBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1.CreateBudgetRequest) { + return mergeFrom((com.google.cloud.billing.budgets.v1.CreateBudgetRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1.CreateBudgetRequest other) { + if (other == com.google.cloud.billing.budgets.v1.CreateBudgetRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.hasBudget()) { + mergeBudget(other.getBudget()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1.CreateBudgetRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.budgets.v1.CreateBudgetRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The name of the billing account to create the budget in. Values
+     * are of the form `billingAccounts/{billingAccountId}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the billing account to create the budget in. Values
+     * are of the form `billingAccounts/{billingAccountId}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the billing account to create the budget in. Values
+     * are of the form `billingAccounts/{billingAccountId}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the billing account to create the budget in. Values
+     * are of the form `billingAccounts/{billingAccountId}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the billing account to create the budget in. Values
+     * are of the form `billingAccounts/{billingAccountId}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private com.google.cloud.billing.budgets.v1.Budget budget_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1.Budget, + com.google.cloud.billing.budgets.v1.Budget.Builder, + com.google.cloud.billing.budgets.v1.BudgetOrBuilder> + budgetBuilder_; + /** + * + * + *
+     * Required. Budget to create.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the budget field is set. + */ + public boolean hasBudget() { + return budgetBuilder_ != null || budget_ != null; + } + /** + * + * + *
+     * Required. Budget to create.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The budget. + */ + public com.google.cloud.billing.budgets.v1.Budget getBudget() { + if (budgetBuilder_ == null) { + return budget_ == null + ? com.google.cloud.billing.budgets.v1.Budget.getDefaultInstance() + : budget_; + } else { + return budgetBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. Budget to create.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setBudget(com.google.cloud.billing.budgets.v1.Budget value) { + if (budgetBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + budget_ = value; + onChanged(); + } else { + budgetBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. Budget to create.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setBudget(com.google.cloud.billing.budgets.v1.Budget.Builder builderForValue) { + if (budgetBuilder_ == null) { + budget_ = builderForValue.build(); + onChanged(); + } else { + budgetBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. Budget to create.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeBudget(com.google.cloud.billing.budgets.v1.Budget value) { + if (budgetBuilder_ == null) { + if (budget_ != null) { + budget_ = + com.google.cloud.billing.budgets.v1.Budget.newBuilder(budget_) + .mergeFrom(value) + .buildPartial(); + } else { + budget_ = value; + } + onChanged(); + } else { + budgetBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. Budget to create.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearBudget() { + if (budgetBuilder_ == null) { + budget_ = null; + onChanged(); + } else { + budget_ = null; + budgetBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. Budget to create.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1.Budget.Builder getBudgetBuilder() { + + onChanged(); + return getBudgetFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. Budget to create.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1.BudgetOrBuilder getBudgetOrBuilder() { + if (budgetBuilder_ != null) { + return budgetBuilder_.getMessageOrBuilder(); + } else { + return budget_ == null + ? com.google.cloud.billing.budgets.v1.Budget.getDefaultInstance() + : budget_; + } + } + /** + * + * + *
+     * Required. Budget to create.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1.Budget, + com.google.cloud.billing.budgets.v1.Budget.Builder, + com.google.cloud.billing.budgets.v1.BudgetOrBuilder> + getBudgetFieldBuilder() { + if (budgetBuilder_ == null) { + budgetBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1.Budget, + com.google.cloud.billing.budgets.v1.Budget.Builder, + com.google.cloud.billing.budgets.v1.BudgetOrBuilder>( + getBudget(), getParentForChildren(), isClean()); + budget_ = null; + } + return budgetBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1.CreateBudgetRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1.CreateBudgetRequest) + private static final com.google.cloud.billing.budgets.v1.CreateBudgetRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1.CreateBudgetRequest(); + } + + public static com.google.cloud.billing.budgets.v1.CreateBudgetRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateBudgetRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CreateBudgetRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.CreateBudgetRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/CreateBudgetRequestOrBuilder.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/CreateBudgetRequestOrBuilder.java new file mode 100644 index 00000000..b1c8aaa5 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/CreateBudgetRequestOrBuilder.java @@ -0,0 +1,97 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_service.proto + +package com.google.cloud.billing.budgets.v1; + +public interface CreateBudgetRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1.CreateBudgetRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the billing account to create the budget in. Values
+   * are of the form `billingAccounts/{billingAccountId}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The name of the billing account to create the budget in. Values
+   * are of the form `billingAccounts/{billingAccountId}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. Budget to create.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the budget field is set. + */ + boolean hasBudget(); + /** + * + * + *
+   * Required. Budget to create.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The budget. + */ + com.google.cloud.billing.budgets.v1.Budget getBudget(); + /** + * + * + *
+   * Required. Budget to create.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.billing.budgets.v1.BudgetOrBuilder getBudgetOrBuilder(); +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/DeleteBudgetRequest.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/DeleteBudgetRequest.java new file mode 100644 index 00000000..c891cd90 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/DeleteBudgetRequest.java @@ -0,0 +1,658 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_service.proto + +package com.google.cloud.billing.budgets.v1; + +/** + * + * + *
+ * Request for DeleteBudget
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.DeleteBudgetRequest} + */ +public final class DeleteBudgetRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1.DeleteBudgetRequest) + DeleteBudgetRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DeleteBudgetRequest.newBuilder() to construct. + private DeleteBudgetRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DeleteBudgetRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DeleteBudgetRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private DeleteBudgetRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_DeleteBudgetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_DeleteBudgetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.DeleteBudgetRequest.class, + com.google.cloud.billing.budgets.v1.DeleteBudgetRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. Name of the budget to delete. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Name of the budget to delete. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1.DeleteBudgetRequest)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1.DeleteBudgetRequest other = + (com.google.cloud.billing.budgets.v1.DeleteBudgetRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1.DeleteBudgetRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.DeleteBudgetRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.DeleteBudgetRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.DeleteBudgetRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.DeleteBudgetRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.DeleteBudgetRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.DeleteBudgetRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.DeleteBudgetRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.DeleteBudgetRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.DeleteBudgetRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.DeleteBudgetRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.DeleteBudgetRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.billing.budgets.v1.DeleteBudgetRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for DeleteBudget
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.DeleteBudgetRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1.DeleteBudgetRequest) + com.google.cloud.billing.budgets.v1.DeleteBudgetRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_DeleteBudgetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_DeleteBudgetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.DeleteBudgetRequest.class, + com.google.cloud.billing.budgets.v1.DeleteBudgetRequest.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1.DeleteBudgetRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_DeleteBudgetRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.DeleteBudgetRequest getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1.DeleteBudgetRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.DeleteBudgetRequest build() { + com.google.cloud.billing.budgets.v1.DeleteBudgetRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.DeleteBudgetRequest buildPartial() { + com.google.cloud.billing.budgets.v1.DeleteBudgetRequest result = + new com.google.cloud.billing.budgets.v1.DeleteBudgetRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1.DeleteBudgetRequest) { + return mergeFrom((com.google.cloud.billing.budgets.v1.DeleteBudgetRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1.DeleteBudgetRequest other) { + if (other == com.google.cloud.billing.budgets.v1.DeleteBudgetRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1.DeleteBudgetRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.budgets.v1.DeleteBudgetRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. Name of the budget to delete. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Name of the budget to delete. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Name of the budget to delete. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Name of the budget to delete. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Name of the budget to delete. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1.DeleteBudgetRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1.DeleteBudgetRequest) + private static final com.google.cloud.billing.budgets.v1.DeleteBudgetRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1.DeleteBudgetRequest(); + } + + public static com.google.cloud.billing.budgets.v1.DeleteBudgetRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeleteBudgetRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DeleteBudgetRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.DeleteBudgetRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/DeleteBudgetRequestOrBuilder.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/DeleteBudgetRequestOrBuilder.java new file mode 100644 index 00000000..9da8b8fb --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/DeleteBudgetRequestOrBuilder.java @@ -0,0 +1,56 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_service.proto + +package com.google.cloud.billing.budgets.v1; + +public interface DeleteBudgetRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1.DeleteBudgetRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Name of the budget to delete. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. Name of the budget to delete. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/Filter.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/Filter.java new file mode 100644 index 00000000..008c0137 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/Filter.java @@ -0,0 +1,2577 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_model.proto + +package com.google.cloud.billing.budgets.v1; + +/** + * + * + *
+ * A filter for a budget, limiting the scope of the cost to calculate.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.Filter} + */ +public final class Filter extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1.Filter) + FilterOrBuilder { + private static final long serialVersionUID = 0L; + // Use Filter.newBuilder() to construct. + private Filter(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Filter() { + projects_ = com.google.protobuf.LazyStringArrayList.EMPTY; + creditTypes_ = com.google.protobuf.LazyStringArrayList.EMPTY; + creditTypesTreatment_ = 0; + services_ = com.google.protobuf.LazyStringArrayList.EMPTY; + subaccounts_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Filter(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Filter( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + projects_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + projects_.add(s); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000004) != 0)) { + services_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000004; + } + services_.add(s); + break; + } + case 32: + { + int rawValue = input.readEnum(); + + creditTypesTreatment_ = rawValue; + break; + } + case 42: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000008) != 0)) { + subaccounts_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000008; + } + subaccounts_.add(s); + break; + } + case 50: + { + if (!((mutable_bitField0_ & 0x00000010) != 0)) { + labels_ = + com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000010; + } + com.google.protobuf.MapEntry + labels__ = + input.readMessage( + LabelsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + labels_.getMutableMap().put(labels__.getKey(), labels__.getValue()); + break; + } + case 58: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + creditTypes_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000002; + } + creditTypes_.add(s); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + projects_ = projects_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000004) != 0)) { + services_ = services_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000008) != 0)) { + subaccounts_ = subaccounts_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + creditTypes_ = creditTypes_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_Filter_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 6: + return internalGetLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_Filter_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.Filter.class, + com.google.cloud.billing.budgets.v1.Filter.Builder.class); + } + + /** + * + * + *
+   * Specifies how credits should be treated when determining spend for
+   * threshold calculations.
+   * 
+ * + * Protobuf enum {@code google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment} + */ + public enum CreditTypesTreatment implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * This is an invalid value.
+     * 
+ * + * CREDIT_TYPES_TREATMENT_UNSPECIFIED = 0; + */ + CREDIT_TYPES_TREATMENT_UNSPECIFIED(0), + /** + * + * + *
+     * All types of credit are subtracted from the gross cost to determine the
+     * spend for threshold calculations.
+     * 
+ * + * INCLUDE_ALL_CREDITS = 1; + */ + INCLUDE_ALL_CREDITS(1), + /** + * + * + *
+     * All types of credit are added to the net cost to determine the spend for
+     * threshold calculations.
+     * 
+ * + * EXCLUDE_ALL_CREDITS = 2; + */ + EXCLUDE_ALL_CREDITS(2), + /** + * + * + *
+     * Credit types specified in the credit_types field are subtracted from the
+     * gross cost to determine the spend for threshold calculations.
+     * 
+ * + * INCLUDE_SPECIFIED_CREDITS = 3; + */ + INCLUDE_SPECIFIED_CREDITS(3), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * This is an invalid value.
+     * 
+ * + * CREDIT_TYPES_TREATMENT_UNSPECIFIED = 0; + */ + public static final int CREDIT_TYPES_TREATMENT_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * All types of credit are subtracted from the gross cost to determine the
+     * spend for threshold calculations.
+     * 
+ * + * INCLUDE_ALL_CREDITS = 1; + */ + public static final int INCLUDE_ALL_CREDITS_VALUE = 1; + /** + * + * + *
+     * All types of credit are added to the net cost to determine the spend for
+     * threshold calculations.
+     * 
+ * + * EXCLUDE_ALL_CREDITS = 2; + */ + public static final int EXCLUDE_ALL_CREDITS_VALUE = 2; + /** + * + * + *
+     * Credit types specified in the credit_types field are subtracted from the
+     * gross cost to determine the spend for threshold calculations.
+     * 
+ * + * INCLUDE_SPECIFIED_CREDITS = 3; + */ + public static final int INCLUDE_SPECIFIED_CREDITS_VALUE = 3; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static CreditTypesTreatment valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static CreditTypesTreatment forNumber(int value) { + switch (value) { + case 0: + return CREDIT_TYPES_TREATMENT_UNSPECIFIED; + case 1: + return INCLUDE_ALL_CREDITS; + case 2: + return EXCLUDE_ALL_CREDITS; + case 3: + return INCLUDE_SPECIFIED_CREDITS; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public CreditTypesTreatment findValueByNumber(int number) { + return CreditTypesTreatment.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.Filter.getDescriptor().getEnumTypes().get(0); + } + + private static final CreditTypesTreatment[] VALUES = values(); + + public static CreditTypesTreatment valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private CreditTypesTreatment(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment) + } + + public static final int PROJECTS_FIELD_NUMBER = 1; + private com.google.protobuf.LazyStringList projects_; + /** + * + * + *
+   * Optional. A set of projects of the form `projects/{project}`,
+   * specifying that usage from only this set of projects should be
+   * included in the budget. If omitted, the report will include all usage for
+   * the billing account, regardless of which project the usage occurred on.
+   * Only zero or one project can be specified currently.
+   * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the projects. + */ + public com.google.protobuf.ProtocolStringList getProjectsList() { + return projects_; + } + /** + * + * + *
+   * Optional. A set of projects of the form `projects/{project}`,
+   * specifying that usage from only this set of projects should be
+   * included in the budget. If omitted, the report will include all usage for
+   * the billing account, regardless of which project the usage occurred on.
+   * Only zero or one project can be specified currently.
+   * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of projects. + */ + public int getProjectsCount() { + return projects_.size(); + } + /** + * + * + *
+   * Optional. A set of projects of the form `projects/{project}`,
+   * specifying that usage from only this set of projects should be
+   * included in the budget. If omitted, the report will include all usage for
+   * the billing account, regardless of which project the usage occurred on.
+   * Only zero or one project can be specified currently.
+   * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The projects at the given index. + */ + public java.lang.String getProjects(int index) { + return projects_.get(index); + } + /** + * + * + *
+   * Optional. A set of projects of the form `projects/{project}`,
+   * specifying that usage from only this set of projects should be
+   * included in the budget. If omitted, the report will include all usage for
+   * the billing account, regardless of which project the usage occurred on.
+   * Only zero or one project can be specified currently.
+   * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the projects at the given index. + */ + public com.google.protobuf.ByteString getProjectsBytes(int index) { + return projects_.getByteString(index); + } + + public static final int CREDIT_TYPES_FIELD_NUMBER = 7; + private com.google.protobuf.LazyStringList creditTypes_; + /** + * + * + *
+   * Optional. A list of credit types to be subtracted from gross cost to
+   * determine the spend for threshold calculations if and only if
+   * credit_types_treatment is INCLUDE_SPECIFIED_CREDITS. If
+   * credit_types_treatment is not INCLUDE_SPECIFIED_CREDITS, this field must be
+   * empty. See credits.type on
+   * https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#data-schema
+   * for a list of acceptable credit type values in this field.
+   * 
+ * + * repeated string credit_types = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the creditTypes. + */ + public com.google.protobuf.ProtocolStringList getCreditTypesList() { + return creditTypes_; + } + /** + * + * + *
+   * Optional. A list of credit types to be subtracted from gross cost to
+   * determine the spend for threshold calculations if and only if
+   * credit_types_treatment is INCLUDE_SPECIFIED_CREDITS. If
+   * credit_types_treatment is not INCLUDE_SPECIFIED_CREDITS, this field must be
+   * empty. See credits.type on
+   * https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#data-schema
+   * for a list of acceptable credit type values in this field.
+   * 
+ * + * repeated string credit_types = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of creditTypes. + */ + public int getCreditTypesCount() { + return creditTypes_.size(); + } + /** + * + * + *
+   * Optional. A list of credit types to be subtracted from gross cost to
+   * determine the spend for threshold calculations if and only if
+   * credit_types_treatment is INCLUDE_SPECIFIED_CREDITS. If
+   * credit_types_treatment is not INCLUDE_SPECIFIED_CREDITS, this field must be
+   * empty. See credits.type on
+   * https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#data-schema
+   * for a list of acceptable credit type values in this field.
+   * 
+ * + * repeated string credit_types = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The creditTypes at the given index. + */ + public java.lang.String getCreditTypes(int index) { + return creditTypes_.get(index); + } + /** + * + * + *
+   * Optional. A list of credit types to be subtracted from gross cost to
+   * determine the spend for threshold calculations if and only if
+   * credit_types_treatment is INCLUDE_SPECIFIED_CREDITS. If
+   * credit_types_treatment is not INCLUDE_SPECIFIED_CREDITS, this field must be
+   * empty. See credits.type on
+   * https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#data-schema
+   * for a list of acceptable credit type values in this field.
+   * 
+ * + * repeated string credit_types = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the creditTypes at the given index. + */ + public com.google.protobuf.ByteString getCreditTypesBytes(int index) { + return creditTypes_.getByteString(index); + } + + public static final int CREDIT_TYPES_TREATMENT_FIELD_NUMBER = 4; + private int creditTypesTreatment_; + /** + * + * + *
+   * Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment credit_types_treatment = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The enum numeric value on the wire for creditTypesTreatment. + */ + @java.lang.Override + public int getCreditTypesTreatmentValue() { + return creditTypesTreatment_; + } + /** + * + * + *
+   * Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment credit_types_treatment = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The creditTypesTreatment. + */ + @java.lang.Override + public com.google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment getCreditTypesTreatment() { + @SuppressWarnings("deprecation") + com.google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment result = + com.google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment.valueOf( + creditTypesTreatment_); + return result == null + ? com.google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment.UNRECOGNIZED + : result; + } + + public static final int SERVICES_FIELD_NUMBER = 3; + private com.google.protobuf.LazyStringList services_; + /** + * + * + *
+   * Optional. A set of services of the form `services/{service_id}`,
+   * specifying that usage from only this set of services should be
+   * included in the budget. If omitted, the report will include usage for
+   * all the services.
+   * The service names are available through the Catalog API:
+   * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+   * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the services. + */ + public com.google.protobuf.ProtocolStringList getServicesList() { + return services_; + } + /** + * + * + *
+   * Optional. A set of services of the form `services/{service_id}`,
+   * specifying that usage from only this set of services should be
+   * included in the budget. If omitted, the report will include usage for
+   * all the services.
+   * The service names are available through the Catalog API:
+   * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+   * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of services. + */ + public int getServicesCount() { + return services_.size(); + } + /** + * + * + *
+   * Optional. A set of services of the form `services/{service_id}`,
+   * specifying that usage from only this set of services should be
+   * included in the budget. If omitted, the report will include usage for
+   * all the services.
+   * The service names are available through the Catalog API:
+   * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+   * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The services at the given index. + */ + public java.lang.String getServices(int index) { + return services_.get(index); + } + /** + * + * + *
+   * Optional. A set of services of the form `services/{service_id}`,
+   * specifying that usage from only this set of services should be
+   * included in the budget. If omitted, the report will include usage for
+   * all the services.
+   * The service names are available through the Catalog API:
+   * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+   * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the services at the given index. + */ + public com.google.protobuf.ByteString getServicesBytes(int index) { + return services_.getByteString(index); + } + + public static final int SUBACCOUNTS_FIELD_NUMBER = 5; + private com.google.protobuf.LazyStringList subaccounts_; + /** + * + * + *
+   * Optional. A set of subaccounts of the form `billingAccounts/{account_id}`,
+   * specifying that usage from only this set of subaccounts should be included
+   * in the budget. If a subaccount is set to the name of the parent account,
+   * usage from the parent account will be included. If the field is omitted,
+   * the report will include usage from the parent account and all subaccounts,
+   * if they exist.
+   * 
+ * + * repeated string subaccounts = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the subaccounts. + */ + public com.google.protobuf.ProtocolStringList getSubaccountsList() { + return subaccounts_; + } + /** + * + * + *
+   * Optional. A set of subaccounts of the form `billingAccounts/{account_id}`,
+   * specifying that usage from only this set of subaccounts should be included
+   * in the budget. If a subaccount is set to the name of the parent account,
+   * usage from the parent account will be included. If the field is omitted,
+   * the report will include usage from the parent account and all subaccounts,
+   * if they exist.
+   * 
+ * + * repeated string subaccounts = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of subaccounts. + */ + public int getSubaccountsCount() { + return subaccounts_.size(); + } + /** + * + * + *
+   * Optional. A set of subaccounts of the form `billingAccounts/{account_id}`,
+   * specifying that usage from only this set of subaccounts should be included
+   * in the budget. If a subaccount is set to the name of the parent account,
+   * usage from the parent account will be included. If the field is omitted,
+   * the report will include usage from the parent account and all subaccounts,
+   * if they exist.
+   * 
+ * + * repeated string subaccounts = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The subaccounts at the given index. + */ + public java.lang.String getSubaccounts(int index) { + return subaccounts_.get(index); + } + /** + * + * + *
+   * Optional. A set of subaccounts of the form `billingAccounts/{account_id}`,
+   * specifying that usage from only this set of subaccounts should be included
+   * in the budget. If a subaccount is set to the name of the parent account,
+   * usage from the parent account will be included. If the field is omitted,
+   * the report will include usage from the parent account and all subaccounts,
+   * if they exist.
+   * 
+ * + * repeated string subaccounts = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the subaccounts at the given index. + */ + public com.google.protobuf.ByteString getSubaccountsBytes(int index) { + return subaccounts_.getByteString(index); + } + + public static final int LABELS_FIELD_NUMBER = 6; + + private static final class LabelsDefaultEntryHolder { + static final com.google.protobuf.MapEntry + defaultEntry = + com.google.protobuf.MapEntry + .newDefaultInstance( + com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_Filter_LabelsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + com.google.protobuf.ListValue.getDefaultInstance()); + } + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField + internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+   * Optional. A single label and value pair specifying that usage from only
+   * this set of labeled resources should be included in the budget. Currently,
+   * multiple entries or multiple values per entry are not allowed. If omitted,
+   * the report will include all labeled and unlabeled usage.
+   * 
+ * + * + * map<string, .google.protobuf.ListValue> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+   * Optional. A single label and value pair specifying that usage from only
+   * this set of labeled resources should be included in the budget. Currently,
+   * multiple entries or multiple values per entry are not allowed. If omitted,
+   * the report will include all labeled and unlabeled usage.
+   * 
+ * + * + * map<string, .google.protobuf.ListValue> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+   * Optional. A single label and value pair specifying that usage from only
+   * this set of labeled resources should be included in the budget. Currently,
+   * multiple entries or multiple values per entry are not allowed. If omitted,
+   * the report will include all labeled and unlabeled usage.
+   * 
+ * + * + * map<string, .google.protobuf.ListValue> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.protobuf.ListValue getLabelsOrDefault( + java.lang.String key, com.google.protobuf.ListValue defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = + internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Optional. A single label and value pair specifying that usage from only
+   * this set of labeled resources should be included in the budget. Currently,
+   * multiple entries or multiple values per entry are not allowed. If omitted,
+   * the report will include all labeled and unlabeled usage.
+   * 
+ * + * + * map<string, .google.protobuf.ListValue> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.protobuf.ListValue getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = + internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < projects_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, projects_.getRaw(i)); + } + for (int i = 0; i < services_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, services_.getRaw(i)); + } + if (creditTypesTreatment_ + != com.google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment + .CREDIT_TYPES_TREATMENT_UNSPECIFIED + .getNumber()) { + output.writeEnum(4, creditTypesTreatment_); + } + for (int i = 0; i < subaccounts_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, subaccounts_.getRaw(i)); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 6); + for (int i = 0; i < creditTypes_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 7, creditTypes_.getRaw(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < projects_.size(); i++) { + dataSize += computeStringSizeNoTag(projects_.getRaw(i)); + } + size += dataSize; + size += 1 * getProjectsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < services_.size(); i++) { + dataSize += computeStringSizeNoTag(services_.getRaw(i)); + } + size += dataSize; + size += 1 * getServicesList().size(); + } + if (creditTypesTreatment_ + != com.google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment + .CREDIT_TYPES_TREATMENT_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(4, creditTypesTreatment_); + } + { + int dataSize = 0; + for (int i = 0; i < subaccounts_.size(); i++) { + dataSize += computeStringSizeNoTag(subaccounts_.getRaw(i)); + } + size += dataSize; + size += 1 * getSubaccountsList().size(); + } + for (java.util.Map.Entry entry : + internalGetLabels().getMap().entrySet()) { + com.google.protobuf.MapEntry labels__ = + LabelsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, labels__); + } + { + int dataSize = 0; + for (int i = 0; i < creditTypes_.size(); i++) { + dataSize += computeStringSizeNoTag(creditTypes_.getRaw(i)); + } + size += dataSize; + size += 1 * getCreditTypesList().size(); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1.Filter)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1.Filter other = + (com.google.cloud.billing.budgets.v1.Filter) obj; + + if (!getProjectsList().equals(other.getProjectsList())) return false; + if (!getCreditTypesList().equals(other.getCreditTypesList())) return false; + if (creditTypesTreatment_ != other.creditTypesTreatment_) return false; + if (!getServicesList().equals(other.getServicesList())) return false; + if (!getSubaccountsList().equals(other.getSubaccountsList())) return false; + if (!internalGetLabels().equals(other.internalGetLabels())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getProjectsCount() > 0) { + hash = (37 * hash) + PROJECTS_FIELD_NUMBER; + hash = (53 * hash) + getProjectsList().hashCode(); + } + if (getCreditTypesCount() > 0) { + hash = (37 * hash) + CREDIT_TYPES_FIELD_NUMBER; + hash = (53 * hash) + getCreditTypesList().hashCode(); + } + hash = (37 * hash) + CREDIT_TYPES_TREATMENT_FIELD_NUMBER; + hash = (53 * hash) + creditTypesTreatment_; + if (getServicesCount() > 0) { + hash = (37 * hash) + SERVICES_FIELD_NUMBER; + hash = (53 * hash) + getServicesList().hashCode(); + } + if (getSubaccountsCount() > 0) { + hash = (37 * hash) + SUBACCOUNTS_FIELD_NUMBER; + hash = (53 * hash) + getSubaccountsList().hashCode(); + } + if (!internalGetLabels().getMap().isEmpty()) { + hash = (37 * hash) + LABELS_FIELD_NUMBER; + hash = (53 * hash) + internalGetLabels().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1.Filter parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.Filter parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.Filter parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.Filter parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.Filter parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.Filter parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.Filter parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.Filter parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.Filter parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.Filter parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.Filter parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.Filter parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.billing.budgets.v1.Filter prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * A filter for a budget, limiting the scope of the cost to calculate.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.Filter} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1.Filter) + com.google.cloud.billing.budgets.v1.FilterOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_Filter_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 6: + return internalGetLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 6: + return internalGetMutableLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_Filter_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.Filter.class, + com.google.cloud.billing.budgets.v1.Filter.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1.Filter.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + projects_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + creditTypes_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + creditTypesTreatment_ = 0; + + services_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + subaccounts_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + internalGetMutableLabels().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_Filter_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.Filter getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1.Filter.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.Filter build() { + com.google.cloud.billing.budgets.v1.Filter result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.Filter buildPartial() { + com.google.cloud.billing.budgets.v1.Filter result = + new com.google.cloud.billing.budgets.v1.Filter(this); + int from_bitField0_ = bitField0_; + if (((bitField0_ & 0x00000001) != 0)) { + projects_ = projects_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.projects_ = projects_; + if (((bitField0_ & 0x00000002) != 0)) { + creditTypes_ = creditTypes_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.creditTypes_ = creditTypes_; + result.creditTypesTreatment_ = creditTypesTreatment_; + if (((bitField0_ & 0x00000004) != 0)) { + services_ = services_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.services_ = services_; + if (((bitField0_ & 0x00000008) != 0)) { + subaccounts_ = subaccounts_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000008); + } + result.subaccounts_ = subaccounts_; + result.labels_ = internalGetLabels(); + result.labels_.makeImmutable(); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1.Filter) { + return mergeFrom((com.google.cloud.billing.budgets.v1.Filter) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1.Filter other) { + if (other == com.google.cloud.billing.budgets.v1.Filter.getDefaultInstance()) return this; + if (!other.projects_.isEmpty()) { + if (projects_.isEmpty()) { + projects_ = other.projects_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureProjectsIsMutable(); + projects_.addAll(other.projects_); + } + onChanged(); + } + if (!other.creditTypes_.isEmpty()) { + if (creditTypes_.isEmpty()) { + creditTypes_ = other.creditTypes_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureCreditTypesIsMutable(); + creditTypes_.addAll(other.creditTypes_); + } + onChanged(); + } + if (other.creditTypesTreatment_ != 0) { + setCreditTypesTreatmentValue(other.getCreditTypesTreatmentValue()); + } + if (!other.services_.isEmpty()) { + if (services_.isEmpty()) { + services_ = other.services_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureServicesIsMutable(); + services_.addAll(other.services_); + } + onChanged(); + } + if (!other.subaccounts_.isEmpty()) { + if (subaccounts_.isEmpty()) { + subaccounts_ = other.subaccounts_; + bitField0_ = (bitField0_ & ~0x00000008); + } else { + ensureSubaccountsIsMutable(); + subaccounts_.addAll(other.subaccounts_); + } + onChanged(); + } + internalGetMutableLabels().mergeFrom(other.internalGetLabels()); + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1.Filter parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.billing.budgets.v1.Filter) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.protobuf.LazyStringList projects_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureProjectsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + projects_ = new com.google.protobuf.LazyStringArrayList(projects_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * Optional. A set of projects of the form `projects/{project}`,
+     * specifying that usage from only this set of projects should be
+     * included in the budget. If omitted, the report will include all usage for
+     * the billing account, regardless of which project the usage occurred on.
+     * Only zero or one project can be specified currently.
+     * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the projects. + */ + public com.google.protobuf.ProtocolStringList getProjectsList() { + return projects_.getUnmodifiableView(); + } + /** + * + * + *
+     * Optional. A set of projects of the form `projects/{project}`,
+     * specifying that usage from only this set of projects should be
+     * included in the budget. If omitted, the report will include all usage for
+     * the billing account, regardless of which project the usage occurred on.
+     * Only zero or one project can be specified currently.
+     * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of projects. + */ + public int getProjectsCount() { + return projects_.size(); + } + /** + * + * + *
+     * Optional. A set of projects of the form `projects/{project}`,
+     * specifying that usage from only this set of projects should be
+     * included in the budget. If omitted, the report will include all usage for
+     * the billing account, regardless of which project the usage occurred on.
+     * Only zero or one project can be specified currently.
+     * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The projects at the given index. + */ + public java.lang.String getProjects(int index) { + return projects_.get(index); + } + /** + * + * + *
+     * Optional. A set of projects of the form `projects/{project}`,
+     * specifying that usage from only this set of projects should be
+     * included in the budget. If omitted, the report will include all usage for
+     * the billing account, regardless of which project the usage occurred on.
+     * Only zero or one project can be specified currently.
+     * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the projects at the given index. + */ + public com.google.protobuf.ByteString getProjectsBytes(int index) { + return projects_.getByteString(index); + } + /** + * + * + *
+     * Optional. A set of projects of the form `projects/{project}`,
+     * specifying that usage from only this set of projects should be
+     * included in the budget. If omitted, the report will include all usage for
+     * the billing account, regardless of which project the usage occurred on.
+     * Only zero or one project can be specified currently.
+     * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index to set the value at. + * @param value The projects to set. + * @return This builder for chaining. + */ + public Builder setProjects(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureProjectsIsMutable(); + projects_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A set of projects of the form `projects/{project}`,
+     * specifying that usage from only this set of projects should be
+     * included in the budget. If omitted, the report will include all usage for
+     * the billing account, regardless of which project the usage occurred on.
+     * Only zero or one project can be specified currently.
+     * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The projects to add. + * @return This builder for chaining. + */ + public Builder addProjects(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureProjectsIsMutable(); + projects_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A set of projects of the form `projects/{project}`,
+     * specifying that usage from only this set of projects should be
+     * included in the budget. If omitted, the report will include all usage for
+     * the billing account, regardless of which project the usage occurred on.
+     * Only zero or one project can be specified currently.
+     * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param values The projects to add. + * @return This builder for chaining. + */ + public Builder addAllProjects(java.lang.Iterable values) { + ensureProjectsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, projects_); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A set of projects of the form `projects/{project}`,
+     * specifying that usage from only this set of projects should be
+     * included in the budget. If omitted, the report will include all usage for
+     * the billing account, regardless of which project the usage occurred on.
+     * Only zero or one project can be specified currently.
+     * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearProjects() { + projects_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A set of projects of the form `projects/{project}`,
+     * specifying that usage from only this set of projects should be
+     * included in the budget. If omitted, the report will include all usage for
+     * the billing account, regardless of which project the usage occurred on.
+     * Only zero or one project can be specified currently.
+     * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes of the projects to add. + * @return This builder for chaining. + */ + public Builder addProjectsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureProjectsIsMutable(); + projects_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList creditTypes_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureCreditTypesIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + creditTypes_ = new com.google.protobuf.LazyStringArrayList(creditTypes_); + bitField0_ |= 0x00000002; + } + } + /** + * + * + *
+     * Optional. A list of credit types to be subtracted from gross cost to
+     * determine the spend for threshold calculations if and only if
+     * credit_types_treatment is INCLUDE_SPECIFIED_CREDITS. If
+     * credit_types_treatment is not INCLUDE_SPECIFIED_CREDITS, this field must be
+     * empty. See credits.type on
+     * https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#data-schema
+     * for a list of acceptable credit type values in this field.
+     * 
+ * + * repeated string credit_types = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the creditTypes. + */ + public com.google.protobuf.ProtocolStringList getCreditTypesList() { + return creditTypes_.getUnmodifiableView(); + } + /** + * + * + *
+     * Optional. A list of credit types to be subtracted from gross cost to
+     * determine the spend for threshold calculations if and only if
+     * credit_types_treatment is INCLUDE_SPECIFIED_CREDITS. If
+     * credit_types_treatment is not INCLUDE_SPECIFIED_CREDITS, this field must be
+     * empty. See credits.type on
+     * https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#data-schema
+     * for a list of acceptable credit type values in this field.
+     * 
+ * + * repeated string credit_types = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of creditTypes. + */ + public int getCreditTypesCount() { + return creditTypes_.size(); + } + /** + * + * + *
+     * Optional. A list of credit types to be subtracted from gross cost to
+     * determine the spend for threshold calculations if and only if
+     * credit_types_treatment is INCLUDE_SPECIFIED_CREDITS. If
+     * credit_types_treatment is not INCLUDE_SPECIFIED_CREDITS, this field must be
+     * empty. See credits.type on
+     * https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#data-schema
+     * for a list of acceptable credit type values in this field.
+     * 
+ * + * repeated string credit_types = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The creditTypes at the given index. + */ + public java.lang.String getCreditTypes(int index) { + return creditTypes_.get(index); + } + /** + * + * + *
+     * Optional. A list of credit types to be subtracted from gross cost to
+     * determine the spend for threshold calculations if and only if
+     * credit_types_treatment is INCLUDE_SPECIFIED_CREDITS. If
+     * credit_types_treatment is not INCLUDE_SPECIFIED_CREDITS, this field must be
+     * empty. See credits.type on
+     * https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#data-schema
+     * for a list of acceptable credit type values in this field.
+     * 
+ * + * repeated string credit_types = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the creditTypes at the given index. + */ + public com.google.protobuf.ByteString getCreditTypesBytes(int index) { + return creditTypes_.getByteString(index); + } + /** + * + * + *
+     * Optional. A list of credit types to be subtracted from gross cost to
+     * determine the spend for threshold calculations if and only if
+     * credit_types_treatment is INCLUDE_SPECIFIED_CREDITS. If
+     * credit_types_treatment is not INCLUDE_SPECIFIED_CREDITS, this field must be
+     * empty. See credits.type on
+     * https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#data-schema
+     * for a list of acceptable credit type values in this field.
+     * 
+ * + * repeated string credit_types = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index to set the value at. + * @param value The creditTypes to set. + * @return This builder for chaining. + */ + public Builder setCreditTypes(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureCreditTypesIsMutable(); + creditTypes_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A list of credit types to be subtracted from gross cost to
+     * determine the spend for threshold calculations if and only if
+     * credit_types_treatment is INCLUDE_SPECIFIED_CREDITS. If
+     * credit_types_treatment is not INCLUDE_SPECIFIED_CREDITS, this field must be
+     * empty. See credits.type on
+     * https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#data-schema
+     * for a list of acceptable credit type values in this field.
+     * 
+ * + * repeated string credit_types = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The creditTypes to add. + * @return This builder for chaining. + */ + public Builder addCreditTypes(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureCreditTypesIsMutable(); + creditTypes_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A list of credit types to be subtracted from gross cost to
+     * determine the spend for threshold calculations if and only if
+     * credit_types_treatment is INCLUDE_SPECIFIED_CREDITS. If
+     * credit_types_treatment is not INCLUDE_SPECIFIED_CREDITS, this field must be
+     * empty. See credits.type on
+     * https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#data-schema
+     * for a list of acceptable credit type values in this field.
+     * 
+ * + * repeated string credit_types = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param values The creditTypes to add. + * @return This builder for chaining. + */ + public Builder addAllCreditTypes(java.lang.Iterable values) { + ensureCreditTypesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, creditTypes_); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A list of credit types to be subtracted from gross cost to
+     * determine the spend for threshold calculations if and only if
+     * credit_types_treatment is INCLUDE_SPECIFIED_CREDITS. If
+     * credit_types_treatment is not INCLUDE_SPECIFIED_CREDITS, this field must be
+     * empty. See credits.type on
+     * https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#data-schema
+     * for a list of acceptable credit type values in this field.
+     * 
+ * + * repeated string credit_types = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearCreditTypes() { + creditTypes_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A list of credit types to be subtracted from gross cost to
+     * determine the spend for threshold calculations if and only if
+     * credit_types_treatment is INCLUDE_SPECIFIED_CREDITS. If
+     * credit_types_treatment is not INCLUDE_SPECIFIED_CREDITS, this field must be
+     * empty. See credits.type on
+     * https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#data-schema
+     * for a list of acceptable credit type values in this field.
+     * 
+ * + * repeated string credit_types = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes of the creditTypes to add. + * @return This builder for chaining. + */ + public Builder addCreditTypesBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureCreditTypesIsMutable(); + creditTypes_.add(value); + onChanged(); + return this; + } + + private int creditTypesTreatment_ = 0; + /** + * + * + *
+     * Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment credit_types_treatment = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The enum numeric value on the wire for creditTypesTreatment. + */ + @java.lang.Override + public int getCreditTypesTreatmentValue() { + return creditTypesTreatment_; + } + /** + * + * + *
+     * Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment credit_types_treatment = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The enum numeric value on the wire for creditTypesTreatment to set. + * @return This builder for chaining. + */ + public Builder setCreditTypesTreatmentValue(int value) { + + creditTypesTreatment_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment credit_types_treatment = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The creditTypesTreatment. + */ + @java.lang.Override + public com.google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment + getCreditTypesTreatment() { + @SuppressWarnings("deprecation") + com.google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment result = + com.google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment.valueOf( + creditTypesTreatment_); + return result == null + ? com.google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment credit_types_treatment = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The creditTypesTreatment to set. + * @return This builder for chaining. + */ + public Builder setCreditTypesTreatment( + com.google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment value) { + if (value == null) { + throw new NullPointerException(); + } + + creditTypesTreatment_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment credit_types_treatment = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return This builder for chaining. + */ + public Builder clearCreditTypesTreatment() { + + creditTypesTreatment_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList services_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureServicesIsMutable() { + if (!((bitField0_ & 0x00000004) != 0)) { + services_ = new com.google.protobuf.LazyStringArrayList(services_); + bitField0_ |= 0x00000004; + } + } + /** + * + * + *
+     * Optional. A set of services of the form `services/{service_id}`,
+     * specifying that usage from only this set of services should be
+     * included in the budget. If omitted, the report will include usage for
+     * all the services.
+     * The service names are available through the Catalog API:
+     * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+     * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the services. + */ + public com.google.protobuf.ProtocolStringList getServicesList() { + return services_.getUnmodifiableView(); + } + /** + * + * + *
+     * Optional. A set of services of the form `services/{service_id}`,
+     * specifying that usage from only this set of services should be
+     * included in the budget. If omitted, the report will include usage for
+     * all the services.
+     * The service names are available through the Catalog API:
+     * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+     * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of services. + */ + public int getServicesCount() { + return services_.size(); + } + /** + * + * + *
+     * Optional. A set of services of the form `services/{service_id}`,
+     * specifying that usage from only this set of services should be
+     * included in the budget. If omitted, the report will include usage for
+     * all the services.
+     * The service names are available through the Catalog API:
+     * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+     * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The services at the given index. + */ + public java.lang.String getServices(int index) { + return services_.get(index); + } + /** + * + * + *
+     * Optional. A set of services of the form `services/{service_id}`,
+     * specifying that usage from only this set of services should be
+     * included in the budget. If omitted, the report will include usage for
+     * all the services.
+     * The service names are available through the Catalog API:
+     * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+     * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the services at the given index. + */ + public com.google.protobuf.ByteString getServicesBytes(int index) { + return services_.getByteString(index); + } + /** + * + * + *
+     * Optional. A set of services of the form `services/{service_id}`,
+     * specifying that usage from only this set of services should be
+     * included in the budget. If omitted, the report will include usage for
+     * all the services.
+     * The service names are available through the Catalog API:
+     * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+     * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index to set the value at. + * @param value The services to set. + * @return This builder for chaining. + */ + public Builder setServices(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureServicesIsMutable(); + services_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A set of services of the form `services/{service_id}`,
+     * specifying that usage from only this set of services should be
+     * included in the budget. If omitted, the report will include usage for
+     * all the services.
+     * The service names are available through the Catalog API:
+     * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+     * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The services to add. + * @return This builder for chaining. + */ + public Builder addServices(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureServicesIsMutable(); + services_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A set of services of the form `services/{service_id}`,
+     * specifying that usage from only this set of services should be
+     * included in the budget. If omitted, the report will include usage for
+     * all the services.
+     * The service names are available through the Catalog API:
+     * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+     * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param values The services to add. + * @return This builder for chaining. + */ + public Builder addAllServices(java.lang.Iterable values) { + ensureServicesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, services_); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A set of services of the form `services/{service_id}`,
+     * specifying that usage from only this set of services should be
+     * included in the budget. If omitted, the report will include usage for
+     * all the services.
+     * The service names are available through the Catalog API:
+     * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+     * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearServices() { + services_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A set of services of the form `services/{service_id}`,
+     * specifying that usage from only this set of services should be
+     * included in the budget. If omitted, the report will include usage for
+     * all the services.
+     * The service names are available through the Catalog API:
+     * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+     * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes of the services to add. + * @return This builder for chaining. + */ + public Builder addServicesBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureServicesIsMutable(); + services_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList subaccounts_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureSubaccountsIsMutable() { + if (!((bitField0_ & 0x00000008) != 0)) { + subaccounts_ = new com.google.protobuf.LazyStringArrayList(subaccounts_); + bitField0_ |= 0x00000008; + } + } + /** + * + * + *
+     * Optional. A set of subaccounts of the form `billingAccounts/{account_id}`,
+     * specifying that usage from only this set of subaccounts should be included
+     * in the budget. If a subaccount is set to the name of the parent account,
+     * usage from the parent account will be included. If the field is omitted,
+     * the report will include usage from the parent account and all subaccounts,
+     * if they exist.
+     * 
+ * + * repeated string subaccounts = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the subaccounts. + */ + public com.google.protobuf.ProtocolStringList getSubaccountsList() { + return subaccounts_.getUnmodifiableView(); + } + /** + * + * + *
+     * Optional. A set of subaccounts of the form `billingAccounts/{account_id}`,
+     * specifying that usage from only this set of subaccounts should be included
+     * in the budget. If a subaccount is set to the name of the parent account,
+     * usage from the parent account will be included. If the field is omitted,
+     * the report will include usage from the parent account and all subaccounts,
+     * if they exist.
+     * 
+ * + * repeated string subaccounts = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of subaccounts. + */ + public int getSubaccountsCount() { + return subaccounts_.size(); + } + /** + * + * + *
+     * Optional. A set of subaccounts of the form `billingAccounts/{account_id}`,
+     * specifying that usage from only this set of subaccounts should be included
+     * in the budget. If a subaccount is set to the name of the parent account,
+     * usage from the parent account will be included. If the field is omitted,
+     * the report will include usage from the parent account and all subaccounts,
+     * if they exist.
+     * 
+ * + * repeated string subaccounts = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The subaccounts at the given index. + */ + public java.lang.String getSubaccounts(int index) { + return subaccounts_.get(index); + } + /** + * + * + *
+     * Optional. A set of subaccounts of the form `billingAccounts/{account_id}`,
+     * specifying that usage from only this set of subaccounts should be included
+     * in the budget. If a subaccount is set to the name of the parent account,
+     * usage from the parent account will be included. If the field is omitted,
+     * the report will include usage from the parent account and all subaccounts,
+     * if they exist.
+     * 
+ * + * repeated string subaccounts = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the subaccounts at the given index. + */ + public com.google.protobuf.ByteString getSubaccountsBytes(int index) { + return subaccounts_.getByteString(index); + } + /** + * + * + *
+     * Optional. A set of subaccounts of the form `billingAccounts/{account_id}`,
+     * specifying that usage from only this set of subaccounts should be included
+     * in the budget. If a subaccount is set to the name of the parent account,
+     * usage from the parent account will be included. If the field is omitted,
+     * the report will include usage from the parent account and all subaccounts,
+     * if they exist.
+     * 
+ * + * repeated string subaccounts = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index to set the value at. + * @param value The subaccounts to set. + * @return This builder for chaining. + */ + public Builder setSubaccounts(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureSubaccountsIsMutable(); + subaccounts_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A set of subaccounts of the form `billingAccounts/{account_id}`,
+     * specifying that usage from only this set of subaccounts should be included
+     * in the budget. If a subaccount is set to the name of the parent account,
+     * usage from the parent account will be included. If the field is omitted,
+     * the report will include usage from the parent account and all subaccounts,
+     * if they exist.
+     * 
+ * + * repeated string subaccounts = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The subaccounts to add. + * @return This builder for chaining. + */ + public Builder addSubaccounts(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureSubaccountsIsMutable(); + subaccounts_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A set of subaccounts of the form `billingAccounts/{account_id}`,
+     * specifying that usage from only this set of subaccounts should be included
+     * in the budget. If a subaccount is set to the name of the parent account,
+     * usage from the parent account will be included. If the field is omitted,
+     * the report will include usage from the parent account and all subaccounts,
+     * if they exist.
+     * 
+ * + * repeated string subaccounts = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param values The subaccounts to add. + * @return This builder for chaining. + */ + public Builder addAllSubaccounts(java.lang.Iterable values) { + ensureSubaccountsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, subaccounts_); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A set of subaccounts of the form `billingAccounts/{account_id}`,
+     * specifying that usage from only this set of subaccounts should be included
+     * in the budget. If a subaccount is set to the name of the parent account,
+     * usage from the parent account will be included. If the field is omitted,
+     * the report will include usage from the parent account and all subaccounts,
+     * if they exist.
+     * 
+ * + * repeated string subaccounts = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearSubaccounts() { + subaccounts_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A set of subaccounts of the form `billingAccounts/{account_id}`,
+     * specifying that usage from only this set of subaccounts should be included
+     * in the budget. If a subaccount is set to the name of the parent account,
+     * usage from the parent account will be included. If the field is omitted,
+     * the report will include usage from the parent account and all subaccounts,
+     * if they exist.
+     * 
+ * + * repeated string subaccounts = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes of the subaccounts to add. + * @return This builder for chaining. + */ + public Builder addSubaccountsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureSubaccountsIsMutable(); + subaccounts_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField + internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + private com.google.protobuf.MapField + internalGetMutableLabels() { + onChanged(); + ; + if (labels_ == null) { + labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); + } + if (!labels_.isMutable()) { + labels_ = labels_.copy(); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+     * Optional. A single label and value pair specifying that usage from only
+     * this set of labeled resources should be included in the budget. Currently,
+     * multiple entries or multiple values per entry are not allowed. If omitted,
+     * the report will include all labeled and unlabeled usage.
+     * 
+ * + * + * map<string, .google.protobuf.ListValue> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+     * Optional. A single label and value pair specifying that usage from only
+     * this set of labeled resources should be included in the budget. Currently,
+     * multiple entries or multiple values per entry are not allowed. If omitted,
+     * the report will include all labeled and unlabeled usage.
+     * 
+ * + * + * map<string, .google.protobuf.ListValue> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+     * Optional. A single label and value pair specifying that usage from only
+     * this set of labeled resources should be included in the budget. Currently,
+     * multiple entries or multiple values per entry are not allowed. If omitted,
+     * the report will include all labeled and unlabeled usage.
+     * 
+ * + * + * map<string, .google.protobuf.ListValue> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.protobuf.ListValue getLabelsOrDefault( + java.lang.String key, com.google.protobuf.ListValue defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = + internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Optional. A single label and value pair specifying that usage from only
+     * this set of labeled resources should be included in the budget. Currently,
+     * multiple entries or multiple values per entry are not allowed. If omitted,
+     * the report will include all labeled and unlabeled usage.
+     * 
+ * + * + * map<string, .google.protobuf.ListValue> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.protobuf.ListValue getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = + internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearLabels() { + internalGetMutableLabels().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * Optional. A single label and value pair specifying that usage from only
+     * this set of labeled resources should be included in the budget. Currently,
+     * multiple entries or multiple values per entry are not allowed. If omitted,
+     * the report will include all labeled and unlabeled usage.
+     * 
+ * + * + * map<string, .google.protobuf.ListValue> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder removeLabels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableLabels().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableLabels() { + return internalGetMutableLabels().getMutableMap(); + } + /** + * + * + *
+     * Optional. A single label and value pair specifying that usage from only
+     * this set of labeled resources should be included in the budget. Currently,
+     * multiple entries or multiple values per entry are not allowed. If omitted,
+     * the report will include all labeled and unlabeled usage.
+     * 
+ * + * + * map<string, .google.protobuf.ListValue> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder putLabels(java.lang.String key, com.google.protobuf.ListValue value) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + if (value == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableLabels().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * Optional. A single label and value pair specifying that usage from only
+     * this set of labeled resources should be included in the budget. Currently,
+     * multiple entries or multiple values per entry are not allowed. If omitted,
+     * the report will include all labeled and unlabeled usage.
+     * 
+ * + * + * map<string, .google.protobuf.ListValue> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder putAllLabels( + java.util.Map values) { + internalGetMutableLabels().getMutableMap().putAll(values); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1.Filter) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1.Filter) + private static final com.google.cloud.billing.budgets.v1.Filter DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1.Filter(); + } + + public static com.google.cloud.billing.budgets.v1.Filter getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Filter parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Filter(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.Filter getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/FilterOrBuilder.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/FilterOrBuilder.java new file mode 100644 index 00000000..b1211c59 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/FilterOrBuilder.java @@ -0,0 +1,418 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_model.proto + +package com.google.cloud.billing.budgets.v1; + +public interface FilterOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1.Filter) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Optional. A set of projects of the form `projects/{project}`,
+   * specifying that usage from only this set of projects should be
+   * included in the budget. If omitted, the report will include all usage for
+   * the billing account, regardless of which project the usage occurred on.
+   * Only zero or one project can be specified currently.
+   * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the projects. + */ + java.util.List getProjectsList(); + /** + * + * + *
+   * Optional. A set of projects of the form `projects/{project}`,
+   * specifying that usage from only this set of projects should be
+   * included in the budget. If omitted, the report will include all usage for
+   * the billing account, regardless of which project the usage occurred on.
+   * Only zero or one project can be specified currently.
+   * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of projects. + */ + int getProjectsCount(); + /** + * + * + *
+   * Optional. A set of projects of the form `projects/{project}`,
+   * specifying that usage from only this set of projects should be
+   * included in the budget. If omitted, the report will include all usage for
+   * the billing account, regardless of which project the usage occurred on.
+   * Only zero or one project can be specified currently.
+   * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The projects at the given index. + */ + java.lang.String getProjects(int index); + /** + * + * + *
+   * Optional. A set of projects of the form `projects/{project}`,
+   * specifying that usage from only this set of projects should be
+   * included in the budget. If omitted, the report will include all usage for
+   * the billing account, regardless of which project the usage occurred on.
+   * Only zero or one project can be specified currently.
+   * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the projects at the given index. + */ + com.google.protobuf.ByteString getProjectsBytes(int index); + + /** + * + * + *
+   * Optional. A list of credit types to be subtracted from gross cost to
+   * determine the spend for threshold calculations if and only if
+   * credit_types_treatment is INCLUDE_SPECIFIED_CREDITS. If
+   * credit_types_treatment is not INCLUDE_SPECIFIED_CREDITS, this field must be
+   * empty. See credits.type on
+   * https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#data-schema
+   * for a list of acceptable credit type values in this field.
+   * 
+ * + * repeated string credit_types = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the creditTypes. + */ + java.util.List getCreditTypesList(); + /** + * + * + *
+   * Optional. A list of credit types to be subtracted from gross cost to
+   * determine the spend for threshold calculations if and only if
+   * credit_types_treatment is INCLUDE_SPECIFIED_CREDITS. If
+   * credit_types_treatment is not INCLUDE_SPECIFIED_CREDITS, this field must be
+   * empty. See credits.type on
+   * https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#data-schema
+   * for a list of acceptable credit type values in this field.
+   * 
+ * + * repeated string credit_types = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of creditTypes. + */ + int getCreditTypesCount(); + /** + * + * + *
+   * Optional. A list of credit types to be subtracted from gross cost to
+   * determine the spend for threshold calculations if and only if
+   * credit_types_treatment is INCLUDE_SPECIFIED_CREDITS. If
+   * credit_types_treatment is not INCLUDE_SPECIFIED_CREDITS, this field must be
+   * empty. See credits.type on
+   * https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#data-schema
+   * for a list of acceptable credit type values in this field.
+   * 
+ * + * repeated string credit_types = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The creditTypes at the given index. + */ + java.lang.String getCreditTypes(int index); + /** + * + * + *
+   * Optional. A list of credit types to be subtracted from gross cost to
+   * determine the spend for threshold calculations if and only if
+   * credit_types_treatment is INCLUDE_SPECIFIED_CREDITS. If
+   * credit_types_treatment is not INCLUDE_SPECIFIED_CREDITS, this field must be
+   * empty. See credits.type on
+   * https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#data-schema
+   * for a list of acceptable credit type values in this field.
+   * 
+ * + * repeated string credit_types = 7 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the creditTypes at the given index. + */ + com.google.protobuf.ByteString getCreditTypesBytes(int index); + + /** + * + * + *
+   * Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment credit_types_treatment = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The enum numeric value on the wire for creditTypesTreatment. + */ + int getCreditTypesTreatmentValue(); + /** + * + * + *
+   * Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment credit_types_treatment = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The creditTypesTreatment. + */ + com.google.cloud.billing.budgets.v1.Filter.CreditTypesTreatment getCreditTypesTreatment(); + + /** + * + * + *
+   * Optional. A set of services of the form `services/{service_id}`,
+   * specifying that usage from only this set of services should be
+   * included in the budget. If omitted, the report will include usage for
+   * all the services.
+   * The service names are available through the Catalog API:
+   * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+   * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the services. + */ + java.util.List getServicesList(); + /** + * + * + *
+   * Optional. A set of services of the form `services/{service_id}`,
+   * specifying that usage from only this set of services should be
+   * included in the budget. If omitted, the report will include usage for
+   * all the services.
+   * The service names are available through the Catalog API:
+   * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+   * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of services. + */ + int getServicesCount(); + /** + * + * + *
+   * Optional. A set of services of the form `services/{service_id}`,
+   * specifying that usage from only this set of services should be
+   * included in the budget. If omitted, the report will include usage for
+   * all the services.
+   * The service names are available through the Catalog API:
+   * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+   * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The services at the given index. + */ + java.lang.String getServices(int index); + /** + * + * + *
+   * Optional. A set of services of the form `services/{service_id}`,
+   * specifying that usage from only this set of services should be
+   * included in the budget. If omitted, the report will include usage for
+   * all the services.
+   * The service names are available through the Catalog API:
+   * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+   * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the services at the given index. + */ + com.google.protobuf.ByteString getServicesBytes(int index); + + /** + * + * + *
+   * Optional. A set of subaccounts of the form `billingAccounts/{account_id}`,
+   * specifying that usage from only this set of subaccounts should be included
+   * in the budget. If a subaccount is set to the name of the parent account,
+   * usage from the parent account will be included. If the field is omitted,
+   * the report will include usage from the parent account and all subaccounts,
+   * if they exist.
+   * 
+ * + * repeated string subaccounts = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the subaccounts. + */ + java.util.List getSubaccountsList(); + /** + * + * + *
+   * Optional. A set of subaccounts of the form `billingAccounts/{account_id}`,
+   * specifying that usage from only this set of subaccounts should be included
+   * in the budget. If a subaccount is set to the name of the parent account,
+   * usage from the parent account will be included. If the field is omitted,
+   * the report will include usage from the parent account and all subaccounts,
+   * if they exist.
+   * 
+ * + * repeated string subaccounts = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of subaccounts. + */ + int getSubaccountsCount(); + /** + * + * + *
+   * Optional. A set of subaccounts of the form `billingAccounts/{account_id}`,
+   * specifying that usage from only this set of subaccounts should be included
+   * in the budget. If a subaccount is set to the name of the parent account,
+   * usage from the parent account will be included. If the field is omitted,
+   * the report will include usage from the parent account and all subaccounts,
+   * if they exist.
+   * 
+ * + * repeated string subaccounts = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The subaccounts at the given index. + */ + java.lang.String getSubaccounts(int index); + /** + * + * + *
+   * Optional. A set of subaccounts of the form `billingAccounts/{account_id}`,
+   * specifying that usage from only this set of subaccounts should be included
+   * in the budget. If a subaccount is set to the name of the parent account,
+   * usage from the parent account will be included. If the field is omitted,
+   * the report will include usage from the parent account and all subaccounts,
+   * if they exist.
+   * 
+ * + * repeated string subaccounts = 5 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the subaccounts at the given index. + */ + com.google.protobuf.ByteString getSubaccountsBytes(int index); + + /** + * + * + *
+   * Optional. A single label and value pair specifying that usage from only
+   * this set of labeled resources should be included in the budget. Currently,
+   * multiple entries or multiple values per entry are not allowed. If omitted,
+   * the report will include all labeled and unlabeled usage.
+   * 
+ * + * + * map<string, .google.protobuf.ListValue> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + int getLabelsCount(); + /** + * + * + *
+   * Optional. A single label and value pair specifying that usage from only
+   * this set of labeled resources should be included in the budget. Currently,
+   * multiple entries or multiple values per entry are not allowed. If omitted,
+   * the report will include all labeled and unlabeled usage.
+   * 
+ * + * + * map<string, .google.protobuf.ListValue> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + boolean containsLabels(java.lang.String key); + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getLabels(); + /** + * + * + *
+   * Optional. A single label and value pair specifying that usage from only
+   * this set of labeled resources should be included in the budget. Currently,
+   * multiple entries or multiple values per entry are not allowed. If omitted,
+   * the report will include all labeled and unlabeled usage.
+   * 
+ * + * + * map<string, .google.protobuf.ListValue> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + java.util.Map getLabelsMap(); + /** + * + * + *
+   * Optional. A single label and value pair specifying that usage from only
+   * this set of labeled resources should be included in the budget. Currently,
+   * multiple entries or multiple values per entry are not allowed. If omitted,
+   * the report will include all labeled and unlabeled usage.
+   * 
+ * + * + * map<string, .google.protobuf.ListValue> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.protobuf.ListValue getLabelsOrDefault( + java.lang.String key, com.google.protobuf.ListValue defaultValue); + /** + * + * + *
+   * Optional. A single label and value pair specifying that usage from only
+   * this set of labeled resources should be included in the budget. Currently,
+   * multiple entries or multiple values per entry are not allowed. If omitted,
+   * the report will include all labeled and unlabeled usage.
+   * 
+ * + * + * map<string, .google.protobuf.ListValue> labels = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.protobuf.ListValue getLabelsOrThrow(java.lang.String key); +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/GetBudgetRequest.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/GetBudgetRequest.java new file mode 100644 index 00000000..a57cd0fb --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/GetBudgetRequest.java @@ -0,0 +1,657 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_service.proto + +package com.google.cloud.billing.budgets.v1; + +/** + * + * + *
+ * Request for GetBudget
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.GetBudgetRequest} + */ +public final class GetBudgetRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1.GetBudgetRequest) + GetBudgetRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetBudgetRequest.newBuilder() to construct. + private GetBudgetRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetBudgetRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetBudgetRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GetBudgetRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_GetBudgetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_GetBudgetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.GetBudgetRequest.class, + com.google.cloud.billing.budgets.v1.GetBudgetRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. Name of budget to get. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Name of budget to get. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1.GetBudgetRequest)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1.GetBudgetRequest other = + (com.google.cloud.billing.budgets.v1.GetBudgetRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1.GetBudgetRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.GetBudgetRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.GetBudgetRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.GetBudgetRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.GetBudgetRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.GetBudgetRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.GetBudgetRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.GetBudgetRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.GetBudgetRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.GetBudgetRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.GetBudgetRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.GetBudgetRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.billing.budgets.v1.GetBudgetRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for GetBudget
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.GetBudgetRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1.GetBudgetRequest) + com.google.cloud.billing.budgets.v1.GetBudgetRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_GetBudgetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_GetBudgetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.GetBudgetRequest.class, + com.google.cloud.billing.budgets.v1.GetBudgetRequest.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1.GetBudgetRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_GetBudgetRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.GetBudgetRequest getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1.GetBudgetRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.GetBudgetRequest build() { + com.google.cloud.billing.budgets.v1.GetBudgetRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.GetBudgetRequest buildPartial() { + com.google.cloud.billing.budgets.v1.GetBudgetRequest result = + new com.google.cloud.billing.budgets.v1.GetBudgetRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1.GetBudgetRequest) { + return mergeFrom((com.google.cloud.billing.budgets.v1.GetBudgetRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1.GetBudgetRequest other) { + if (other == com.google.cloud.billing.budgets.v1.GetBudgetRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1.GetBudgetRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.budgets.v1.GetBudgetRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. Name of budget to get. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Name of budget to get. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Name of budget to get. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Name of budget to get. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Name of budget to get. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1.GetBudgetRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1.GetBudgetRequest) + private static final com.google.cloud.billing.budgets.v1.GetBudgetRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1.GetBudgetRequest(); + } + + public static com.google.cloud.billing.budgets.v1.GetBudgetRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetBudgetRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetBudgetRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.GetBudgetRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/GetBudgetRequestOrBuilder.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/GetBudgetRequestOrBuilder.java new file mode 100644 index 00000000..96d2c50d --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/GetBudgetRequestOrBuilder.java @@ -0,0 +1,56 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_service.proto + +package com.google.cloud.billing.budgets.v1; + +public interface GetBudgetRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1.GetBudgetRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Name of budget to get. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. Name of budget to get. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/LastPeriodAmount.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/LastPeriodAmount.java new file mode 100644 index 00000000..0e1e4d57 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/LastPeriodAmount.java @@ -0,0 +1,464 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_model.proto + +package com.google.cloud.billing.budgets.v1; + +/** + * + * + *
+ * Describes a budget amount targeted to last period's spend.
+ * At this time, the amount is automatically 100% of last period's spend;
+ * that is, there are no other options yet.
+ * Future configuration will be described here (for example, configuring a
+ * percentage of last period's spend).
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.LastPeriodAmount} + */ +public final class LastPeriodAmount extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1.LastPeriodAmount) + LastPeriodAmountOrBuilder { + private static final long serialVersionUID = 0L; + // Use LastPeriodAmount.newBuilder() to construct. + private LastPeriodAmount(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private LastPeriodAmount() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new LastPeriodAmount(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private LastPeriodAmount( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_LastPeriodAmount_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_LastPeriodAmount_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.LastPeriodAmount.class, + com.google.cloud.billing.budgets.v1.LastPeriodAmount.Builder.class); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1.LastPeriodAmount)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1.LastPeriodAmount other = + (com.google.cloud.billing.budgets.v1.LastPeriodAmount) obj; + + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1.LastPeriodAmount parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.LastPeriodAmount parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.LastPeriodAmount parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.LastPeriodAmount parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.LastPeriodAmount parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.LastPeriodAmount parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.LastPeriodAmount parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.LastPeriodAmount parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.LastPeriodAmount parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.LastPeriodAmount parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.LastPeriodAmount parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.LastPeriodAmount parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.billing.budgets.v1.LastPeriodAmount prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Describes a budget amount targeted to last period's spend.
+   * At this time, the amount is automatically 100% of last period's spend;
+   * that is, there are no other options yet.
+   * Future configuration will be described here (for example, configuring a
+   * percentage of last period's spend).
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.LastPeriodAmount} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1.LastPeriodAmount) + com.google.cloud.billing.budgets.v1.LastPeriodAmountOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_LastPeriodAmount_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_LastPeriodAmount_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.LastPeriodAmount.class, + com.google.cloud.billing.budgets.v1.LastPeriodAmount.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1.LastPeriodAmount.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_LastPeriodAmount_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.LastPeriodAmount getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1.LastPeriodAmount.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.LastPeriodAmount build() { + com.google.cloud.billing.budgets.v1.LastPeriodAmount result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.LastPeriodAmount buildPartial() { + com.google.cloud.billing.budgets.v1.LastPeriodAmount result = + new com.google.cloud.billing.budgets.v1.LastPeriodAmount(this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1.LastPeriodAmount) { + return mergeFrom((com.google.cloud.billing.budgets.v1.LastPeriodAmount) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1.LastPeriodAmount other) { + if (other == com.google.cloud.billing.budgets.v1.LastPeriodAmount.getDefaultInstance()) + return this; + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1.LastPeriodAmount parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.budgets.v1.LastPeriodAmount) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1.LastPeriodAmount) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1.LastPeriodAmount) + private static final com.google.cloud.billing.budgets.v1.LastPeriodAmount DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1.LastPeriodAmount(); + } + + public static com.google.cloud.billing.budgets.v1.LastPeriodAmount getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public LastPeriodAmount parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new LastPeriodAmount(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.LastPeriodAmount getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/LastPeriodAmountOrBuilder.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/LastPeriodAmountOrBuilder.java new file mode 100644 index 00000000..234e636a --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/LastPeriodAmountOrBuilder.java @@ -0,0 +1,24 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_model.proto + +package com.google.cloud.billing.budgets.v1; + +public interface LastPeriodAmountOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1.LastPeriodAmount) + com.google.protobuf.MessageOrBuilder {} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ListBudgetsRequest.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ListBudgetsRequest.java new file mode 100644 index 00000000..e50e8218 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ListBudgetsRequest.java @@ -0,0 +1,945 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_service.proto + +package com.google.cloud.billing.budgets.v1; + +/** + * + * + *
+ * Request for ListBudgets
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.ListBudgetsRequest} + */ +public final class ListBudgetsRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1.ListBudgetsRequest) + ListBudgetsRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListBudgetsRequest.newBuilder() to construct. + private ListBudgetsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListBudgetsRequest() { + parent_ = ""; + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListBudgetsRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListBudgetsRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 16: + { + pageSize_ = input.readInt32(); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_ListBudgetsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_ListBudgetsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.ListBudgetsRequest.class, + com.google.cloud.billing.budgets.v1.ListBudgetsRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. Name of billing account to list budgets under. Values
+   * are of the form `billingAccounts/{billingAccountId}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Name of billing account to list budgets under. Values
+   * are of the form `billingAccounts/{billingAccountId}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_; + /** + * + * + *
+   * Optional. The maximum number of budgets to return per page.
+   * The default and maximum value are 100.
+   * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * Optional. The value returned by the last `ListBudgetsResponse` which
+   * indicates that this is a continuation of a prior `ListBudgets` call,
+   * and that the system should return the next page of data.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + @java.lang.Override + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. The value returned by the last `ListBudgetsResponse` which
+   * indicates that this is a continuation of a prior `ListBudgets` call,
+   * and that the system should return the next page of data.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1.ListBudgetsRequest)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1.ListBudgetsRequest other = + (com.google.cloud.billing.budgets.v1.ListBudgetsRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.billing.budgets.v1.ListBudgetsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for ListBudgets
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.ListBudgetsRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1.ListBudgetsRequest) + com.google.cloud.billing.budgets.v1.ListBudgetsRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_ListBudgetsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_ListBudgetsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.ListBudgetsRequest.class, + com.google.cloud.billing.budgets.v1.ListBudgetsRequest.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1.ListBudgetsRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + pageSize_ = 0; + + pageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_ListBudgetsRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.ListBudgetsRequest getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1.ListBudgetsRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.ListBudgetsRequest build() { + com.google.cloud.billing.budgets.v1.ListBudgetsRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.ListBudgetsRequest buildPartial() { + com.google.cloud.billing.budgets.v1.ListBudgetsRequest result = + new com.google.cloud.billing.budgets.v1.ListBudgetsRequest(this); + result.parent_ = parent_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1.ListBudgetsRequest) { + return mergeFrom((com.google.cloud.billing.budgets.v1.ListBudgetsRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1.ListBudgetsRequest other) { + if (other == com.google.cloud.billing.budgets.v1.ListBudgetsRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1.ListBudgetsRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.budgets.v1.ListBudgetsRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. Name of billing account to list budgets under. Values
+     * are of the form `billingAccounts/{billingAccountId}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Name of billing account to list budgets under. Values
+     * are of the form `billingAccounts/{billingAccountId}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Name of billing account to list budgets under. Values
+     * are of the form `billingAccounts/{billingAccountId}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Name of billing account to list budgets under. Values
+     * are of the form `billingAccounts/{billingAccountId}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Name of billing account to list budgets under. Values
+     * are of the form `billingAccounts/{billingAccountId}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * Optional. The maximum number of budgets to return per page.
+     * The default and maximum value are 100.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Optional. The maximum number of budgets to return per page.
+     * The default and maximum value are 100.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The maximum number of budgets to return per page.
+     * The default and maximum value are 100.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * Optional. The value returned by the last `ListBudgetsResponse` which
+     * indicates that this is a continuation of a prior `ListBudgets` call,
+     * and that the system should return the next page of data.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. The value returned by the last `ListBudgetsResponse` which
+     * indicates that this is a continuation of a prior `ListBudgets` call,
+     * and that the system should return the next page of data.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. The value returned by the last `ListBudgetsResponse` which
+     * indicates that this is a continuation of a prior `ListBudgets` call,
+     * and that the system should return the next page of data.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The value returned by the last `ListBudgetsResponse` which
+     * indicates that this is a continuation of a prior `ListBudgets` call,
+     * and that the system should return the next page of data.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The value returned by the last `ListBudgetsResponse` which
+     * indicates that this is a continuation of a prior `ListBudgets` call,
+     * and that the system should return the next page of data.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1.ListBudgetsRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1.ListBudgetsRequest) + private static final com.google.cloud.billing.budgets.v1.ListBudgetsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1.ListBudgetsRequest(); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListBudgetsRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListBudgetsRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.ListBudgetsRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ListBudgetsRequestOrBuilder.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ListBudgetsRequestOrBuilder.java new file mode 100644 index 00000000..f2f72608 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ListBudgetsRequestOrBuilder.java @@ -0,0 +1,99 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_service.proto + +package com.google.cloud.billing.budgets.v1; + +public interface ListBudgetsRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1.ListBudgetsRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Name of billing account to list budgets under. Values
+   * are of the form `billingAccounts/{billingAccountId}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. Name of billing account to list budgets under. Values
+   * are of the form `billingAccounts/{billingAccountId}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Optional. The maximum number of budgets to return per page.
+   * The default and maximum value are 100.
+   * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * Optional. The value returned by the last `ListBudgetsResponse` which
+   * indicates that this is a continuation of a prior `ListBudgets` call,
+   * and that the system should return the next page of data.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * Optional. The value returned by the last `ListBudgetsResponse` which
+   * indicates that this is a continuation of a prior `ListBudgets` call,
+   * and that the system should return the next page of data.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ListBudgetsResponse.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ListBudgetsResponse.java new file mode 100644 index 00000000..d514a8ed --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ListBudgetsResponse.java @@ -0,0 +1,1136 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_service.proto + +package com.google.cloud.billing.budgets.v1; + +/** + * + * + *
+ * Response for ListBudgets
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.ListBudgetsResponse} + */ +public final class ListBudgetsResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1.ListBudgetsResponse) + ListBudgetsResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListBudgetsResponse.newBuilder() to construct. + private ListBudgetsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListBudgetsResponse() { + budgets_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListBudgetsResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListBudgetsResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + budgets_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + budgets_.add( + input.readMessage( + com.google.cloud.billing.budgets.v1.Budget.parser(), extensionRegistry)); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + nextPageToken_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + budgets_ = java.util.Collections.unmodifiableList(budgets_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_ListBudgetsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_ListBudgetsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.ListBudgetsResponse.class, + com.google.cloud.billing.budgets.v1.ListBudgetsResponse.Builder.class); + } + + public static final int BUDGETS_FIELD_NUMBER = 1; + private java.util.List budgets_; + /** + * + * + *
+   * List of the budgets owned by the requested billing account.
+   * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + @java.lang.Override + public java.util.List getBudgetsList() { + return budgets_; + } + /** + * + * + *
+   * List of the budgets owned by the requested billing account.
+   * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + @java.lang.Override + public java.util.List + getBudgetsOrBuilderList() { + return budgets_; + } + /** + * + * + *
+   * List of the budgets owned by the requested billing account.
+   * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + @java.lang.Override + public int getBudgetsCount() { + return budgets_.size(); + } + /** + * + * + *
+   * List of the budgets owned by the requested billing account.
+   * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + @java.lang.Override + public com.google.cloud.billing.budgets.v1.Budget getBudgets(int index) { + return budgets_.get(index); + } + /** + * + * + *
+   * List of the budgets owned by the requested billing account.
+   * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + @java.lang.Override + public com.google.cloud.billing.budgets.v1.BudgetOrBuilder getBudgetsOrBuilder(int index) { + return budgets_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * If not empty, indicates that there may be more budgets that match the
+   * request; this value should be passed in a new `ListBudgetsRequest`.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + @java.lang.Override + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * If not empty, indicates that there may be more budgets that match the
+   * request; this value should be passed in a new `ListBudgetsRequest`.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < budgets_.size(); i++) { + output.writeMessage(1, budgets_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < budgets_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, budgets_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1.ListBudgetsResponse)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1.ListBudgetsResponse other = + (com.google.cloud.billing.budgets.v1.ListBudgetsResponse) obj; + + if (!getBudgetsList().equals(other.getBudgetsList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getBudgetsCount() > 0) { + hash = (37 * hash) + BUDGETS_FIELD_NUMBER; + hash = (53 * hash) + getBudgetsList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.billing.budgets.v1.ListBudgetsResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response for ListBudgets
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.ListBudgetsResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1.ListBudgetsResponse) + com.google.cloud.billing.budgets.v1.ListBudgetsResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_ListBudgetsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_ListBudgetsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.ListBudgetsResponse.class, + com.google.cloud.billing.budgets.v1.ListBudgetsResponse.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1.ListBudgetsResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getBudgetsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (budgetsBuilder_ == null) { + budgets_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + budgetsBuilder_.clear(); + } + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_ListBudgetsResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.ListBudgetsResponse getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1.ListBudgetsResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.ListBudgetsResponse build() { + com.google.cloud.billing.budgets.v1.ListBudgetsResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.ListBudgetsResponse buildPartial() { + com.google.cloud.billing.budgets.v1.ListBudgetsResponse result = + new com.google.cloud.billing.budgets.v1.ListBudgetsResponse(this); + int from_bitField0_ = bitField0_; + if (budgetsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + budgets_ = java.util.Collections.unmodifiableList(budgets_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.budgets_ = budgets_; + } else { + result.budgets_ = budgetsBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1.ListBudgetsResponse) { + return mergeFrom((com.google.cloud.billing.budgets.v1.ListBudgetsResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1.ListBudgetsResponse other) { + if (other == com.google.cloud.billing.budgets.v1.ListBudgetsResponse.getDefaultInstance()) + return this; + if (budgetsBuilder_ == null) { + if (!other.budgets_.isEmpty()) { + if (budgets_.isEmpty()) { + budgets_ = other.budgets_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureBudgetsIsMutable(); + budgets_.addAll(other.budgets_); + } + onChanged(); + } + } else { + if (!other.budgets_.isEmpty()) { + if (budgetsBuilder_.isEmpty()) { + budgetsBuilder_.dispose(); + budgetsBuilder_ = null; + budgets_ = other.budgets_; + bitField0_ = (bitField0_ & ~0x00000001); + budgetsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getBudgetsFieldBuilder() + : null; + } else { + budgetsBuilder_.addAllMessages(other.budgets_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1.ListBudgetsResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.budgets.v1.ListBudgetsResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List budgets_ = + java.util.Collections.emptyList(); + + private void ensureBudgetsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + budgets_ = new java.util.ArrayList(budgets_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.budgets.v1.Budget, + com.google.cloud.billing.budgets.v1.Budget.Builder, + com.google.cloud.billing.budgets.v1.BudgetOrBuilder> + budgetsBuilder_; + + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + public java.util.List getBudgetsList() { + if (budgetsBuilder_ == null) { + return java.util.Collections.unmodifiableList(budgets_); + } else { + return budgetsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + public int getBudgetsCount() { + if (budgetsBuilder_ == null) { + return budgets_.size(); + } else { + return budgetsBuilder_.getCount(); + } + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + public com.google.cloud.billing.budgets.v1.Budget getBudgets(int index) { + if (budgetsBuilder_ == null) { + return budgets_.get(index); + } else { + return budgetsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + public Builder setBudgets(int index, com.google.cloud.billing.budgets.v1.Budget value) { + if (budgetsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureBudgetsIsMutable(); + budgets_.set(index, value); + onChanged(); + } else { + budgetsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + public Builder setBudgets( + int index, com.google.cloud.billing.budgets.v1.Budget.Builder builderForValue) { + if (budgetsBuilder_ == null) { + ensureBudgetsIsMutable(); + budgets_.set(index, builderForValue.build()); + onChanged(); + } else { + budgetsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + public Builder addBudgets(com.google.cloud.billing.budgets.v1.Budget value) { + if (budgetsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureBudgetsIsMutable(); + budgets_.add(value); + onChanged(); + } else { + budgetsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + public Builder addBudgets(int index, com.google.cloud.billing.budgets.v1.Budget value) { + if (budgetsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureBudgetsIsMutable(); + budgets_.add(index, value); + onChanged(); + } else { + budgetsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + public Builder addBudgets(com.google.cloud.billing.budgets.v1.Budget.Builder builderForValue) { + if (budgetsBuilder_ == null) { + ensureBudgetsIsMutable(); + budgets_.add(builderForValue.build()); + onChanged(); + } else { + budgetsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + public Builder addBudgets( + int index, com.google.cloud.billing.budgets.v1.Budget.Builder builderForValue) { + if (budgetsBuilder_ == null) { + ensureBudgetsIsMutable(); + budgets_.add(index, builderForValue.build()); + onChanged(); + } else { + budgetsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + public Builder addAllBudgets( + java.lang.Iterable values) { + if (budgetsBuilder_ == null) { + ensureBudgetsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, budgets_); + onChanged(); + } else { + budgetsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + public Builder clearBudgets() { + if (budgetsBuilder_ == null) { + budgets_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + budgetsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + public Builder removeBudgets(int index) { + if (budgetsBuilder_ == null) { + ensureBudgetsIsMutable(); + budgets_.remove(index); + onChanged(); + } else { + budgetsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + public com.google.cloud.billing.budgets.v1.Budget.Builder getBudgetsBuilder(int index) { + return getBudgetsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + public com.google.cloud.billing.budgets.v1.BudgetOrBuilder getBudgetsOrBuilder(int index) { + if (budgetsBuilder_ == null) { + return budgets_.get(index); + } else { + return budgetsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + public java.util.List + getBudgetsOrBuilderList() { + if (budgetsBuilder_ != null) { + return budgetsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(budgets_); + } + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + public com.google.cloud.billing.budgets.v1.Budget.Builder addBudgetsBuilder() { + return getBudgetsFieldBuilder() + .addBuilder(com.google.cloud.billing.budgets.v1.Budget.getDefaultInstance()); + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + public com.google.cloud.billing.budgets.v1.Budget.Builder addBudgetsBuilder(int index) { + return getBudgetsFieldBuilder() + .addBuilder(index, com.google.cloud.billing.budgets.v1.Budget.getDefaultInstance()); + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + public java.util.List + getBudgetsBuilderList() { + return getBudgetsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.budgets.v1.Budget, + com.google.cloud.billing.budgets.v1.Budget.Builder, + com.google.cloud.billing.budgets.v1.BudgetOrBuilder> + getBudgetsFieldBuilder() { + if (budgetsBuilder_ == null) { + budgetsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.budgets.v1.Budget, + com.google.cloud.billing.budgets.v1.Budget.Builder, + com.google.cloud.billing.budgets.v1.BudgetOrBuilder>( + budgets_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + budgets_ = null; + } + return budgetsBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * If not empty, indicates that there may be more budgets that match the
+     * request; this value should be passed in a new `ListBudgetsRequest`.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * If not empty, indicates that there may be more budgets that match the
+     * request; this value should be passed in a new `ListBudgetsRequest`.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * If not empty, indicates that there may be more budgets that match the
+     * request; this value should be passed in a new `ListBudgetsRequest`.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If not empty, indicates that there may be more budgets that match the
+     * request; this value should be passed in a new `ListBudgetsRequest`.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * If not empty, indicates that there may be more budgets that match the
+     * request; this value should be passed in a new `ListBudgetsRequest`.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1.ListBudgetsResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1.ListBudgetsResponse) + private static final com.google.cloud.billing.budgets.v1.ListBudgetsResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1.ListBudgetsResponse(); + } + + public static com.google.cloud.billing.budgets.v1.ListBudgetsResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListBudgetsResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListBudgetsResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.ListBudgetsResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ListBudgetsResponseOrBuilder.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ListBudgetsResponseOrBuilder.java new file mode 100644 index 00000000..c8d7a07f --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ListBudgetsResponseOrBuilder.java @@ -0,0 +1,104 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_service.proto + +package com.google.cloud.billing.budgets.v1; + +public interface ListBudgetsResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1.ListBudgetsResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * List of the budgets owned by the requested billing account.
+   * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + java.util.List getBudgetsList(); + /** + * + * + *
+   * List of the budgets owned by the requested billing account.
+   * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + com.google.cloud.billing.budgets.v1.Budget getBudgets(int index); + /** + * + * + *
+   * List of the budgets owned by the requested billing account.
+   * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + int getBudgetsCount(); + /** + * + * + *
+   * List of the budgets owned by the requested billing account.
+   * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + java.util.List + getBudgetsOrBuilderList(); + /** + * + * + *
+   * List of the budgets owned by the requested billing account.
+   * 
+ * + * repeated .google.cloud.billing.budgets.v1.Budget budgets = 1; + */ + com.google.cloud.billing.budgets.v1.BudgetOrBuilder getBudgetsOrBuilder(int index); + + /** + * + * + *
+   * If not empty, indicates that there may be more budgets that match the
+   * request; this value should be passed in a new `ListBudgetsRequest`.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * If not empty, indicates that there may be more budgets that match the
+   * request; this value should be passed in a new `ListBudgetsRequest`.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/NotificationsRule.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/NotificationsRule.java new file mode 100644 index 00000000..d919fe57 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/NotificationsRule.java @@ -0,0 +1,1410 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_model.proto + +package com.google.cloud.billing.budgets.v1; + +/** + * + * + *
+ * NotificationsRule defines notifications that are sent based on budget spend
+ * and thresholds.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.NotificationsRule} + */ +public final class NotificationsRule extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1.NotificationsRule) + NotificationsRuleOrBuilder { + private static final long serialVersionUID = 0L; + // Use NotificationsRule.newBuilder() to construct. + private NotificationsRule(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private NotificationsRule() { + pubsubTopic_ = ""; + schemaVersion_ = ""; + monitoringNotificationChannels_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new NotificationsRule(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private NotificationsRule( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + pubsubTopic_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + schemaVersion_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + monitoringNotificationChannels_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + monitoringNotificationChannels_.add(s); + break; + } + case 32: + { + disableDefaultIamRecipients_ = input.readBool(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + monitoringNotificationChannels_ = monitoringNotificationChannels_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_NotificationsRule_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_NotificationsRule_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.NotificationsRule.class, + com.google.cloud.billing.budgets.v1.NotificationsRule.Builder.class); + } + + public static final int PUBSUB_TOPIC_FIELD_NUMBER = 1; + private volatile java.lang.Object pubsubTopic_; + /** + * + * + *
+   * Optional. The name of the Pub/Sub topic where budget related messages will
+   * be published, in the form `projects/{project_id}/topics/{topic_id}`.
+   * Updates are sent at regular intervals to the topic. The topic needs to be
+   * created before the budget is created; see
+   * https://cloud.google.com/billing/docs/how-to/budgets#manage-notifications
+   * for more details.
+   * Caller is expected to have
+   * `pubsub.topics.setIamPolicy` permission on the topic when it's set for a
+   * budget, otherwise, the API call will fail with PERMISSION_DENIED. See
+   * https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications
+   * for more details on Pub/Sub roles and permissions.
+   * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pubsubTopic. + */ + @java.lang.Override + public java.lang.String getPubsubTopic() { + java.lang.Object ref = pubsubTopic_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pubsubTopic_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. The name of the Pub/Sub topic where budget related messages will
+   * be published, in the form `projects/{project_id}/topics/{topic_id}`.
+   * Updates are sent at regular intervals to the topic. The topic needs to be
+   * created before the budget is created; see
+   * https://cloud.google.com/billing/docs/how-to/budgets#manage-notifications
+   * for more details.
+   * Caller is expected to have
+   * `pubsub.topics.setIamPolicy` permission on the topic when it's set for a
+   * budget, otherwise, the API call will fail with PERMISSION_DENIED. See
+   * https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications
+   * for more details on Pub/Sub roles and permissions.
+   * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pubsubTopic. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPubsubTopicBytes() { + java.lang.Object ref = pubsubTopic_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pubsubTopic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SCHEMA_VERSION_FIELD_NUMBER = 2; + private volatile java.lang.Object schemaVersion_; + /** + * + * + *
+   * Optional. The schema version of the notification sent to `pubsub_topic`.
+   * Only "1.0" is accepted. It represents the JSON schema as defined in
+   * https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#notification_format
+   * 
+ * + * string schema_version = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The schemaVersion. + */ + @java.lang.Override + public java.lang.String getSchemaVersion() { + java.lang.Object ref = schemaVersion_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + schemaVersion_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. The schema version of the notification sent to `pubsub_topic`.
+   * Only "1.0" is accepted. It represents the JSON schema as defined in
+   * https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#notification_format
+   * 
+ * + * string schema_version = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for schemaVersion. + */ + @java.lang.Override + public com.google.protobuf.ByteString getSchemaVersionBytes() { + java.lang.Object ref = schemaVersion_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + schemaVersion_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int MONITORING_NOTIFICATION_CHANNELS_FIELD_NUMBER = 3; + private com.google.protobuf.LazyStringList monitoringNotificationChannels_; + /** + * + * + *
+   * Optional. Targets to send notifications to when a threshold is exceeded.
+   * This is in addition to default recipients who have billing account IAM
+   * roles. The value is the full REST resource name of a monitoring
+   * notification channel with the form
+   * `projects/{project_id}/notificationChannels/{channel_id}`. A maximum of 5
+   * channels are allowed. See
+   * https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients
+   * for more details.
+   * 
+ * + * + * repeated string monitoring_notification_channels = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return A list containing the monitoringNotificationChannels. + */ + public com.google.protobuf.ProtocolStringList getMonitoringNotificationChannelsList() { + return monitoringNotificationChannels_; + } + /** + * + * + *
+   * Optional. Targets to send notifications to when a threshold is exceeded.
+   * This is in addition to default recipients who have billing account IAM
+   * roles. The value is the full REST resource name of a monitoring
+   * notification channel with the form
+   * `projects/{project_id}/notificationChannels/{channel_id}`. A maximum of 5
+   * channels are allowed. See
+   * https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients
+   * for more details.
+   * 
+ * + * + * repeated string monitoring_notification_channels = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The count of monitoringNotificationChannels. + */ + public int getMonitoringNotificationChannelsCount() { + return monitoringNotificationChannels_.size(); + } + /** + * + * + *
+   * Optional. Targets to send notifications to when a threshold is exceeded.
+   * This is in addition to default recipients who have billing account IAM
+   * roles. The value is the full REST resource name of a monitoring
+   * notification channel with the form
+   * `projects/{project_id}/notificationChannels/{channel_id}`. A maximum of 5
+   * channels are allowed. See
+   * https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients
+   * for more details.
+   * 
+ * + * + * repeated string monitoring_notification_channels = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index of the element to return. + * @return The monitoringNotificationChannels at the given index. + */ + public java.lang.String getMonitoringNotificationChannels(int index) { + return monitoringNotificationChannels_.get(index); + } + /** + * + * + *
+   * Optional. Targets to send notifications to when a threshold is exceeded.
+   * This is in addition to default recipients who have billing account IAM
+   * roles. The value is the full REST resource name of a monitoring
+   * notification channel with the form
+   * `projects/{project_id}/notificationChannels/{channel_id}`. A maximum of 5
+   * channels are allowed. See
+   * https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients
+   * for more details.
+   * 
+ * + * + * repeated string monitoring_notification_channels = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index of the value to return. + * @return The bytes of the monitoringNotificationChannels at the given index. + */ + public com.google.protobuf.ByteString getMonitoringNotificationChannelsBytes(int index) { + return monitoringNotificationChannels_.getByteString(index); + } + + public static final int DISABLE_DEFAULT_IAM_RECIPIENTS_FIELD_NUMBER = 4; + private boolean disableDefaultIamRecipients_; + /** + * + * + *
+   * Optional. When set to true, disables default notifications sent when a
+   * threshold is exceeded. Default notifications are sent to those with Billing
+   * Account Administrator and Billing Account User IAM roles for the target
+   * account.
+   * 
+ * + * bool disable_default_iam_recipients = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The disableDefaultIamRecipients. + */ + @java.lang.Override + public boolean getDisableDefaultIamRecipients() { + return disableDefaultIamRecipients_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getPubsubTopicBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, pubsubTopic_); + } + if (!getSchemaVersionBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, schemaVersion_); + } + for (int i = 0; i < monitoringNotificationChannels_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString( + output, 3, monitoringNotificationChannels_.getRaw(i)); + } + if (disableDefaultIamRecipients_ != false) { + output.writeBool(4, disableDefaultIamRecipients_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getPubsubTopicBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, pubsubTopic_); + } + if (!getSchemaVersionBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, schemaVersion_); + } + { + int dataSize = 0; + for (int i = 0; i < monitoringNotificationChannels_.size(); i++) { + dataSize += computeStringSizeNoTag(monitoringNotificationChannels_.getRaw(i)); + } + size += dataSize; + size += 1 * getMonitoringNotificationChannelsList().size(); + } + if (disableDefaultIamRecipients_ != false) { + size += + com.google.protobuf.CodedOutputStream.computeBoolSize(4, disableDefaultIamRecipients_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1.NotificationsRule)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1.NotificationsRule other = + (com.google.cloud.billing.budgets.v1.NotificationsRule) obj; + + if (!getPubsubTopic().equals(other.getPubsubTopic())) return false; + if (!getSchemaVersion().equals(other.getSchemaVersion())) return false; + if (!getMonitoringNotificationChannelsList() + .equals(other.getMonitoringNotificationChannelsList())) return false; + if (getDisableDefaultIamRecipients() != other.getDisableDefaultIamRecipients()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PUBSUB_TOPIC_FIELD_NUMBER; + hash = (53 * hash) + getPubsubTopic().hashCode(); + hash = (37 * hash) + SCHEMA_VERSION_FIELD_NUMBER; + hash = (53 * hash) + getSchemaVersion().hashCode(); + if (getMonitoringNotificationChannelsCount() > 0) { + hash = (37 * hash) + MONITORING_NOTIFICATION_CHANNELS_FIELD_NUMBER; + hash = (53 * hash) + getMonitoringNotificationChannelsList().hashCode(); + } + hash = (37 * hash) + DISABLE_DEFAULT_IAM_RECIPIENTS_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getDisableDefaultIamRecipients()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1.NotificationsRule parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.NotificationsRule parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.NotificationsRule parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.NotificationsRule parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.NotificationsRule parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.NotificationsRule parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.NotificationsRule parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.NotificationsRule parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.NotificationsRule parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.NotificationsRule parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.NotificationsRule parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.NotificationsRule parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.billing.budgets.v1.NotificationsRule prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * NotificationsRule defines notifications that are sent based on budget spend
+   * and thresholds.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.NotificationsRule} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1.NotificationsRule) + com.google.cloud.billing.budgets.v1.NotificationsRuleOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_NotificationsRule_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_NotificationsRule_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.NotificationsRule.class, + com.google.cloud.billing.budgets.v1.NotificationsRule.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1.NotificationsRule.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + pubsubTopic_ = ""; + + schemaVersion_ = ""; + + monitoringNotificationChannels_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + disableDefaultIamRecipients_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_NotificationsRule_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.NotificationsRule getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1.NotificationsRule.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.NotificationsRule build() { + com.google.cloud.billing.budgets.v1.NotificationsRule result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.NotificationsRule buildPartial() { + com.google.cloud.billing.budgets.v1.NotificationsRule result = + new com.google.cloud.billing.budgets.v1.NotificationsRule(this); + int from_bitField0_ = bitField0_; + result.pubsubTopic_ = pubsubTopic_; + result.schemaVersion_ = schemaVersion_; + if (((bitField0_ & 0x00000001) != 0)) { + monitoringNotificationChannels_ = monitoringNotificationChannels_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.monitoringNotificationChannels_ = monitoringNotificationChannels_; + result.disableDefaultIamRecipients_ = disableDefaultIamRecipients_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1.NotificationsRule) { + return mergeFrom((com.google.cloud.billing.budgets.v1.NotificationsRule) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1.NotificationsRule other) { + if (other == com.google.cloud.billing.budgets.v1.NotificationsRule.getDefaultInstance()) + return this; + if (!other.getPubsubTopic().isEmpty()) { + pubsubTopic_ = other.pubsubTopic_; + onChanged(); + } + if (!other.getSchemaVersion().isEmpty()) { + schemaVersion_ = other.schemaVersion_; + onChanged(); + } + if (!other.monitoringNotificationChannels_.isEmpty()) { + if (monitoringNotificationChannels_.isEmpty()) { + monitoringNotificationChannels_ = other.monitoringNotificationChannels_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureMonitoringNotificationChannelsIsMutable(); + monitoringNotificationChannels_.addAll(other.monitoringNotificationChannels_); + } + onChanged(); + } + if (other.getDisableDefaultIamRecipients() != false) { + setDisableDefaultIamRecipients(other.getDisableDefaultIamRecipients()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1.NotificationsRule parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.budgets.v1.NotificationsRule) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object pubsubTopic_ = ""; + /** + * + * + *
+     * Optional. The name of the Pub/Sub topic where budget related messages will
+     * be published, in the form `projects/{project_id}/topics/{topic_id}`.
+     * Updates are sent at regular intervals to the topic. The topic needs to be
+     * created before the budget is created; see
+     * https://cloud.google.com/billing/docs/how-to/budgets#manage-notifications
+     * for more details.
+     * Caller is expected to have
+     * `pubsub.topics.setIamPolicy` permission on the topic when it's set for a
+     * budget, otherwise, the API call will fail with PERMISSION_DENIED. See
+     * https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications
+     * for more details on Pub/Sub roles and permissions.
+     * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pubsubTopic. + */ + public java.lang.String getPubsubTopic() { + java.lang.Object ref = pubsubTopic_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pubsubTopic_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. The name of the Pub/Sub topic where budget related messages will
+     * be published, in the form `projects/{project_id}/topics/{topic_id}`.
+     * Updates are sent at regular intervals to the topic. The topic needs to be
+     * created before the budget is created; see
+     * https://cloud.google.com/billing/docs/how-to/budgets#manage-notifications
+     * for more details.
+     * Caller is expected to have
+     * `pubsub.topics.setIamPolicy` permission on the topic when it's set for a
+     * budget, otherwise, the API call will fail with PERMISSION_DENIED. See
+     * https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications
+     * for more details on Pub/Sub roles and permissions.
+     * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pubsubTopic. + */ + public com.google.protobuf.ByteString getPubsubTopicBytes() { + java.lang.Object ref = pubsubTopic_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pubsubTopic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. The name of the Pub/Sub topic where budget related messages will
+     * be published, in the form `projects/{project_id}/topics/{topic_id}`.
+     * Updates are sent at regular intervals to the topic. The topic needs to be
+     * created before the budget is created; see
+     * https://cloud.google.com/billing/docs/how-to/budgets#manage-notifications
+     * for more details.
+     * Caller is expected to have
+     * `pubsub.topics.setIamPolicy` permission on the topic when it's set for a
+     * budget, otherwise, the API call will fail with PERMISSION_DENIED. See
+     * https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications
+     * for more details on Pub/Sub roles and permissions.
+     * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The pubsubTopic to set. + * @return This builder for chaining. + */ + public Builder setPubsubTopic(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pubsubTopic_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The name of the Pub/Sub topic where budget related messages will
+     * be published, in the form `projects/{project_id}/topics/{topic_id}`.
+     * Updates are sent at regular intervals to the topic. The topic needs to be
+     * created before the budget is created; see
+     * https://cloud.google.com/billing/docs/how-to/budgets#manage-notifications
+     * for more details.
+     * Caller is expected to have
+     * `pubsub.topics.setIamPolicy` permission on the topic when it's set for a
+     * budget, otherwise, the API call will fail with PERMISSION_DENIED. See
+     * https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications
+     * for more details on Pub/Sub roles and permissions.
+     * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPubsubTopic() { + + pubsubTopic_ = getDefaultInstance().getPubsubTopic(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The name of the Pub/Sub topic where budget related messages will
+     * be published, in the form `projects/{project_id}/topics/{topic_id}`.
+     * Updates are sent at regular intervals to the topic. The topic needs to be
+     * created before the budget is created; see
+     * https://cloud.google.com/billing/docs/how-to/budgets#manage-notifications
+     * for more details.
+     * Caller is expected to have
+     * `pubsub.topics.setIamPolicy` permission on the topic when it's set for a
+     * budget, otherwise, the API call will fail with PERMISSION_DENIED. See
+     * https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications
+     * for more details on Pub/Sub roles and permissions.
+     * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for pubsubTopic to set. + * @return This builder for chaining. + */ + public Builder setPubsubTopicBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pubsubTopic_ = value; + onChanged(); + return this; + } + + private java.lang.Object schemaVersion_ = ""; + /** + * + * + *
+     * Optional. The schema version of the notification sent to `pubsub_topic`.
+     * Only "1.0" is accepted. It represents the JSON schema as defined in
+     * https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#notification_format
+     * 
+ * + * string schema_version = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The schemaVersion. + */ + public java.lang.String getSchemaVersion() { + java.lang.Object ref = schemaVersion_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + schemaVersion_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. The schema version of the notification sent to `pubsub_topic`.
+     * Only "1.0" is accepted. It represents the JSON schema as defined in
+     * https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#notification_format
+     * 
+ * + * string schema_version = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for schemaVersion. + */ + public com.google.protobuf.ByteString getSchemaVersionBytes() { + java.lang.Object ref = schemaVersion_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + schemaVersion_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. The schema version of the notification sent to `pubsub_topic`.
+     * Only "1.0" is accepted. It represents the JSON schema as defined in
+     * https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#notification_format
+     * 
+ * + * string schema_version = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The schemaVersion to set. + * @return This builder for chaining. + */ + public Builder setSchemaVersion(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + schemaVersion_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The schema version of the notification sent to `pubsub_topic`.
+     * Only "1.0" is accepted. It represents the JSON schema as defined in
+     * https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#notification_format
+     * 
+ * + * string schema_version = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearSchemaVersion() { + + schemaVersion_ = getDefaultInstance().getSchemaVersion(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The schema version of the notification sent to `pubsub_topic`.
+     * Only "1.0" is accepted. It represents the JSON schema as defined in
+     * https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#notification_format
+     * 
+ * + * string schema_version = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for schemaVersion to set. + * @return This builder for chaining. + */ + public Builder setSchemaVersionBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + schemaVersion_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList monitoringNotificationChannels_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureMonitoringNotificationChannelsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + monitoringNotificationChannels_ = + new com.google.protobuf.LazyStringArrayList(monitoringNotificationChannels_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * Optional. Targets to send notifications to when a threshold is exceeded.
+     * This is in addition to default recipients who have billing account IAM
+     * roles. The value is the full REST resource name of a monitoring
+     * notification channel with the form
+     * `projects/{project_id}/notificationChannels/{channel_id}`. A maximum of 5
+     * channels are allowed. See
+     * https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients
+     * for more details.
+     * 
+ * + * + * repeated string monitoring_notification_channels = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return A list containing the monitoringNotificationChannels. + */ + public com.google.protobuf.ProtocolStringList getMonitoringNotificationChannelsList() { + return monitoringNotificationChannels_.getUnmodifiableView(); + } + /** + * + * + *
+     * Optional. Targets to send notifications to when a threshold is exceeded.
+     * This is in addition to default recipients who have billing account IAM
+     * roles. The value is the full REST resource name of a monitoring
+     * notification channel with the form
+     * `projects/{project_id}/notificationChannels/{channel_id}`. A maximum of 5
+     * channels are allowed. See
+     * https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients
+     * for more details.
+     * 
+ * + * + * repeated string monitoring_notification_channels = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The count of monitoringNotificationChannels. + */ + public int getMonitoringNotificationChannelsCount() { + return monitoringNotificationChannels_.size(); + } + /** + * + * + *
+     * Optional. Targets to send notifications to when a threshold is exceeded.
+     * This is in addition to default recipients who have billing account IAM
+     * roles. The value is the full REST resource name of a monitoring
+     * notification channel with the form
+     * `projects/{project_id}/notificationChannels/{channel_id}`. A maximum of 5
+     * channels are allowed. See
+     * https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients
+     * for more details.
+     * 
+ * + * + * repeated string monitoring_notification_channels = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index of the element to return. + * @return The monitoringNotificationChannels at the given index. + */ + public java.lang.String getMonitoringNotificationChannels(int index) { + return monitoringNotificationChannels_.get(index); + } + /** + * + * + *
+     * Optional. Targets to send notifications to when a threshold is exceeded.
+     * This is in addition to default recipients who have billing account IAM
+     * roles. The value is the full REST resource name of a monitoring
+     * notification channel with the form
+     * `projects/{project_id}/notificationChannels/{channel_id}`. A maximum of 5
+     * channels are allowed. See
+     * https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients
+     * for more details.
+     * 
+ * + * + * repeated string monitoring_notification_channels = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index of the value to return. + * @return The bytes of the monitoringNotificationChannels at the given index. + */ + public com.google.protobuf.ByteString getMonitoringNotificationChannelsBytes(int index) { + return monitoringNotificationChannels_.getByteString(index); + } + /** + * + * + *
+     * Optional. Targets to send notifications to when a threshold is exceeded.
+     * This is in addition to default recipients who have billing account IAM
+     * roles. The value is the full REST resource name of a monitoring
+     * notification channel with the form
+     * `projects/{project_id}/notificationChannels/{channel_id}`. A maximum of 5
+     * channels are allowed. See
+     * https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients
+     * for more details.
+     * 
+ * + * + * repeated string monitoring_notification_channels = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index to set the value at. + * @param value The monitoringNotificationChannels to set. + * @return This builder for chaining. + */ + public Builder setMonitoringNotificationChannels(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureMonitoringNotificationChannelsIsMutable(); + monitoringNotificationChannels_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Targets to send notifications to when a threshold is exceeded.
+     * This is in addition to default recipients who have billing account IAM
+     * roles. The value is the full REST resource name of a monitoring
+     * notification channel with the form
+     * `projects/{project_id}/notificationChannels/{channel_id}`. A maximum of 5
+     * channels are allowed. See
+     * https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients
+     * for more details.
+     * 
+ * + * + * repeated string monitoring_notification_channels = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The monitoringNotificationChannels to add. + * @return This builder for chaining. + */ + public Builder addMonitoringNotificationChannels(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureMonitoringNotificationChannelsIsMutable(); + monitoringNotificationChannels_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Targets to send notifications to when a threshold is exceeded.
+     * This is in addition to default recipients who have billing account IAM
+     * roles. The value is the full REST resource name of a monitoring
+     * notification channel with the form
+     * `projects/{project_id}/notificationChannels/{channel_id}`. A maximum of 5
+     * channels are allowed. See
+     * https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients
+     * for more details.
+     * 
+ * + * + * repeated string monitoring_notification_channels = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param values The monitoringNotificationChannels to add. + * @return This builder for chaining. + */ + public Builder addAllMonitoringNotificationChannels( + java.lang.Iterable values) { + ensureMonitoringNotificationChannelsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, monitoringNotificationChannels_); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Targets to send notifications to when a threshold is exceeded.
+     * This is in addition to default recipients who have billing account IAM
+     * roles. The value is the full REST resource name of a monitoring
+     * notification channel with the form
+     * `projects/{project_id}/notificationChannels/{channel_id}`. A maximum of 5
+     * channels are allowed. See
+     * https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients
+     * for more details.
+     * 
+ * + * + * repeated string monitoring_notification_channels = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return This builder for chaining. + */ + public Builder clearMonitoringNotificationChannels() { + monitoringNotificationChannels_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Targets to send notifications to when a threshold is exceeded.
+     * This is in addition to default recipients who have billing account IAM
+     * roles. The value is the full REST resource name of a monitoring
+     * notification channel with the form
+     * `projects/{project_id}/notificationChannels/{channel_id}`. A maximum of 5
+     * channels are allowed. See
+     * https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients
+     * for more details.
+     * 
+ * + * + * repeated string monitoring_notification_channels = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The bytes of the monitoringNotificationChannels to add. + * @return This builder for chaining. + */ + public Builder addMonitoringNotificationChannelsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureMonitoringNotificationChannelsIsMutable(); + monitoringNotificationChannels_.add(value); + onChanged(); + return this; + } + + private boolean disableDefaultIamRecipients_; + /** + * + * + *
+     * Optional. When set to true, disables default notifications sent when a
+     * threshold is exceeded. Default notifications are sent to those with Billing
+     * Account Administrator and Billing Account User IAM roles for the target
+     * account.
+     * 
+ * + * bool disable_default_iam_recipients = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The disableDefaultIamRecipients. + */ + @java.lang.Override + public boolean getDisableDefaultIamRecipients() { + return disableDefaultIamRecipients_; + } + /** + * + * + *
+     * Optional. When set to true, disables default notifications sent when a
+     * threshold is exceeded. Default notifications are sent to those with Billing
+     * Account Administrator and Billing Account User IAM roles for the target
+     * account.
+     * 
+ * + * bool disable_default_iam_recipients = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The disableDefaultIamRecipients to set. + * @return This builder for chaining. + */ + public Builder setDisableDefaultIamRecipients(boolean value) { + + disableDefaultIamRecipients_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. When set to true, disables default notifications sent when a
+     * threshold is exceeded. Default notifications are sent to those with Billing
+     * Account Administrator and Billing Account User IAM roles for the target
+     * account.
+     * 
+ * + * bool disable_default_iam_recipients = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return This builder for chaining. + */ + public Builder clearDisableDefaultIamRecipients() { + + disableDefaultIamRecipients_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1.NotificationsRule) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1.NotificationsRule) + private static final com.google.cloud.billing.budgets.v1.NotificationsRule DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1.NotificationsRule(); + } + + public static com.google.cloud.billing.budgets.v1.NotificationsRule getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public NotificationsRule parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new NotificationsRule(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.NotificationsRule getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/NotificationsRuleOrBuilder.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/NotificationsRuleOrBuilder.java new file mode 100644 index 00000000..859463e5 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/NotificationsRuleOrBuilder.java @@ -0,0 +1,202 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_model.proto + +package com.google.cloud.billing.budgets.v1; + +public interface NotificationsRuleOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1.NotificationsRule) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Optional. The name of the Pub/Sub topic where budget related messages will
+   * be published, in the form `projects/{project_id}/topics/{topic_id}`.
+   * Updates are sent at regular intervals to the topic. The topic needs to be
+   * created before the budget is created; see
+   * https://cloud.google.com/billing/docs/how-to/budgets#manage-notifications
+   * for more details.
+   * Caller is expected to have
+   * `pubsub.topics.setIamPolicy` permission on the topic when it's set for a
+   * budget, otherwise, the API call will fail with PERMISSION_DENIED. See
+   * https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications
+   * for more details on Pub/Sub roles and permissions.
+   * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pubsubTopic. + */ + java.lang.String getPubsubTopic(); + /** + * + * + *
+   * Optional. The name of the Pub/Sub topic where budget related messages will
+   * be published, in the form `projects/{project_id}/topics/{topic_id}`.
+   * Updates are sent at regular intervals to the topic. The topic needs to be
+   * created before the budget is created; see
+   * https://cloud.google.com/billing/docs/how-to/budgets#manage-notifications
+   * for more details.
+   * Caller is expected to have
+   * `pubsub.topics.setIamPolicy` permission on the topic when it's set for a
+   * budget, otherwise, the API call will fail with PERMISSION_DENIED. See
+   * https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications
+   * for more details on Pub/Sub roles and permissions.
+   * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pubsubTopic. + */ + com.google.protobuf.ByteString getPubsubTopicBytes(); + + /** + * + * + *
+   * Optional. The schema version of the notification sent to `pubsub_topic`.
+   * Only "1.0" is accepted. It represents the JSON schema as defined in
+   * https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#notification_format
+   * 
+ * + * string schema_version = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The schemaVersion. + */ + java.lang.String getSchemaVersion(); + /** + * + * + *
+   * Optional. The schema version of the notification sent to `pubsub_topic`.
+   * Only "1.0" is accepted. It represents the JSON schema as defined in
+   * https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#notification_format
+   * 
+ * + * string schema_version = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for schemaVersion. + */ + com.google.protobuf.ByteString getSchemaVersionBytes(); + + /** + * + * + *
+   * Optional. Targets to send notifications to when a threshold is exceeded.
+   * This is in addition to default recipients who have billing account IAM
+   * roles. The value is the full REST resource name of a monitoring
+   * notification channel with the form
+   * `projects/{project_id}/notificationChannels/{channel_id}`. A maximum of 5
+   * channels are allowed. See
+   * https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients
+   * for more details.
+   * 
+ * + * + * repeated string monitoring_notification_channels = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return A list containing the monitoringNotificationChannels. + */ + java.util.List getMonitoringNotificationChannelsList(); + /** + * + * + *
+   * Optional. Targets to send notifications to when a threshold is exceeded.
+   * This is in addition to default recipients who have billing account IAM
+   * roles. The value is the full REST resource name of a monitoring
+   * notification channel with the form
+   * `projects/{project_id}/notificationChannels/{channel_id}`. A maximum of 5
+   * channels are allowed. See
+   * https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients
+   * for more details.
+   * 
+ * + * + * repeated string monitoring_notification_channels = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The count of monitoringNotificationChannels. + */ + int getMonitoringNotificationChannelsCount(); + /** + * + * + *
+   * Optional. Targets to send notifications to when a threshold is exceeded.
+   * This is in addition to default recipients who have billing account IAM
+   * roles. The value is the full REST resource name of a monitoring
+   * notification channel with the form
+   * `projects/{project_id}/notificationChannels/{channel_id}`. A maximum of 5
+   * channels are allowed. See
+   * https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients
+   * for more details.
+   * 
+ * + * + * repeated string monitoring_notification_channels = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index of the element to return. + * @return The monitoringNotificationChannels at the given index. + */ + java.lang.String getMonitoringNotificationChannels(int index); + /** + * + * + *
+   * Optional. Targets to send notifications to when a threshold is exceeded.
+   * This is in addition to default recipients who have billing account IAM
+   * roles. The value is the full REST resource name of a monitoring
+   * notification channel with the form
+   * `projects/{project_id}/notificationChannels/{channel_id}`. A maximum of 5
+   * channels are allowed. See
+   * https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients
+   * for more details.
+   * 
+ * + * + * repeated string monitoring_notification_channels = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param index The index of the value to return. + * @return The bytes of the monitoringNotificationChannels at the given index. + */ + com.google.protobuf.ByteString getMonitoringNotificationChannelsBytes(int index); + + /** + * + * + *
+   * Optional. When set to true, disables default notifications sent when a
+   * threshold is exceeded. Default notifications are sent to those with Billing
+   * Account Administrator and Billing Account User IAM roles for the target
+   * account.
+   * 
+ * + * bool disable_default_iam_recipients = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The disableDefaultIamRecipients. + */ + boolean getDisableDefaultIamRecipients(); +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ThresholdRule.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ThresholdRule.java new file mode 100644 index 00000000..1e16b806 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ThresholdRule.java @@ -0,0 +1,909 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_model.proto + +package com.google.cloud.billing.budgets.v1; + +/** + * + * + *
+ * ThresholdRule contains a definition of a threshold which triggers
+ * an alert (a notification of a threshold being crossed) to be sent when
+ * spend goes above the specified amount.
+ * Alerts are automatically e-mailed to users with the Billing Account
+ * Administrator role or the Billing Account User role.
+ * The thresholds here have no effect on notifications sent to anything
+ * configured under `Budget.all_updates_rule`.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.ThresholdRule} + */ +public final class ThresholdRule extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1.ThresholdRule) + ThresholdRuleOrBuilder { + private static final long serialVersionUID = 0L; + // Use ThresholdRule.newBuilder() to construct. + private ThresholdRule(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ThresholdRule() { + spendBasis_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ThresholdRule(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ThresholdRule( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 9: + { + thresholdPercent_ = input.readDouble(); + break; + } + case 16: + { + int rawValue = input.readEnum(); + + spendBasis_ = rawValue; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_ThresholdRule_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_ThresholdRule_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.ThresholdRule.class, + com.google.cloud.billing.budgets.v1.ThresholdRule.Builder.class); + } + + /** + * + * + *
+   * The type of basis used to determine if spend has passed the threshold.
+   * 
+ * + * Protobuf enum {@code google.cloud.billing.budgets.v1.ThresholdRule.Basis} + */ + public enum Basis implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Unspecified threshold basis.
+     * 
+ * + * BASIS_UNSPECIFIED = 0; + */ + BASIS_UNSPECIFIED(0), + /** + * + * + *
+     * Use current spend as the basis for comparison against the threshold.
+     * 
+ * + * CURRENT_SPEND = 1; + */ + CURRENT_SPEND(1), + /** + * + * + *
+     * Use forecasted spend for the period as the basis for comparison against
+     * the threshold.
+     * 
+ * + * FORECASTED_SPEND = 2; + */ + FORECASTED_SPEND(2), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Unspecified threshold basis.
+     * 
+ * + * BASIS_UNSPECIFIED = 0; + */ + public static final int BASIS_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * Use current spend as the basis for comparison against the threshold.
+     * 
+ * + * CURRENT_SPEND = 1; + */ + public static final int CURRENT_SPEND_VALUE = 1; + /** + * + * + *
+     * Use forecasted spend for the period as the basis for comparison against
+     * the threshold.
+     * 
+ * + * FORECASTED_SPEND = 2; + */ + public static final int FORECASTED_SPEND_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static Basis valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static Basis forNumber(int value) { + switch (value) { + case 0: + return BASIS_UNSPECIFIED; + case 1: + return CURRENT_SPEND; + case 2: + return FORECASTED_SPEND; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public Basis findValueByNumber(int number) { + return Basis.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.ThresholdRule.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final Basis[] VALUES = values(); + + public static Basis valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private Basis(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.billing.budgets.v1.ThresholdRule.Basis) + } + + public static final int THRESHOLD_PERCENT_FIELD_NUMBER = 1; + private double thresholdPercent_; + /** + * + * + *
+   * 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]; + * + * @return The thresholdPercent. + */ + @java.lang.Override + public double getThresholdPercent() { + return thresholdPercent_; + } + + public static final int SPEND_BASIS_FIELD_NUMBER = 2; + private int spendBasis_; + /** + * + * + *
+   * 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]; + * + * + * @return The enum numeric value on the wire for spendBasis. + */ + @java.lang.Override + public int getSpendBasisValue() { + return spendBasis_; + } + /** + * + * + *
+   * 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]; + * + * + * @return The spendBasis. + */ + @java.lang.Override + public com.google.cloud.billing.budgets.v1.ThresholdRule.Basis getSpendBasis() { + @SuppressWarnings("deprecation") + com.google.cloud.billing.budgets.v1.ThresholdRule.Basis result = + com.google.cloud.billing.budgets.v1.ThresholdRule.Basis.valueOf(spendBasis_); + return result == null + ? com.google.cloud.billing.budgets.v1.ThresholdRule.Basis.UNRECOGNIZED + : result; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (thresholdPercent_ != 0D) { + output.writeDouble(1, thresholdPercent_); + } + if (spendBasis_ + != com.google.cloud.billing.budgets.v1.ThresholdRule.Basis.BASIS_UNSPECIFIED.getNumber()) { + output.writeEnum(2, spendBasis_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (thresholdPercent_ != 0D) { + size += com.google.protobuf.CodedOutputStream.computeDoubleSize(1, thresholdPercent_); + } + if (spendBasis_ + != com.google.cloud.billing.budgets.v1.ThresholdRule.Basis.BASIS_UNSPECIFIED.getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, spendBasis_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1.ThresholdRule)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1.ThresholdRule other = + (com.google.cloud.billing.budgets.v1.ThresholdRule) obj; + + if (java.lang.Double.doubleToLongBits(getThresholdPercent()) + != java.lang.Double.doubleToLongBits(other.getThresholdPercent())) return false; + if (spendBasis_ != other.spendBasis_) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + THRESHOLD_PERCENT_FIELD_NUMBER; + hash = + (53 * hash) + + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getThresholdPercent())); + hash = (37 * hash) + SPEND_BASIS_FIELD_NUMBER; + hash = (53 * hash) + spendBasis_; + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1.ThresholdRule parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.ThresholdRule parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.ThresholdRule parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.ThresholdRule parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.ThresholdRule parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.ThresholdRule parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.ThresholdRule parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.ThresholdRule parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.ThresholdRule parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.ThresholdRule parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.ThresholdRule parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.ThresholdRule parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.billing.budgets.v1.ThresholdRule prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * ThresholdRule contains a definition of a threshold which triggers
+   * an alert (a notification of a threshold being crossed) to be sent when
+   * spend goes above the specified amount.
+   * Alerts are automatically e-mailed to users with the Billing Account
+   * Administrator role or the Billing Account User role.
+   * The thresholds here have no effect on notifications sent to anything
+   * configured under `Budget.all_updates_rule`.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.ThresholdRule} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1.ThresholdRule) + com.google.cloud.billing.budgets.v1.ThresholdRuleOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_ThresholdRule_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_ThresholdRule_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.ThresholdRule.class, + com.google.cloud.billing.budgets.v1.ThresholdRule.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1.ThresholdRule.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + thresholdPercent_ = 0D; + + spendBasis_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1.BudgetModelProto + .internal_static_google_cloud_billing_budgets_v1_ThresholdRule_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.ThresholdRule getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1.ThresholdRule.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.ThresholdRule build() { + com.google.cloud.billing.budgets.v1.ThresholdRule result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.ThresholdRule buildPartial() { + com.google.cloud.billing.budgets.v1.ThresholdRule result = + new com.google.cloud.billing.budgets.v1.ThresholdRule(this); + result.thresholdPercent_ = thresholdPercent_; + result.spendBasis_ = spendBasis_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1.ThresholdRule) { + return mergeFrom((com.google.cloud.billing.budgets.v1.ThresholdRule) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1.ThresholdRule other) { + if (other == com.google.cloud.billing.budgets.v1.ThresholdRule.getDefaultInstance()) + return this; + if (other.getThresholdPercent() != 0D) { + setThresholdPercent(other.getThresholdPercent()); + } + if (other.spendBasis_ != 0) { + setSpendBasisValue(other.getSpendBasisValue()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1.ThresholdRule parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.budgets.v1.ThresholdRule) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private double thresholdPercent_; + /** + * + * + *
+     * 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]; + * + * @return The thresholdPercent. + */ + @java.lang.Override + public double getThresholdPercent() { + return thresholdPercent_; + } + /** + * + * + *
+     * 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]; + * + * @param value The thresholdPercent to set. + * @return This builder for chaining. + */ + public Builder setThresholdPercent(double value) { + + thresholdPercent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * 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]; + * + * @return This builder for chaining. + */ + public Builder clearThresholdPercent() { + + thresholdPercent_ = 0D; + onChanged(); + return this; + } + + private int spendBasis_ = 0; + /** + * + * + *
+     * 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]; + * + * + * @return The enum numeric value on the wire for spendBasis. + */ + @java.lang.Override + public int getSpendBasisValue() { + return spendBasis_; + } + /** + * + * + *
+     * 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]; + * + * + * @param value The enum numeric value on the wire for spendBasis to set. + * @return This builder for chaining. + */ + public Builder setSpendBasisValue(int value) { + + spendBasis_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * 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]; + * + * + * @return The spendBasis. + */ + @java.lang.Override + public com.google.cloud.billing.budgets.v1.ThresholdRule.Basis getSpendBasis() { + @SuppressWarnings("deprecation") + com.google.cloud.billing.budgets.v1.ThresholdRule.Basis result = + com.google.cloud.billing.budgets.v1.ThresholdRule.Basis.valueOf(spendBasis_); + return result == null + ? com.google.cloud.billing.budgets.v1.ThresholdRule.Basis.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * 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]; + * + * + * @param value The spendBasis to set. + * @return This builder for chaining. + */ + public Builder setSpendBasis(com.google.cloud.billing.budgets.v1.ThresholdRule.Basis value) { + if (value == null) { + throw new NullPointerException(); + } + + spendBasis_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * 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]; + * + * + * @return This builder for chaining. + */ + public Builder clearSpendBasis() { + + spendBasis_ = 0; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1.ThresholdRule) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1.ThresholdRule) + private static final com.google.cloud.billing.budgets.v1.ThresholdRule DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1.ThresholdRule(); + } + + public static com.google.cloud.billing.budgets.v1.ThresholdRule getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ThresholdRule parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ThresholdRule(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.ThresholdRule getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ThresholdRuleOrBuilder.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ThresholdRuleOrBuilder.java new file mode 100644 index 00000000..45306400 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ThresholdRuleOrBuilder.java @@ -0,0 +1,71 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_model.proto + +package com.google.cloud.billing.budgets.v1; + +public interface ThresholdRuleOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1.ThresholdRule) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * 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]; + * + * @return The thresholdPercent. + */ + double getThresholdPercent(); + + /** + * + * + *
+   * 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]; + * + * + * @return The enum numeric value on the wire for spendBasis. + */ + 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]; + * + * + * @return The spendBasis. + */ + com.google.cloud.billing.budgets.v1.ThresholdRule.Basis getSpendBasis(); +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/UpdateBudgetRequest.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/UpdateBudgetRequest.java new file mode 100644 index 00000000..e8716dab --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/UpdateBudgetRequest.java @@ -0,0 +1,1114 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_service.proto + +package com.google.cloud.billing.budgets.v1; + +/** + * + * + *
+ * Request for UpdateBudget
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.UpdateBudgetRequest} + */ +public final class UpdateBudgetRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1.UpdateBudgetRequest) + UpdateBudgetRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdateBudgetRequest.newBuilder() to construct. + private UpdateBudgetRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdateBudgetRequest() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdateBudgetRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UpdateBudgetRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.billing.budgets.v1.Budget.Builder subBuilder = null; + if (budget_ != null) { + subBuilder = budget_.toBuilder(); + } + budget_ = + input.readMessage( + com.google.cloud.billing.budgets.v1.Budget.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(budget_); + budget_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (updateMask_ != null) { + subBuilder = updateMask_.toBuilder(); + } + updateMask_ = + input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateMask_); + updateMask_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_UpdateBudgetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_UpdateBudgetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.UpdateBudgetRequest.class, + com.google.cloud.billing.budgets.v1.UpdateBudgetRequest.Builder.class); + } + + public static final int BUDGET_FIELD_NUMBER = 1; + private com.google.cloud.billing.budgets.v1.Budget budget_; + /** + * + * + *
+   * Required. The updated budget object.
+   * The budget to update is specified by the budget name in the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the budget field is set. + */ + @java.lang.Override + public boolean hasBudget() { + return budget_ != null; + } + /** + * + * + *
+   * Required. The updated budget object.
+   * The budget to update is specified by the budget name in the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The budget. + */ + @java.lang.Override + public com.google.cloud.billing.budgets.v1.Budget getBudget() { + return budget_ == null + ? com.google.cloud.billing.budgets.v1.Budget.getDefaultInstance() + : budget_; + } + /** + * + * + *
+   * Required. The updated budget object.
+   * The budget to update is specified by the budget name in the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.billing.budgets.v1.BudgetOrBuilder getBudgetOrBuilder() { + return getBudget(); + } + + public static final int UPDATE_MASK_FIELD_NUMBER = 2; + private com.google.protobuf.FieldMask updateMask_; + /** + * + * + *
+   * Optional. Indicates which fields in the provided budget to update.
+   * Read-only fields (such as `name`) cannot be changed. If this is not
+   * provided, then only fields with non-default values from the request are
+   * updated. See
+   * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+   * details about default values.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the updateMask field is set. + */ + @java.lang.Override + public boolean hasUpdateMask() { + return updateMask_ != null; + } + /** + * + * + *
+   * Optional. Indicates which fields in the provided budget to update.
+   * Read-only fields (such as `name`) cannot be changed. If this is not
+   * provided, then only fields with non-default values from the request are
+   * updated. See
+   * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+   * details about default values.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The updateMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getUpdateMask() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + /** + * + * + *
+   * Optional. Indicates which fields in the provided budget to update.
+   * Read-only fields (such as `name`) cannot be changed. If this is not
+   * provided, then only fields with non-default values from the request are
+   * updated. See
+   * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+   * details about default values.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + return getUpdateMask(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (budget_ != null) { + output.writeMessage(1, getBudget()); + } + if (updateMask_ != null) { + output.writeMessage(2, getUpdateMask()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (budget_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getBudget()); + } + if (updateMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateMask()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1.UpdateBudgetRequest)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1.UpdateBudgetRequest other = + (com.google.cloud.billing.budgets.v1.UpdateBudgetRequest) obj; + + if (hasBudget() != other.hasBudget()) return false; + if (hasBudget()) { + if (!getBudget().equals(other.getBudget())) return false; + } + if (hasUpdateMask() != other.hasUpdateMask()) return false; + if (hasUpdateMask()) { + if (!getUpdateMask().equals(other.getUpdateMask())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasBudget()) { + hash = (37 * hash) + BUDGET_FIELD_NUMBER; + hash = (53 * hash) + getBudget().hashCode(); + } + if (hasUpdateMask()) { + hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; + hash = (53 * hash) + getUpdateMask().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1.UpdateBudgetRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.UpdateBudgetRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.UpdateBudgetRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.UpdateBudgetRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.UpdateBudgetRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1.UpdateBudgetRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.UpdateBudgetRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.UpdateBudgetRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.UpdateBudgetRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.UpdateBudgetRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1.UpdateBudgetRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1.UpdateBudgetRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.billing.budgets.v1.UpdateBudgetRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for UpdateBudget
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1.UpdateBudgetRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1.UpdateBudgetRequest) + com.google.cloud.billing.budgets.v1.UpdateBudgetRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_UpdateBudgetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_UpdateBudgetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1.UpdateBudgetRequest.class, + com.google.cloud.billing.budgets.v1.UpdateBudgetRequest.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1.UpdateBudgetRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (budgetBuilder_ == null) { + budget_ = null; + } else { + budget_ = null; + budgetBuilder_ = null; + } + if (updateMaskBuilder_ == null) { + updateMask_ = null; + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1.BudgetServiceProto + .internal_static_google_cloud_billing_budgets_v1_UpdateBudgetRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.UpdateBudgetRequest getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1.UpdateBudgetRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.UpdateBudgetRequest build() { + com.google.cloud.billing.budgets.v1.UpdateBudgetRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.UpdateBudgetRequest buildPartial() { + com.google.cloud.billing.budgets.v1.UpdateBudgetRequest result = + new com.google.cloud.billing.budgets.v1.UpdateBudgetRequest(this); + if (budgetBuilder_ == null) { + result.budget_ = budget_; + } else { + result.budget_ = budgetBuilder_.build(); + } + if (updateMaskBuilder_ == null) { + result.updateMask_ = updateMask_; + } else { + result.updateMask_ = updateMaskBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1.UpdateBudgetRequest) { + return mergeFrom((com.google.cloud.billing.budgets.v1.UpdateBudgetRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1.UpdateBudgetRequest other) { + if (other == com.google.cloud.billing.budgets.v1.UpdateBudgetRequest.getDefaultInstance()) + return this; + if (other.hasBudget()) { + mergeBudget(other.getBudget()); + } + if (other.hasUpdateMask()) { + mergeUpdateMask(other.getUpdateMask()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1.UpdateBudgetRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.budgets.v1.UpdateBudgetRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.billing.budgets.v1.Budget budget_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1.Budget, + com.google.cloud.billing.budgets.v1.Budget.Builder, + com.google.cloud.billing.budgets.v1.BudgetOrBuilder> + budgetBuilder_; + /** + * + * + *
+     * Required. The updated budget object.
+     * The budget to update is specified by the budget name in the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the budget field is set. + */ + public boolean hasBudget() { + return budgetBuilder_ != null || budget_ != null; + } + /** + * + * + *
+     * Required. The updated budget object.
+     * The budget to update is specified by the budget name in the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The budget. + */ + public com.google.cloud.billing.budgets.v1.Budget getBudget() { + if (budgetBuilder_ == null) { + return budget_ == null + ? com.google.cloud.billing.budgets.v1.Budget.getDefaultInstance() + : budget_; + } else { + return budgetBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The updated budget object.
+     * The budget to update is specified by the budget name in the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setBudget(com.google.cloud.billing.budgets.v1.Budget value) { + if (budgetBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + budget_ = value; + onChanged(); + } else { + budgetBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The updated budget object.
+     * The budget to update is specified by the budget name in the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setBudget(com.google.cloud.billing.budgets.v1.Budget.Builder builderForValue) { + if (budgetBuilder_ == null) { + budget_ = builderForValue.build(); + onChanged(); + } else { + budgetBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The updated budget object.
+     * The budget to update is specified by the budget name in the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeBudget(com.google.cloud.billing.budgets.v1.Budget value) { + if (budgetBuilder_ == null) { + if (budget_ != null) { + budget_ = + com.google.cloud.billing.budgets.v1.Budget.newBuilder(budget_) + .mergeFrom(value) + .buildPartial(); + } else { + budget_ = value; + } + onChanged(); + } else { + budgetBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The updated budget object.
+     * The budget to update is specified by the budget name in the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearBudget() { + if (budgetBuilder_ == null) { + budget_ = null; + onChanged(); + } else { + budget_ = null; + budgetBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The updated budget object.
+     * The budget to update is specified by the budget name in the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1.Budget.Builder getBudgetBuilder() { + + onChanged(); + return getBudgetFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The updated budget object.
+     * The budget to update is specified by the budget name in the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1.BudgetOrBuilder getBudgetOrBuilder() { + if (budgetBuilder_ != null) { + return budgetBuilder_.getMessageOrBuilder(); + } else { + return budget_ == null + ? com.google.cloud.billing.budgets.v1.Budget.getDefaultInstance() + : budget_; + } + } + /** + * + * + *
+     * Required. The updated budget object.
+     * The budget to update is specified by the budget name in the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1.Budget, + com.google.cloud.billing.budgets.v1.Budget.Builder, + com.google.cloud.billing.budgets.v1.BudgetOrBuilder> + getBudgetFieldBuilder() { + if (budgetBuilder_ == null) { + budgetBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1.Budget, + com.google.cloud.billing.budgets.v1.Budget.Builder, + com.google.cloud.billing.budgets.v1.BudgetOrBuilder>( + getBudget(), getParentForChildren(), isClean()); + budget_ = null; + } + return budgetBuilder_; + } + + private com.google.protobuf.FieldMask updateMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + updateMaskBuilder_; + /** + * + * + *
+     * Optional. Indicates which fields in the provided budget to update.
+     * Read-only fields (such as `name`) cannot be changed. If this is not
+     * provided, then only fields with non-default values from the request are
+     * updated. See
+     * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+     * details about default values.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the updateMask field is set. + */ + public boolean hasUpdateMask() { + return updateMaskBuilder_ != null || updateMask_ != null; + } + /** + * + * + *
+     * Optional. Indicates which fields in the provided budget to update.
+     * Read-only fields (such as `name`) cannot be changed. If this is not
+     * provided, then only fields with non-default values from the request are
+     * updated. See
+     * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+     * details about default values.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The updateMask. + */ + public com.google.protobuf.FieldMask getUpdateMask() { + if (updateMaskBuilder_ == null) { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } else { + return updateMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Optional. Indicates which fields in the provided budget to update.
+     * Read-only fields (such as `name`) cannot be changed. If this is not
+     * provided, then only fields with non-default values from the request are
+     * updated. See
+     * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+     * details about default values.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateMask_ = value; + onChanged(); + } else { + updateMaskBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Optional. Indicates which fields in the provided budget to update.
+     * Read-only fields (such as `name`) cannot be changed. If this is not
+     * provided, then only fields with non-default values from the request are
+     * updated. See
+     * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+     * details about default values.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + onChanged(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Optional. Indicates which fields in the provided budget to update.
+     * Read-only fields (such as `name`) cannot be changed. If this is not
+     * provided, then only fields with non-default values from the request are
+     * updated. See
+     * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+     * details about default values.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (updateMask_ != null) { + updateMask_ = + com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); + } else { + updateMask_ = value; + } + onChanged(); + } else { + updateMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Optional. Indicates which fields in the provided budget to update.
+     * Read-only fields (such as `name`) cannot be changed. If this is not
+     * provided, then only fields with non-default values from the request are
+     * updated. See
+     * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+     * details about default values.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearUpdateMask() { + if (updateMaskBuilder_ == null) { + updateMask_ = null; + onChanged(); + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Optional. Indicates which fields in the provided budget to update.
+     * Read-only fields (such as `name`) cannot be changed. If this is not
+     * provided, then only fields with non-default values from the request are
+     * updated. See
+     * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+     * details about default values.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional. Indicates which fields in the provided budget to update.
+     * Read-only fields (such as `name`) cannot be changed. If this is not
+     * provided, then only fields with non-default values from the request are
+     * updated. See
+     * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+     * details about default values.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + if (updateMaskBuilder_ != null) { + return updateMaskBuilder_.getMessageOrBuilder(); + } else { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } + } + /** + * + * + *
+     * Optional. Indicates which fields in the provided budget to update.
+     * Read-only fields (such as `name`) cannot be changed. If this is not
+     * provided, then only fields with non-default values from the request are
+     * updated. See
+     * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+     * details about default values.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getUpdateMaskFieldBuilder() { + if (updateMaskBuilder_ == null) { + updateMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getUpdateMask(), getParentForChildren(), isClean()); + updateMask_ = null; + } + return updateMaskBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1.UpdateBudgetRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1.UpdateBudgetRequest) + private static final com.google.cloud.billing.budgets.v1.UpdateBudgetRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1.UpdateBudgetRequest(); + } + + public static com.google.cloud.billing.budgets.v1.UpdateBudgetRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdateBudgetRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UpdateBudgetRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1.UpdateBudgetRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/UpdateBudgetRequestOrBuilder.java b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/UpdateBudgetRequestOrBuilder.java new file mode 100644 index 00000000..8affce90 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/UpdateBudgetRequestOrBuilder.java @@ -0,0 +1,122 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/budgets/v1/budget_service.proto + +package com.google.cloud.billing.budgets.v1; + +public interface UpdateBudgetRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1.UpdateBudgetRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The updated budget object.
+   * The budget to update is specified by the budget name in the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the budget field is set. + */ + boolean hasBudget(); + /** + * + * + *
+   * Required. The updated budget object.
+   * The budget to update is specified by the budget name in the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The budget. + */ + com.google.cloud.billing.budgets.v1.Budget getBudget(); + /** + * + * + *
+   * Required. The updated budget object.
+   * The budget to update is specified by the budget name in the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.billing.budgets.v1.BudgetOrBuilder getBudgetOrBuilder(); + + /** + * + * + *
+   * Optional. Indicates which fields in the provided budget to update.
+   * Read-only fields (such as `name`) cannot be changed. If this is not
+   * provided, then only fields with non-default values from the request are
+   * updated. See
+   * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+   * details about default values.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the updateMask field is set. + */ + boolean hasUpdateMask(); + /** + * + * + *
+   * Optional. Indicates which fields in the provided budget to update.
+   * Read-only fields (such as `name`) cannot be changed. If this is not
+   * provided, then only fields with non-default values from the request are
+   * updated. See
+   * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+   * details about default values.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The updateMask. + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + * + * + *
+   * Optional. Indicates which fields in the provided budget to update.
+   * Read-only fields (such as `name`) cannot be changed. If this is not
+   * provided, then only fields with non-default values from the request are
+   * updated. See
+   * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+   * details about default values.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/proto/google/cloud/billing/budgets/v1/budget_model.proto b/proto-google-cloud-billingbudgets-v1/src/main/proto/google/cloud/billing/budgets/v1/budget_model.proto new file mode 100644 index 00000000..1cbdbd7b --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/proto/google/cloud/billing/budgets/v1/budget_model.proto @@ -0,0 +1,228 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.billing.budgets.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/struct.proto"; +import "google/type/money.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/billing/budgets/v1;budgets"; +option java_multiple_files = true; +option java_outer_classname = "BudgetModelProto"; +option java_package = "com.google.cloud.billing.budgets.v1"; + +// A budget is a plan that describes what you expect to spend on Cloud +// projects, plus the rules to execute as spend is tracked against that plan, +// (for example, send an alert when 90% of the target spend is met). +// Currently all plans are monthly budgets so the usage period(s) tracked are +// implied (calendar months of usage back-to-back). +message Budget { + option (google.api.resource) = { + type: "billingbudgets.googleapis.com/Budget" + pattern: "billingAccounts/{billing_account}/budgets/{budget}" + }; + + // Output only. Resource name of the budget. + // The resource name implies the scope of a budget. Values are of the form + // `billingAccounts/{billingAccountId}/budgets/{budgetId}`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User data for display name in UI. The name must be less than or equal to 60 + // characters. + string display_name = 2; + + // Optional. Filters that define which resources are used to compute + // the actual spend against the budget. + Filter budget_filter = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Budgeted amount. + BudgetAmount amount = 4 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Rules that trigger alerts (notifications of thresholds + // being crossed) when spend exceeds the specified percentages of the budget. + repeated ThresholdRule threshold_rules = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Rules to apply to notifications sent based on budget spend and + // thresholds. + NotificationsRule notifications_rule = 6 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Etag to validate that the object is unchanged for a + // read-modify-write operation. + // An empty etag will cause an update to overwrite other changes. + string etag = 7 [(google.api.field_behavior) = OPTIONAL]; +} + +// The budgeted amount for each usage period. +message BudgetAmount { + // Specification for what amount to use as the budget. + oneof budget_amount { + // A specified amount to use as the budget. + // `currency_code` is optional. If specified, it must match the + // currency of the billing account. The `currency_code` is provided on + // output. + google.type.Money specified_amount = 1; + + // Use the last period's actual spend as the budget for the present period. + LastPeriodAmount last_period_amount = 2; + } +} + +// Describes a budget amount targeted to last period's spend. +// At this time, the amount is automatically 100% of last period's spend; +// that is, there are no other options yet. +// Future configuration will be described here (for example, configuring a +// percentage of last period's spend). +message LastPeriodAmount {} + +// ThresholdRule contains a definition of a threshold which triggers +// an alert (a notification of a threshold being crossed) to be sent when +// spend goes above the specified amount. +// Alerts are automatically e-mailed to users with the Billing Account +// Administrator role or the Billing Account User role. +// The thresholds here have no effect on notifications sent to anything +// configured under `Budget.all_updates_rule`. +message ThresholdRule { + // The type of basis used to determine if spend has passed the threshold. + enum Basis { + // Unspecified threshold basis. + BASIS_UNSPECIFIED = 0; + + // Use current spend as the basis for comparison against the threshold. + CURRENT_SPEND = 1; + + // Use forecasted spend for the period as the basis for comparison against + // the threshold. + FORECASTED_SPEND = 2; + } + + // 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]; + + // Optional. The type of basis used to determine if spend has passed the + // threshold. Behavior defaults to CURRENT_SPEND if not set. + Basis spend_basis = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// NotificationsRule defines notifications that are sent based on budget spend +// and thresholds. +message NotificationsRule { + // Optional. The name of the Pub/Sub topic where budget related messages will + // be published, in the form `projects/{project_id}/topics/{topic_id}`. + // Updates are sent at regular intervals to the topic. The topic needs to be + // created before the budget is created; see + // https://cloud.google.com/billing/docs/how-to/budgets#manage-notifications + // for more details. + // Caller is expected to have + // `pubsub.topics.setIamPolicy` permission on the topic when it's set for a + // budget, otherwise, the API call will fail with PERMISSION_DENIED. See + // https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications + // for more details on Pub/Sub roles and permissions. + string pubsub_topic = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The schema version of the notification sent to `pubsub_topic`. + // Only "1.0" is accepted. It represents the JSON schema as defined in + // https://cloud.google.com/billing/docs/how-to/budgets-programmatic-notifications#notification_format + string schema_version = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Targets to send notifications to when a threshold is exceeded. + // This is in addition to default recipients who have billing account IAM + // roles. The value is the full REST resource name of a monitoring + // notification channel with the form + // `projects/{project_id}/notificationChannels/{channel_id}`. A maximum of 5 + // channels are allowed. See + // https://cloud.google.com/billing/docs/how-to/budgets-notification-recipients + // for more details. + repeated string monitoring_notification_channels = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. When set to true, disables default notifications sent when a + // threshold is exceeded. Default notifications are sent to those with Billing + // Account Administrator and Billing Account User IAM roles for the target + // account. + bool disable_default_iam_recipients = 4 + [(google.api.field_behavior) = OPTIONAL]; +} + +// A filter for a budget, limiting the scope of the cost to calculate. +message Filter { + // Specifies how credits should be treated when determining spend for + // threshold calculations. + enum CreditTypesTreatment { + // This is an invalid value. + CREDIT_TYPES_TREATMENT_UNSPECIFIED = 0; + + // All types of credit are subtracted from the gross cost to determine the + // spend for threshold calculations. + INCLUDE_ALL_CREDITS = 1; + + // All types of credit are added to the net cost to determine the spend for + // threshold calculations. + EXCLUDE_ALL_CREDITS = 2; + + // Credit types specified in the credit_types field are subtracted from the + // gross cost to determine the spend for threshold calculations. + INCLUDE_SPECIFIED_CREDITS = 3; + } + + // Optional. A set of projects of the form `projects/{project}`, + // specifying that usage from only this set of projects should be + // included in the budget. If omitted, the report will include all usage for + // the billing account, regardless of which project the usage occurred on. + // Only zero or one project can be specified currently. + repeated string projects = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A list of credit types to be subtracted from gross cost to + // determine the spend for threshold calculations if and only if + // credit_types_treatment is INCLUDE_SPECIFIED_CREDITS. If + // credit_types_treatment is not INCLUDE_SPECIFIED_CREDITS, this field must be + // empty. See credits.type on + // https://cloud.google.com/billing/docs/how-to/export-data-bigquery-tables#data-schema + // for a list of acceptable credit type values in this field. + repeated string credit_types = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`. + CreditTypesTreatment credit_types_treatment = 4 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A set of services of the form `services/{service_id}`, + // specifying that usage from only this set of services should be + // included in the budget. If omitted, the report will include usage for + // all the services. + // The service names are available through the Catalog API: + // https://cloud.google.com/billing/v1/how-tos/catalog-api. + repeated string services = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A set of subaccounts of the form `billingAccounts/{account_id}`, + // specifying that usage from only this set of subaccounts should be included + // in the budget. If a subaccount is set to the name of the parent account, + // usage from the parent account will be included. If the field is omitted, + // the report will include usage from the parent account and all subaccounts, + // if they exist. + repeated string subaccounts = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A single label and value pair specifying that usage from only + // this set of labeled resources should be included in the budget. Currently, + // multiple entries or multiple values per entry are not allowed. If omitted, + // the report will include all labeled and unlabeled usage. + map labels = 6 + [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/proto-google-cloud-billingbudgets-v1/src/main/proto/google/cloud/billing/budgets/v1/budget_service.proto b/proto-google-cloud-billingbudgets-v1/src/main/proto/google/cloud/billing/budgets/v1/budget_service.proto new file mode 100644 index 00000000..bb2be219 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1/src/main/proto/google/cloud/billing/budgets/v1/budget_service.proto @@ -0,0 +1,182 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.billing.budgets.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/billing/budgets/v1/budget_model.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/billing/budgets/v1;budgets"; +option java_multiple_files = true; +option java_outer_classname = "BudgetServiceProto"; +option java_package = "com.google.cloud.billing.budgets.v1"; + +// BudgetService stores Cloud Billing budgets, which define a +// budget plan and rules to execute as we track spend against that plan. +service BudgetService { + option (google.api.default_host) = "billingbudgets.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-billing," + "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a new budget. See + // [Quotas and limits](https://cloud.google.com/billing/quotas) + // for more information on the limits of the number of budgets you can create. + rpc CreateBudget(CreateBudgetRequest) returns (Budget) { + option (google.api.http) = { + post: "/v1/{parent=billingAccounts/*}/budgets" + body: "budget" + }; + option (google.api.method_signature) = "parent,budget"; + } + + // Updates a budget and returns the updated budget. + // + // WARNING: There are some fields exposed on the Google Cloud Console that + // aren't available on this API. Budget fields that are not exposed in + // this API will not be changed by this method. + rpc UpdateBudget(UpdateBudgetRequest) returns (Budget) { + option (google.api.http) = { + patch: "/v1/{budget.name=billingAccounts/*/budgets/*}" + body: "budget" + }; + option (google.api.method_signature) = "budget,update_mask"; + } + + // Returns a budget. + // + // WARNING: There are some fields exposed on the Google Cloud Console that + // aren't available on this API. When reading from the API, you will not + // see these fields in the return value, though they may have been set + // in the Cloud Console. + rpc GetBudget(GetBudgetRequest) returns (Budget) { + option (google.api.http) = { + get: "/v1/{name=billingAccounts/*/budgets/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Returns a list of budgets for a billing account. + // + // WARNING: There are some fields exposed on the Google Cloud Console that + // aren't available on this API. When reading from the API, you will not + // see these fields in the return value, though they may have been set + // in the Cloud Console. + rpc ListBudgets(ListBudgetsRequest) returns (ListBudgetsResponse) { + option (google.api.http) = { + get: "/v1/{parent=billingAccounts/*}/budgets" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes a budget. Returns successfully if already deleted. + rpc DeleteBudget(DeleteBudgetRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=billingAccounts/*/budgets/*}" + }; + option (google.api.method_signature) = "name"; + } +} + +// Request for CreateBudget +message CreateBudgetRequest { + // Required. The name of the billing account to create the budget in. Values + // are of the form `billingAccounts/{billingAccountId}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "billingbudgets.googleapis.com/Budget" + } + ]; + + // Required. Budget to create. + Budget budget = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for UpdateBudget +message UpdateBudgetRequest { + // Required. The updated budget object. + // The budget to update is specified by the budget name in the budget. + Budget budget = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Indicates which fields in the provided budget to update. + // Read-only fields (such as `name`) cannot be changed. If this is not + // provided, then only fields with non-default values from the request are + // updated. See + // https://developers.google.com/protocol-buffers/docs/proto3#default for more + // details about default values. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for GetBudget +message GetBudgetRequest { + // Required. Name of budget to get. Values are of the form + // `billingAccounts/{billingAccountId}/budgets/{budgetId}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "billingbudgets.googleapis.com/Budget" + } + ]; +} + +// Request for ListBudgets +message ListBudgetsRequest { + // Required. Name of billing account to list budgets under. Values + // are of the form `billingAccounts/{billingAccountId}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "billingbudgets.googleapis.com/Budget" + } + ]; + + // Optional. The maximum number of budgets to return per page. + // The default and maximum value are 100. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The value returned by the last `ListBudgetsResponse` which + // indicates that this is a continuation of a prior `ListBudgets` call, + // and that the system should return the next page of data. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response for ListBudgets +message ListBudgetsResponse { + // List of the budgets owned by the requested billing account. + repeated Budget budgets = 1; + + // If not empty, indicates that there may be more budgets that match the + // request; this value should be passed in a new `ListBudgetsRequest`. + string next_page_token = 2; +} + +// Request for DeleteBudget +message DeleteBudgetRequest { + // Required. Name of the budget to delete. Values are of the form + // `billingAccounts/{billingAccountId}/budgets/{budgetId}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "billingbudgets.googleapis.com/Budget" + } + ]; +} diff --git a/synth.metadata b/synth.metadata index 3af1308b..15abaa5f 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,32 +1,33 @@ { "sources": [ { - "generator": { - "name": "artman", - "version": "2.4.4", - "dockerImage": "googleapis/artman@sha256:0da97ae2ac274adc8ee147fd1eb6736f8186d1684b0f58bce91f4295797a5dcd" + "git": { + "name": ".", + "remote": "git@github.com:googleapis/java-billingbudgets.git", + "sha": "ad03f9f20e9d3ecd5d6d88dadb21a102dae83501" } }, { "git": { - "name": ".", - "remote": "https://github.com/googleapis/java-billingbudgets.git", - "sha": "c3c4dac7202283701b473c72fd3251a991e272b0" + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "f4f491879fdf694fbd0c4a2a6e7628e0e100ddd5", + "internalRef": "339472806" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "921ce41f94a74905ca753c72a4d4cc43600003d3", - "internalRef": "331675651" + "sha": "f4f491879fdf694fbd0c4a2a6e7628e0e100ddd5", + "internalRef": "339472806" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "f68649c5f26bcff6817c6d21e90dac0fc71fef8e" + "sha": "ea52b8a0bd560f72f376efcf45197fb7c8869120" } } ], @@ -39,6 +40,15 @@ "language": "java", "generator": "bazel" } + }, + { + "client": { + "source": "googleapis", + "apiName": "billing-budgets", + "apiVersion": "v1", + "language": "java", + "generator": "bazel" + } } ], "generatedFiles": [ @@ -106,6 +116,13 @@ "CONTRIBUTING.md", "LICENSE", "codecov.yaml", + "google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/BudgetServiceClient.java", + "google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/BudgetServiceSettings.java", + "google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/package-info.java", + "google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/stub/BudgetServiceStub.java", + "google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/stub/BudgetServiceStubSettings.java", + "google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/stub/GrpcBudgetServiceCallableFactory.java", + "google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1/stub/GrpcBudgetServiceStub.java", "google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetServiceClient.java", "google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetServiceSettings.java", "google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/package-info.java", @@ -113,12 +130,46 @@ "google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/stub/BudgetServiceStubSettings.java", "google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/stub/GrpcBudgetServiceCallableFactory.java", "google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/stub/GrpcBudgetServiceStub.java", + "google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1/BudgetServiceClientTest.java", + "google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1/MockBudgetService.java", + "google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1/MockBudgetServiceImpl.java", "google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1beta1/BudgetServiceClientTest.java", "google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1beta1/MockBudgetService.java", "google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1beta1/MockBudgetServiceImpl.java", + "grpc-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetServiceGrpc.java", "grpc-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetServiceGrpc.java", "java.header", "license-checks.xml", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BillingAccountName.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/Budget.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetAmount.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetAmountOrBuilder.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetModelProto.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetName.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetOrBuilder.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/BudgetServiceProto.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/CreateBudgetRequest.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/CreateBudgetRequestOrBuilder.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/DeleteBudgetRequest.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/DeleteBudgetRequestOrBuilder.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/Filter.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/FilterOrBuilder.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/GetBudgetRequest.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/GetBudgetRequestOrBuilder.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/LastPeriodAmount.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/LastPeriodAmountOrBuilder.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ListBudgetsRequest.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ListBudgetsRequestOrBuilder.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ListBudgetsResponse.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ListBudgetsResponseOrBuilder.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/NotificationsRule.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/NotificationsRuleOrBuilder.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ThresholdRule.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/ThresholdRuleOrBuilder.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/UpdateBudgetRequest.java", + "proto-google-cloud-billingbudgets-v1/src/main/java/com/google/cloud/billing/budgets/v1/UpdateBudgetRequestOrBuilder.java", + "proto-google-cloud-billingbudgets-v1/src/main/proto/google/cloud/billing/budgets/v1/budget_model.proto", + "proto-google-cloud-billingbudgets-v1/src/main/proto/google/cloud/billing/budgets/v1/budget_service.proto", "proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/AllUpdatesRule.java", "proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/AllUpdatesRuleOrBuilder.java", "proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BillingAccountName.java", diff --git a/synth.py b/synth.py index 3a96839d..ad3597e0 100644 --- a/synth.py +++ b/synth.py @@ -19,10 +19,8 @@ AUTOSYNTH_MULTIPLE_COMMITS = True -gapic = gcp.GAPICGenerator() - service = 'billing-budgets' -versions = ['v1beta1'] +versions = ['v1beta1', 'v1'] for version in versions: java.bazel_library( diff --git a/versions.txt b/versions.txt index 0d8cd71a..bb4029a4 100644 --- a/versions.txt +++ b/versions.txt @@ -2,5 +2,7 @@ # module:released-version:current-version proto-google-cloud-billingbudgets-v1beta1:0.4.1:0.4.2-SNAPSHOT +proto-google-cloud-billingbudgets-v1:0.4.1:0.4.2-SNAPSHOT grpc-google-cloud-billingbudgets-v1beta1:0.4.1:0.4.2-SNAPSHOT +grpc-google-cloud-billingbudgets-v1:0.4.1:0.4.2-SNAPSHOT google-cloud-billingbudgets:0.4.1:0.4.2-SNAPSHOT