Skip to content
Permalink
Browse files
docs: generate sample code in the Java microgenerator (#381)
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/87b59d0a-bf78-4195-b15b-04bd3003213a/targets

- [ ] To automatically regenerate this PR, check this box.

PiperOrigin-RevId: 356341083
Source-Link: googleapis/googleapis@8d8c008
  • Loading branch information
yoshi-automation committed Feb 9, 2021
1 parent 79785b2 commit 682a5ffe2604e14fa808a5da01d88de9407a36c7
@@ -44,6 +44,14 @@
* <p>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:
*
* <pre>{@code
* try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
* BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
* Budget budget = Budget.newBuilder().build();
* Budget response = budgetServiceClient.createBudget(parent, budget);
* }
* }</pre>
*
* <p>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().
*
@@ -148,6 +156,16 @@ public BudgetServiceStub getStub() {
* 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.
*
* <p>Sample code:
*
* <pre>{@code
* try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
* BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
* Budget budget = Budget.newBuilder().build();
* Budget response = budgetServiceClient.createBudget(parent, budget);
* }
* }</pre>
*
* @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.
@@ -167,6 +185,16 @@ public final Budget createBudget(BillingAccountName parent, Budget budget) {
* 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.
*
* <p>Sample code:
*
* <pre>{@code
* try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
* String parent = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]").toString();
* Budget budget = Budget.newBuilder().build();
* Budget response = budgetServiceClient.createBudget(parent, budget);
* }
* }</pre>
*
* @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.
@@ -183,6 +211,19 @@ public final Budget createBudget(String parent, Budget budget) {
* 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.
*
* <p>Sample code:
*
* <pre>{@code
* try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
* CreateBudgetRequest request =
* CreateBudgetRequest.newBuilder()
* .setParent(BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]").toString())
* .setBudget(Budget.newBuilder().build())
* .build();
* Budget response = budgetServiceClient.createBudget(request);
* }
* }</pre>
*
* @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
*/
@@ -196,6 +237,19 @@ public final Budget createBudget(CreateBudgetRequest request) {
* information on the limits of the number of budgets you can create.
*
* <p>Sample code:
*
* <pre>{@code
* try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
* CreateBudgetRequest request =
* CreateBudgetRequest.newBuilder()
* .setParent(BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]").toString())
* .setBudget(Budget.newBuilder().build())
* .build();
* ApiFuture<Budget> future = budgetServiceClient.createBudgetCallable().futureCall(request);
* // Do something.
* Budget response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<CreateBudgetRequest, Budget> createBudgetCallable() {
return stub.createBudgetCallable();
@@ -208,6 +262,16 @@ public final UnaryCallable<CreateBudgetRequest, Budget> createBudgetCallable() {
* <p>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.
*
* <p>Sample code:
*
* <pre>{@code
* try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
* Budget budget = Budget.newBuilder().build();
* FieldMask updateMask = FieldMask.newBuilder().build();
* Budget response = budgetServiceClient.updateBudget(budget, updateMask);
* }
* }</pre>
*
* @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
@@ -230,6 +294,19 @@ public final Budget updateBudget(Budget budget, FieldMask updateMask) {
* <p>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.
*
* <p>Sample code:
*
* <pre>{@code
* try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
* UpdateBudgetRequest request =
* UpdateBudgetRequest.newBuilder()
* .setBudget(Budget.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* Budget response = budgetServiceClient.updateBudget(request);
* }
* }</pre>
*
* @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
*/
@@ -245,6 +322,19 @@ public final Budget updateBudget(UpdateBudgetRequest request) {
* this API. Budget fields that are not exposed in this API will not be changed by this method.
*
* <p>Sample code:
*
* <pre>{@code
* try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
* UpdateBudgetRequest request =
* UpdateBudgetRequest.newBuilder()
* .setBudget(Budget.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* ApiFuture<Budget> future = budgetServiceClient.updateBudgetCallable().futureCall(request);
* // Do something.
* Budget response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<UpdateBudgetRequest, Budget> updateBudgetCallable() {
return stub.updateBudgetCallable();
@@ -258,6 +348,15 @@ public final UnaryCallable<UpdateBudgetRequest, Budget> updateBudgetCallable() {
* 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.
*
* <p>Sample code:
*
* <pre>{@code
* try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
* BudgetName name = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]");
* Budget response = budgetServiceClient.getBudget(name);
* }
* }</pre>
*
* @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
@@ -276,6 +375,15 @@ public final Budget getBudget(BudgetName name) {
* 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.
*
* <p>Sample code:
*
* <pre>{@code
* try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
* String name = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]").toString();
* Budget response = budgetServiceClient.getBudget(name);
* }
* }</pre>
*
* @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
@@ -293,6 +401,18 @@ public final Budget getBudget(String name) {
* 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.
*
* <p>Sample code:
*
* <pre>{@code
* try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
* GetBudgetRequest request =
* GetBudgetRequest.newBuilder()
* .setName(BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]").toString())
* .build();
* Budget response = budgetServiceClient.getBudget(request);
* }
* }</pre>
*
* @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
*/
@@ -309,6 +429,18 @@ public final Budget getBudget(GetBudgetRequest request) {
* they may have been set in the Cloud Console.
*
* <p>Sample code:
*
* <pre>{@code
* try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
* GetBudgetRequest request =
* GetBudgetRequest.newBuilder()
* .setName(BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]").toString())
* .build();
* ApiFuture<Budget> future = budgetServiceClient.getBudgetCallable().futureCall(request);
* // Do something.
* Budget response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<GetBudgetRequest, Budget> getBudgetCallable() {
return stub.getBudgetCallable();
@@ -322,6 +454,17 @@ public final UnaryCallable<GetBudgetRequest, Budget> getBudgetCallable() {
* 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.
*
* <p>Sample code:
*
* <pre>{@code
* try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
* BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
* for (Budget element : budgetServiceClient.listBudgets(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @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
@@ -342,6 +485,17 @@ public final ListBudgetsPagedResponse listBudgets(BillingAccountName parent) {
* 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.
*
* <p>Sample code:
*
* <pre>{@code
* try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
* String parent = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]").toString();
* for (Budget element : budgetServiceClient.listBudgets(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @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
@@ -359,6 +513,22 @@ public final ListBudgetsPagedResponse listBudgets(String parent) {
* 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.
*
* <p>Sample code:
*
* <pre>{@code
* try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
* ListBudgetsRequest request =
* ListBudgetsRequest.newBuilder()
* .setParent(BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* for (Budget element : budgetServiceClient.listBudgets(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*
* @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
*/
@@ -375,6 +545,22 @@ public final ListBudgetsPagedResponse listBudgets(ListBudgetsRequest request) {
* they may have been set in the Cloud Console.
*
* <p>Sample code:
*
* <pre>{@code
* try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
* ListBudgetsRequest request =
* ListBudgetsRequest.newBuilder()
* .setParent(BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* ApiFuture<Budget> future = budgetServiceClient.listBudgetsPagedCallable().futureCall(request);
* // Do something.
* for (Budget element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }</pre>
*/
public final UnaryCallable<ListBudgetsRequest, ListBudgetsPagedResponse>
listBudgetsPagedCallable() {
@@ -390,6 +576,23 @@ public final ListBudgetsPagedResponse listBudgets(ListBudgetsRequest request) {
* they may have been set in the Cloud Console.
*
* <p>Sample code:
*
* <pre>{@code
* try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
* while (true) {
* ListBudgetsResponse response = budgetServiceClient.listBudgetsCallable().call(request);
* for (Budget element : response.getResponsesList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }</pre>
*/
public final UnaryCallable<ListBudgetsRequest, ListBudgetsResponse> listBudgetsCallable() {
return stub.listBudgetsCallable();
@@ -399,6 +602,15 @@ public final UnaryCallable<ListBudgetsRequest, ListBudgetsResponse> listBudgetsC
/**
* Deletes a budget. Returns successfully if already deleted.
*
* <p>Sample code:
*
* <pre>{@code
* try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
* BudgetName name = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]");
* budgetServiceClient.deleteBudget(name);
* }
* }</pre>
*
* @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
@@ -413,6 +625,15 @@ public final void deleteBudget(BudgetName name) {
/**
* Deletes a budget. Returns successfully if already deleted.
*
* <p>Sample code:
*
* <pre>{@code
* try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
* String name = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]").toString();
* budgetServiceClient.deleteBudget(name);
* }
* }</pre>
*
* @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
@@ -426,6 +647,18 @@ public final void deleteBudget(String name) {
/**
* Deletes a budget. Returns successfully if already deleted.
*
* <p>Sample code:
*
* <pre>{@code
* try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
* DeleteBudgetRequest request =
* DeleteBudgetRequest.newBuilder()
* .setName(BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]").toString())
* .build();
* budgetServiceClient.deleteBudget(request);
* }
* }</pre>
*
* @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
*/
@@ -438,6 +671,18 @@ public final void deleteBudget(DeleteBudgetRequest request) {
* Deletes a budget. Returns successfully if already deleted.
*
* <p>Sample code:
*
* <pre>{@code
* try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
* DeleteBudgetRequest request =
* DeleteBudgetRequest.newBuilder()
* .setName(BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]").toString())
* .build();
* ApiFuture<Empty> future = budgetServiceClient.deleteBudgetCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }</pre>
*/
public final UnaryCallable<DeleteBudgetRequest, Empty> deleteBudgetCallable() {
return stub.deleteBudgetCallable();

0 comments on commit 682a5ff

Please sign in to comment.