Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * AppProfileName name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]");
+ * boolean ignoreWarnings = true;
+ * baseBigtableInstanceAdminClient.deleteAppProfile(name, ignoreWarnings);
+ * }
+ * }
+ *
+ * @param name Required. The unique name of the app profile to be deleted. Values are of the form
+ * `projects/{project}/instances/{instance}/appProfiles/{app_profile}`.
+ * @param ignoreWarnings Required. If true, ignore safety checks when deleting the app profile.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteAppProfile(AppProfileName name, boolean ignoreWarnings) {
+ DeleteAppProfileRequest request =
+ DeleteAppProfileRequest.newBuilder()
+ .setName(name == null ? null : name.toString())
+ .setIgnoreWarnings(ignoreWarnings)
+ .build();
+ deleteAppProfile(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes an app profile from an instance.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * String name = AppProfileName.of("[PROJECT]", "[INSTANCE]", "[APP_PROFILE]").toString();
+ * boolean ignoreWarnings = true;
+ * baseBigtableInstanceAdminClient.deleteAppProfile(name, ignoreWarnings);
+ * }
+ * }
+ *
+ * @param name Required. The unique name of the app profile to be deleted. Values are of the form
+ * `projects/{project}/instances/{instance}/appProfiles/{app_profile}`.
+ * @param ignoreWarnings Required. If true, ignore safety checks when deleting the app profile.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteAppProfile(String name, boolean ignoreWarnings) {
+ DeleteAppProfileRequest request =
+ DeleteAppProfileRequest.newBuilder()
+ .setName(name)
+ .setIgnoreWarnings(ignoreWarnings)
+ .build();
+ deleteAppProfile(request);
+ }
+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes an app profile from an instance.
@@ -3022,77 +3114,1544 @@ public final ListHotTabletsPagedResponse listHotTablets(ListHotTabletsRequest re
return stub.listHotTabletsCallable();
}
- @Override
- public final void close() {
- stub.close();
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a logical view within an instance.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
+ * LogicalView logicalView = LogicalView.newBuilder().build();
+ * String logicalViewId = "logicalViewId-1408054263";
+ * LogicalView response =
+ * baseBigtableInstanceAdminClient
+ * .createLogicalViewAsync(parent, logicalView, logicalViewId)
+ * .get();
+ * }
+ * }
+ *
+ * @param parent Required. The parent instance where this logical view will be created. Format:
+ * `projects/{project}/instances/{instance}`.
+ * @param logicalView Required. The logical view to create.
+ * @param logicalViewId Required. The ID to use for the logical view, which will become the final
+ * component of the logical view's resource name.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFutureSample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
+ * LogicalView logicalView = LogicalView.newBuilder().build();
+ * String logicalViewId = "logicalViewId-1408054263";
+ * LogicalView response =
+ * baseBigtableInstanceAdminClient
+ * .createLogicalViewAsync(parent, logicalView, logicalViewId)
+ * .get();
+ * }
+ * }
+ *
+ * @param parent Required. The parent instance where this logical view will be created. Format:
+ * `projects/{project}/instances/{instance}`.
+ * @param logicalView Required. The logical view to create.
+ * @param logicalViewId Required. The ID to use for the logical view, which will become the final
+ * component of the logical view's resource name.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFutureSample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * CreateLogicalViewRequest request =
+ * CreateLogicalViewRequest.newBuilder()
+ * .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+ * .setLogicalViewId("logicalViewId-1408054263")
+ * .setLogicalView(LogicalView.newBuilder().build())
+ * .build();
+ * LogicalView response = baseBigtableInstanceAdminClient.createLogicalViewAsync(request).get();
+ * }
+ * }
+ *
+ * @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 OperationFutureSample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * CreateLogicalViewRequest request =
+ * CreateLogicalViewRequest.newBuilder()
+ * .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+ * .setLogicalViewId("logicalViewId-1408054263")
+ * .setLogicalView(LogicalView.newBuilder().build())
+ * .build();
+ * OperationFuture future =
+ * baseBigtableInstanceAdminClient.createLogicalViewOperationCallable().futureCall(request);
+ * // Do something.
+ * LogicalView response = future.get();
+ * }
+ * }
+ */
+ public final OperationCallableSample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * CreateLogicalViewRequest request =
+ * CreateLogicalViewRequest.newBuilder()
+ * .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+ * .setLogicalViewId("logicalViewId-1408054263")
+ * .setLogicalView(LogicalView.newBuilder().build())
+ * .build();
+ * ApiFuture future =
+ * baseBigtableInstanceAdminClient.createLogicalViewCallable().futureCall(request);
+ * // Do something.
+ * Operation response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * LogicalViewName name = LogicalViewName.of("[PROJECT]", "[INSTANCE]", "[LOGICAL_VIEW]");
+ * LogicalView response = baseBigtableInstanceAdminClient.getLogicalView(name);
+ * }
+ * }
+ *
+ * @param name Required. The unique name of the requested logical view. Values are of the form
+ * `projects/{project}/instances/{instance}/logicalViews/{logical_view}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final LogicalView getLogicalView(LogicalViewName name) {
+ GetLogicalViewRequest request =
+ GetLogicalViewRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return getLogicalView(request);
}
- public static class ListAppProfilesPagedResponse
- extends AbstractPagedListResponse<
- ListAppProfilesRequest,
- ListAppProfilesResponse,
- AppProfile,
- ListAppProfilesPage,
- ListAppProfilesFixedSizeCollection> {
-
- public static ApiFutureSample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * String name = LogicalViewName.of("[PROJECT]", "[INSTANCE]", "[LOGICAL_VIEW]").toString();
+ * LogicalView response = baseBigtableInstanceAdminClient.getLogicalView(name);
+ * }
+ * }
+ *
+ * @param name Required. The unique name of the requested logical view. Values are of the form
+ * `projects/{project}/instances/{instance}/logicalViews/{logical_view}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final LogicalView getLogicalView(String name) {
+ GetLogicalViewRequest request = GetLogicalViewRequest.newBuilder().setName(name).build();
+ return getLogicalView(request);
}
- public static class ListAppProfilesPage
- extends AbstractPage<
- ListAppProfilesRequest, ListAppProfilesResponse, AppProfile, ListAppProfilesPage> {
-
- private ListAppProfilesPage(
- PageContextSample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * GetLogicalViewRequest request =
+ * GetLogicalViewRequest.newBuilder()
+ * .setName(LogicalViewName.of("[PROJECT]", "[INSTANCE]", "[LOGICAL_VIEW]").toString())
+ * .build();
+ * LogicalView response = baseBigtableInstanceAdminClient.getLogicalView(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 LogicalView getLogicalView(GetLogicalViewRequest request) {
+ return getLogicalViewCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets information about a logical view.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * GetLogicalViewRequest request =
+ * GetLogicalViewRequest.newBuilder()
+ * .setName(LogicalViewName.of("[PROJECT]", "[INSTANCE]", "[LOGICAL_VIEW]").toString())
+ * .build();
+ * ApiFuture future =
+ * baseBigtableInstanceAdminClient.getLogicalViewCallable().futureCall(request);
+ * // Do something.
+ * LogicalView response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
+ * for (LogicalView element :
+ * baseBigtableInstanceAdminClient.listLogicalViews(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. The unique name of the instance for which the list of logical views is
+ * requested. Values are of the form `projects/{project}/instances/{instance}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListLogicalViewsPagedResponse listLogicalViews(InstanceName parent) {
+ ListLogicalViewsRequest request =
+ ListLogicalViewsRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .build();
+ return listLogicalViews(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists information about logical views in an instance.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
+ * for (LogicalView element :
+ * baseBigtableInstanceAdminClient.listLogicalViews(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. The unique name of the instance for which the list of logical views is
+ * requested. Values are of the form `projects/{project}/instances/{instance}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListLogicalViewsPagedResponse listLogicalViews(String parent) {
+ ListLogicalViewsRequest request =
+ ListLogicalViewsRequest.newBuilder().setParent(parent).build();
+ return listLogicalViews(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists information about logical views in an instance.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * ListLogicalViewsRequest request =
+ * ListLogicalViewsRequest.newBuilder()
+ * .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * for (LogicalView element :
+ * baseBigtableInstanceAdminClient.listLogicalViews(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 ListLogicalViewsPagedResponse listLogicalViews(ListLogicalViewsRequest request) {
+ return listLogicalViewsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists information about logical views in an instance.
+ *
+ * Sample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * ListLogicalViewsRequest request =
+ * ListLogicalViewsRequest.newBuilder()
+ * .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * ApiFuture future =
+ * baseBigtableInstanceAdminClient.listLogicalViewsPagedCallable().futureCall(request);
+ * // Do something.
+ * for (LogicalView element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * ListLogicalViewsRequest request =
+ * ListLogicalViewsRequest.newBuilder()
+ * .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * while (true) {
+ * ListLogicalViewsResponse response =
+ * baseBigtableInstanceAdminClient.listLogicalViewsCallable().call(request);
+ * for (LogicalView element : response.getLogicalViewsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallableSample code: + * + *
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * LogicalView logicalView = LogicalView.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * LogicalView response =
+ * baseBigtableInstanceAdminClient.updateLogicalViewAsync(logicalView, updateMask).get();
+ * }
+ * }
+ *
+ * @param logicalView Required. The logical view to update.
+ * The logical view's `name` field is used to identify the view to update. Format:
+ * `projects/{project}/instances/{instance}/logicalViews/{logical_view}`.
+ * @param updateMask Optional. The list of fields to update.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * The materialized view's `name` field is used to identify the view to update. Format:
+ * `projects/{project}/instances/{instance}/materializedViews/{materialized_view}`.
+ * @param updateMask Optional. The list of fields to update.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * If `column_families` is set in `update_mask`, it will return an UNIMPLEMENTED error.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
@@ -973,6 +984,7 @@ public final OperationFuture Sample code:
*
@@ -4519,7 +4533,8 @@ public final UnaryCallable Sample code:
*
@@ -4567,8 +4582,8 @@ public final Policy getIamPolicy(String resource) {
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Gets the access control policy for a Table or Backup resource. Returns an empty policy if the
- * resource exists but does not have a policy set.
+ * Gets the access control policy for a Bigtable resource. Returns an empty policy if the resource
+ * exists but does not have a policy set.
*
* Sample code:
*
@@ -4583,7 +4598,8 @@ public final Policy getIamPolicy(String resource) {
* GetIamPolicyRequest request =
* GetIamPolicyRequest.newBuilder()
* .setResource(
- * BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]").toString())
+ * AuthorizedViewName.of("[PROJECT]", "[INSTANCE]", "[TABLE]", "[AUTHORIZED_VIEW]")
+ * .toString())
* .setOptions(GetPolicyOptions.newBuilder().build())
* .build();
* Policy response = baseBigtableTableAdminClient.getIamPolicy(request);
@@ -4599,8 +4615,8 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) {
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Gets the access control policy for a Table or Backup resource. Returns an empty policy if the
- * resource exists but does not have a policy set.
+ * Gets the access control policy for a Bigtable resource. Returns an empty policy if the resource
+ * exists but does not have a policy set.
*
* Sample code:
*
@@ -4615,7 +4631,8 @@ public final Policy getIamPolicy(GetIamPolicyRequest request) {
* GetIamPolicyRequest request =
* GetIamPolicyRequest.newBuilder()
* .setResource(
- * BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]").toString())
+ * AuthorizedViewName.of("[PROJECT]", "[INSTANCE]", "[TABLE]", "[AUTHORIZED_VIEW]")
+ * .toString())
* .setOptions(GetPolicyOptions.newBuilder().build())
* .build();
* ApiFuture Sample code:
*
@@ -4643,7 +4660,8 @@ public final UnaryCallable Sample code:
*
@@ -4700,7 +4718,7 @@ public final Policy setIamPolicy(String resource, Policy policy) {
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Sets the access control policy on a Table or Backup resource. Replaces any existing policy.
+ * Sets the access control policy on a Bigtable resource. Replaces any existing policy.
*
* Sample code:
*
@@ -4715,7 +4733,8 @@ public final Policy setIamPolicy(String resource, Policy policy) {
* SetIamPolicyRequest request =
* SetIamPolicyRequest.newBuilder()
* .setResource(
- * BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]").toString())
+ * AuthorizedViewName.of("[PROJECT]", "[INSTANCE]", "[TABLE]", "[AUTHORIZED_VIEW]")
+ * .toString())
* .setPolicy(Policy.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
@@ -4732,7 +4751,7 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) {
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Sets the access control policy on a Table or Backup resource. Replaces any existing policy.
+ * Sets the access control policy on a Bigtable resource. Replaces any existing policy.
*
* Sample code:
*
@@ -4747,7 +4766,8 @@ public final Policy setIamPolicy(SetIamPolicyRequest request) {
* SetIamPolicyRequest request =
* SetIamPolicyRequest.newBuilder()
* .setResource(
- * BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]").toString())
+ * AuthorizedViewName.of("[PROJECT]", "[INSTANCE]", "[TABLE]", "[AUTHORIZED_VIEW]")
+ * .toString())
* .setPolicy(Policy.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
@@ -4764,7 +4784,7 @@ public final UnaryCallable Sample code:
*
@@ -4776,7 +4796,8 @@ public final UnaryCallable Sample code:
*
@@ -4840,7 +4861,7 @@ public final TestIamPermissionsResponse testIamPermissions(
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Returns permissions that the caller has on the specified Table or Backup resource.
+ * Returns permissions that the caller has on the specified Bigtable resource.
*
* Sample code:
*
@@ -4855,7 +4876,8 @@ public final TestIamPermissionsResponse testIamPermissions(
* TestIamPermissionsRequest request =
* TestIamPermissionsRequest.newBuilder()
* .setResource(
- * BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]").toString())
+ * AuthorizedViewName.of("[PROJECT]", "[INSTANCE]", "[TABLE]", "[AUTHORIZED_VIEW]")
+ * .toString())
* .addAllPermissions(new ArrayList Sample code:
*
@@ -4887,7 +4909,8 @@ public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsReq
* TestIamPermissionsRequest request =
* TestIamPermissionsRequest.newBuilder()
* .setResource(
- * BackupName.of("[PROJECT]", "[INSTANCE]", "[CLUSTER]", "[BACKUP]").toString())
+ * AuthorizedViewName.of("[PROJECT]", "[INSTANCE]", "[TABLE]", "[AUTHORIZED_VIEW]")
+ * .toString())
* .addAllPermissions(new ArrayList Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * The schema bundle's `name` field is used to identify the schema bundle to update. Values
+ * are of the form
+ * `projects/{project}/instances/{instance}/tables/{table}/schemaBundles/{schema_bundle}`
+ * @param updateMask Optional. The list of fields to update.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * A LogicalView represents subsets of a particular table based on rules. The access to each
+ * LogicalView can be configured separately from the Table.
+ *
+ * Users can perform read/write operation on a LogicalView by providing a logicalView id besides
+ * a table id, in which case the semantics remain identical as reading/writing on a Table except
+ * that visibility is restricted to the subset of the Table that the LogicalView represents.
+ */
+public final class LogicalView {
+ private final com.google.bigtable.admin.v2.LogicalView proto;
+
+ /**
+ * Wraps the protobuf. This method is considered an internal implementation detail and not meant
+ * to be used by applications.
+ */
+ @InternalApi
+ public static LogicalView fromProto(@Nonnull com.google.bigtable.admin.v2.LogicalView proto) {
+ return new LogicalView(proto);
+ }
+
+ private LogicalView(@Nonnull com.google.bigtable.admin.v2.LogicalView proto) {
+ Preconditions.checkNotNull(proto);
+ Preconditions.checkArgument(!proto.getName().isEmpty(), "LogicalView must have a name");
+ this.proto = proto;
+ }
+
+ /** Gets the logical view's id. */
+ public String getId() {
+ // Constructor ensures that name is not null.
+ LogicalViewName fullName = LogicalViewName.parse(proto.getName());
+
+ //noinspection ConstantConditions
+ return fullName.getLogicalView();
+ }
+
+ /** Gets the id of the instance that owns this LogicalView. */
+ @SuppressWarnings("WeakerAccess")
+ public String getInstanceId() {
+ LogicalViewName fullName =
+ Verify.verifyNotNull(LogicalViewName.parse(proto.getName()), "Name can never be null");
+
+ //noinspection ConstantConditions
+ return fullName.getInstance();
+ }
+
+ /** Gets the query of this logical view. */
+ public String getQuery() {
+ return proto.getQuery();
+ }
+
+ /** Returns whether this logical view is deletion protected. */
+ public boolean isDeletionProtected() {
+ return proto.getDeletionProtection();
+ }
+
+ /**
+ * Creates the request protobuf. This method is considered an internal implementation detail and
+ * not meant to be used by applications.
+ */
+ @InternalApi
+ public com.google.bigtable.admin.v2.LogicalView toProto() {
+ return proto;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ LogicalView that = (LogicalView) o;
+ return Objects.equal(proto, that.proto);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(proto);
+ }
+}
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/MaterializedView.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/MaterializedView.java
new file mode 100644
index 0000000000..c3bf494c03
--- /dev/null
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/MaterializedView.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2024 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.bigtable.admin.v2.models;
+
+import com.google.api.core.InternalApi;
+import com.google.bigtable.admin.v2.MaterializedViewName;
+import com.google.common.base.Objects;
+import com.google.common.base.Preconditions;
+import com.google.common.base.Verify;
+import javax.annotation.Nonnull;
+
+/**
+ * A class that wraps the {@link com.google.bigtable.admin.v2.MaterializedView} protocol buffer
+ * object.
+ *
+ * A MaterializedView represents subsets of a particular table based on rules. The access to each
+ * MaterializedView can be configured separately from the Table.
+ *
+ * Users can perform read/write operation on a MaterializedView by providing a materializedView
+ * id besides a table id, in which case the semantics remain identical as reading/writing on a Table
+ * except that visibility is restricted to the subset of the Table that the MaterializedView
+ * represents.
+ */
+public final class MaterializedView {
+ private final com.google.bigtable.admin.v2.MaterializedView proto;
+
+ /**
+ * Wraps the protobuf. This method is considered an internal implementation detail and not meant
+ * to be used by applications.
+ */
+ @InternalApi
+ public static MaterializedView fromProto(
+ @Nonnull com.google.bigtable.admin.v2.MaterializedView proto) {
+ return new MaterializedView(proto);
+ }
+
+ private MaterializedView(@Nonnull com.google.bigtable.admin.v2.MaterializedView proto) {
+ Preconditions.checkNotNull(proto);
+ Preconditions.checkArgument(!proto.getName().isEmpty(), "MaterializedView must have a name");
+ this.proto = proto;
+ }
+
+ /** Gets the materialized view's id. */
+ public String getId() {
+ // Constructor ensures that name is not null.
+ MaterializedViewName fullName = MaterializedViewName.parse(proto.getName());
+
+ //noinspection ConstantConditions
+ return fullName.getMaterializedView();
+ }
+
+ /** Gets the id of the instance that owns this MaterializedView. */
+ @SuppressWarnings("WeakerAccess")
+ public String getInstanceId() {
+ MaterializedViewName fullName =
+ Verify.verifyNotNull(MaterializedViewName.parse(proto.getName()), "Name can never be null");
+
+ //noinspection ConstantConditions
+ return fullName.getInstance();
+ }
+
+ /** Returns whether this materialized view is deletion protected. */
+ public boolean isDeletionProtected() {
+ return proto.getDeletionProtection();
+ }
+
+ /** Gets the query of this materialized view. */
+ public String getQuery() {
+ return proto.getQuery();
+ }
+
+ /**
+ * Creates the request protobuf. This method is considered an internal implementation detail and
+ * not meant to be used by applications.
+ */
+ @InternalApi
+ public com.google.bigtable.admin.v2.MaterializedView toProto() {
+ return proto;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ MaterializedView that = (MaterializedView) o;
+ return Objects.equal(proto, that.proto);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(proto);
+ }
+}
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/SchemaBundle.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/SchemaBundle.java
new file mode 100644
index 0000000000..7782c335a2
--- /dev/null
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/SchemaBundle.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2024 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.bigtable.admin.v2.models;
+
+import com.google.api.core.InternalApi;
+import com.google.bigtable.admin.v2.SchemaBundleName;
+import com.google.common.base.Objects;
+import com.google.common.base.Preconditions;
+import javax.annotation.Nonnull;
+
+/**
+ * A class that wraps the {@link com.google.bigtable.admin.v2.SchemaBundle} protocol buffer object.
+ */
+public final class SchemaBundle {
+ private final com.google.bigtable.admin.v2.SchemaBundle proto;
+ private final SchemaBundleName schemaBundleName;
+
+ /**
+ * Wraps the protobuf. This method is considered an internal implementation detail and not meant
+ * to be used by applications.
+ */
+ @InternalApi
+ public static SchemaBundle fromProto(@Nonnull com.google.bigtable.admin.v2.SchemaBundle proto) {
+ return new SchemaBundle(proto);
+ }
+
+ private SchemaBundle(@Nonnull com.google.bigtable.admin.v2.SchemaBundle proto) {
+ Preconditions.checkNotNull(proto);
+ Preconditions.checkArgument(!proto.getName().isEmpty(), "SchemaBundle must have a name");
+ Preconditions.checkArgument(
+ proto.hasProtoSchema(), "Schemabundle must have a proto_schema field");
+ this.proto = proto;
+ this.schemaBundleName = SchemaBundleName.parse(proto.getName());
+ }
+
+ /** Gets the schema bundle's id. */
+ public String getId() {
+ //noinspection ConstantConditions
+ return schemaBundleName.getSchemaBundle();
+ }
+
+ /** Gets the id of the table that owns this schema bundle. */
+ public String getTableId() {
+ //noinspection ConstantConditions
+ return schemaBundleName.getTable();
+ }
+
+ /** Gets the proto schema of this schema bundle. */
+ public com.google.protobuf.ByteString getProtoSchema() {
+ if (proto.hasProtoSchema()) {
+ return proto.getProtoSchema().getProtoDescriptors();
+ }
+ throw new IllegalStateException("This SchemaBundle doesn't have a valid type specified");
+ }
+
+ /**
+ * Creates the request protobuf. This method is considered an internal implementation detail and
+ * not meant to be used by applications.
+ */
+ @InternalApi
+ public com.google.bigtable.admin.v2.SchemaBundle toProto() {
+ return proto;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ SchemaBundle that = (SchemaBundle) o;
+ return Objects.equal(proto, that.proto);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(proto);
+ }
+}
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/Table.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/Table.java
index 31aa612f18..9fb66c41c0 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/Table.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/Table.java
@@ -13,10 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.google.cloud.bigtable.admin.v2.models;
import com.google.api.core.InternalApi;
import com.google.bigtable.admin.v2.TableName;
+import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
@@ -58,7 +60,7 @@ public enum ReplicationState {
/**
* The table is fully created and ready for use after a restore, and is being optimized for
- * performance. When optimizations are complete, the table will transition to `READY` state.
+ * performance. When optimizations are complete, the table will transition to`READY` state.
*/
READY_OPTIMIZING(
com.google.bigtable.admin.v2.Table.ClusterState.ReplicationState.READY_OPTIMIZING),
@@ -99,12 +101,49 @@ public com.google.bigtable.admin.v2.Table.ClusterState.ReplicationState toProto(
}
}
+ public static class AutomatedBackupPolicy {
+ private final com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy proto;
+
+ /**
+ * Wraps the protobuf. This method is considered an internal implementation detail and not meant
+ * to be used by applications.
+ */
+ @InternalApi
+ public static AutomatedBackupPolicy fromProto(
+ com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy proto) {
+ return new AutomatedBackupPolicy(proto);
+ }
+
+ AutomatedBackupPolicy(@Nonnull com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy proto) {
+ this.proto = proto;
+ }
+
+ /**
+ * Creates the request protobuf. This method is considered an internal implementation detail and
+ * not meant to be used by applications.
+ */
+ @InternalApi
+ public com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy toProto() {
+ return proto;
+ }
+
+ /** Returns policy config contents as a string. */
+ public String viewConfig() {
+ return MoreObjects.toStringHelper(this)
+ .add(proto.getClass().getName() + ".retention_period", proto.getRetentionPeriod())
+ .add(proto.getClass().getName() + ".frequency", proto.getFrequency())
+ .toString();
+ }
+ }
+
private final String id;
private final String instanceId;
private final Map Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * This callable wraps GenerateConsistencyToken and CheckConsistency RPCs. It will generate a
+ * token then poll until isConsistent is true.
+ */
+class AwaitConsistencyCallable extends UnaryCallable{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * UpdateLogicalViewRequest request =
+ * UpdateLogicalViewRequest.newBuilder()
+ * .setLogicalView(LogicalView.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * LogicalView response = baseBigtableInstanceAdminClient.updateLogicalViewAsync(request).get();
+ * }
+ * }
+ *
+ * @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 OperationFuture{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * UpdateLogicalViewRequest request =
+ * UpdateLogicalViewRequest.newBuilder()
+ * .setLogicalView(LogicalView.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * OperationFuture
+ */
+ public final OperationCallable{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * UpdateLogicalViewRequest request =
+ * UpdateLogicalViewRequest.newBuilder()
+ * .setLogicalView(LogicalView.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * ApiFuture
+ */
+ public final UnaryCallable{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * LogicalViewName name = LogicalViewName.of("[PROJECT]", "[INSTANCE]", "[LOGICAL_VIEW]");
+ * baseBigtableInstanceAdminClient.deleteLogicalView(name);
+ * }
+ * }
+ *
+ * @param name Required. The unique name of the logical view to be deleted. Format:
+ * `projects/{project}/instances/{instance}/logicalViews/{logical_view}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteLogicalView(LogicalViewName name) {
+ DeleteLogicalViewRequest request =
+ DeleteLogicalViewRequest.newBuilder()
+ .setName(name == null ? null : name.toString())
+ .build();
+ deleteLogicalView(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes a logical view from an instance.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * String name = LogicalViewName.of("[PROJECT]", "[INSTANCE]", "[LOGICAL_VIEW]").toString();
+ * baseBigtableInstanceAdminClient.deleteLogicalView(name);
+ * }
+ * }
+ *
+ * @param name Required. The unique name of the logical view to be deleted. Format:
+ * `projects/{project}/instances/{instance}/logicalViews/{logical_view}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteLogicalView(String name) {
+ DeleteLogicalViewRequest request = DeleteLogicalViewRequest.newBuilder().setName(name).build();
+ deleteLogicalView(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes a logical view from an instance.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * DeleteLogicalViewRequest request =
+ * DeleteLogicalViewRequest.newBuilder()
+ * .setName(LogicalViewName.of("[PROJECT]", "[INSTANCE]", "[LOGICAL_VIEW]").toString())
+ * .setEtag("etag3123477")
+ * .build();
+ * baseBigtableInstanceAdminClient.deleteLogicalView(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 deleteLogicalView(DeleteLogicalViewRequest request) {
+ deleteLogicalViewCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes a logical view from an instance.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * DeleteLogicalViewRequest request =
+ * DeleteLogicalViewRequest.newBuilder()
+ * .setName(LogicalViewName.of("[PROJECT]", "[INSTANCE]", "[LOGICAL_VIEW]").toString())
+ * .setEtag("etag3123477")
+ * .build();
+ * ApiFuture
+ */
+ public final UnaryCallable{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
+ * MaterializedView materializedView = MaterializedView.newBuilder().build();
+ * String materializedViewId = "materializedViewId682270903";
+ * MaterializedView response =
+ * baseBigtableInstanceAdminClient
+ * .createMaterializedViewAsync(parent, materializedView, materializedViewId)
+ * .get();
+ * }
+ * }
+ *
+ * @param parent Required. The parent instance where this materialized view will be created.
+ * Format: `projects/{project}/instances/{instance}`.
+ * @param materializedView Required. The materialized view to create.
+ * @param materializedViewId Required. The ID to use for the materialized view, which will become
+ * the final component of the materialized view's resource name.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
+ * MaterializedView materializedView = MaterializedView.newBuilder().build();
+ * String materializedViewId = "materializedViewId682270903";
+ * MaterializedView response =
+ * baseBigtableInstanceAdminClient
+ * .createMaterializedViewAsync(parent, materializedView, materializedViewId)
+ * .get();
+ * }
+ * }
+ *
+ * @param parent Required. The parent instance where this materialized view will be created.
+ * Format: `projects/{project}/instances/{instance}`.
+ * @param materializedView Required. The materialized view to create.
+ * @param materializedViewId Required. The ID to use for the materialized view, which will become
+ * the final component of the materialized view's resource name.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * CreateMaterializedViewRequest request =
+ * CreateMaterializedViewRequest.newBuilder()
+ * .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+ * .setMaterializedViewId("materializedViewId682270903")
+ * .setMaterializedView(MaterializedView.newBuilder().build())
+ * .build();
+ * MaterializedView response =
+ * baseBigtableInstanceAdminClient.createMaterializedViewAsync(request).get();
+ * }
+ * }
+ *
+ * @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 OperationFuture{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * CreateMaterializedViewRequest request =
+ * CreateMaterializedViewRequest.newBuilder()
+ * .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+ * .setMaterializedViewId("materializedViewId682270903")
+ * .setMaterializedView(MaterializedView.newBuilder().build())
+ * .build();
+ * OperationFuture
+ */
+ public final OperationCallable<
+ CreateMaterializedViewRequest, MaterializedView, CreateMaterializedViewMetadata>
+ createMaterializedViewOperationCallable() {
+ return stub.createMaterializedViewOperationCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a materialized view within an instance.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * CreateMaterializedViewRequest request =
+ * CreateMaterializedViewRequest.newBuilder()
+ * .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+ * .setMaterializedViewId("materializedViewId682270903")
+ * .setMaterializedView(MaterializedView.newBuilder().build())
+ * .build();
+ * ApiFuture
+ */
+ public final UnaryCallable{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * MaterializedViewName name =
+ * MaterializedViewName.of("[PROJECT]", "[INSTANCE]", "[MATERIALIZED_VIEW]");
+ * MaterializedView response = baseBigtableInstanceAdminClient.getMaterializedView(name);
+ * }
+ * }
+ *
+ * @param name Required. The unique name of the requested materialized view. Values are of the
+ * form `projects/{project}/instances/{instance}/materializedViews/{materialized_view}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final MaterializedView getMaterializedView(MaterializedViewName name) {
+ GetMaterializedViewRequest request =
+ GetMaterializedViewRequest.newBuilder()
+ .setName(name == null ? null : name.toString())
+ .build();
+ return getMaterializedView(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets information about a materialized view.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * String name =
+ * MaterializedViewName.of("[PROJECT]", "[INSTANCE]", "[MATERIALIZED_VIEW]").toString();
+ * MaterializedView response = baseBigtableInstanceAdminClient.getMaterializedView(name);
+ * }
+ * }
+ *
+ * @param name Required. The unique name of the requested materialized view. Values are of the
+ * form `projects/{project}/instances/{instance}/materializedViews/{materialized_view}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final MaterializedView getMaterializedView(String name) {
+ GetMaterializedViewRequest request =
+ GetMaterializedViewRequest.newBuilder().setName(name).build();
+ return getMaterializedView(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets information about a materialized view.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * GetMaterializedViewRequest request =
+ * GetMaterializedViewRequest.newBuilder()
+ * .setName(
+ * MaterializedViewName.of("[PROJECT]", "[INSTANCE]", "[MATERIALIZED_VIEW]")
+ * .toString())
+ * .build();
+ * MaterializedView response = baseBigtableInstanceAdminClient.getMaterializedView(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 MaterializedView getMaterializedView(GetMaterializedViewRequest request) {
+ return getMaterializedViewCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets information about a materialized view.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * GetMaterializedViewRequest request =
+ * GetMaterializedViewRequest.newBuilder()
+ * .setName(
+ * MaterializedViewName.of("[PROJECT]", "[INSTANCE]", "[MATERIALIZED_VIEW]")
+ * .toString())
+ * .build();
+ * ApiFuture
+ */
+ public final UnaryCallable{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * InstanceName parent = InstanceName.of("[PROJECT]", "[INSTANCE]");
+ * for (MaterializedView element :
+ * baseBigtableInstanceAdminClient.listMaterializedViews(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. The unique name of the instance for which the list of materialized
+ * views is requested. Values are of the form `projects/{project}/instances/{instance}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListMaterializedViewsPagedResponse listMaterializedViews(InstanceName parent) {
+ ListMaterializedViewsRequest request =
+ ListMaterializedViewsRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .build();
+ return listMaterializedViews(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists information about materialized views in an instance.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * String parent = InstanceName.of("[PROJECT]", "[INSTANCE]").toString();
+ * for (MaterializedView element :
+ * baseBigtableInstanceAdminClient.listMaterializedViews(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. The unique name of the instance for which the list of materialized
+ * views is requested. Values are of the form `projects/{project}/instances/{instance}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListMaterializedViewsPagedResponse listMaterializedViews(String parent) {
+ ListMaterializedViewsRequest request =
+ ListMaterializedViewsRequest.newBuilder().setParent(parent).build();
+ return listMaterializedViews(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists information about materialized views in an instance.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * ListMaterializedViewsRequest request =
+ * ListMaterializedViewsRequest.newBuilder()
+ * .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * for (MaterializedView element :
+ * baseBigtableInstanceAdminClient.listMaterializedViews(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 ListMaterializedViewsPagedResponse listMaterializedViews(
+ ListMaterializedViewsRequest request) {
+ return listMaterializedViewsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists information about materialized views in an instance.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * ListMaterializedViewsRequest request =
+ * ListMaterializedViewsRequest.newBuilder()
+ * .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * ApiFuture
+ */
+ public final UnaryCallable{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * ListMaterializedViewsRequest request =
+ * ListMaterializedViewsRequest.newBuilder()
+ * .setParent(InstanceName.of("[PROJECT]", "[INSTANCE]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * while (true) {
+ * ListMaterializedViewsResponse response =
+ * baseBigtableInstanceAdminClient.listMaterializedViewsCallable().call(request);
+ * for (MaterializedView element : response.getMaterializedViewsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * MaterializedView materializedView = MaterializedView.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * MaterializedView response =
+ * baseBigtableInstanceAdminClient
+ * .updateMaterializedViewAsync(materializedView, updateMask)
+ * .get();
+ * }
+ * }
+ *
+ * @param materializedView Required. The materialized view to update.
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * UpdateMaterializedViewRequest request =
+ * UpdateMaterializedViewRequest.newBuilder()
+ * .setMaterializedView(MaterializedView.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * MaterializedView response =
+ * baseBigtableInstanceAdminClient.updateMaterializedViewAsync(request).get();
+ * }
+ * }
+ *
+ * @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 OperationFuture{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * UpdateMaterializedViewRequest request =
+ * UpdateMaterializedViewRequest.newBuilder()
+ * .setMaterializedView(MaterializedView.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * OperationFuture
+ */
+ public final OperationCallable<
+ UpdateMaterializedViewRequest, MaterializedView, UpdateMaterializedViewMetadata>
+ updateMaterializedViewOperationCallable() {
+ return stub.updateMaterializedViewOperationCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Updates a materialized view within an instance.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * UpdateMaterializedViewRequest request =
+ * UpdateMaterializedViewRequest.newBuilder()
+ * .setMaterializedView(MaterializedView.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * ApiFuture
+ */
+ public final UnaryCallable{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * MaterializedViewName name =
+ * MaterializedViewName.of("[PROJECT]", "[INSTANCE]", "[MATERIALIZED_VIEW]");
+ * baseBigtableInstanceAdminClient.deleteMaterializedView(name);
+ * }
+ * }
+ *
+ * @param name Required. The unique name of the materialized view to be deleted. Format:
+ * `projects/{project}/instances/{instance}/materializedViews/{materialized_view}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteMaterializedView(MaterializedViewName name) {
+ DeleteMaterializedViewRequest request =
+ DeleteMaterializedViewRequest.newBuilder()
+ .setName(name == null ? null : name.toString())
+ .build();
+ deleteMaterializedView(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes a materialized view from an instance.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * String name =
+ * MaterializedViewName.of("[PROJECT]", "[INSTANCE]", "[MATERIALIZED_VIEW]").toString();
+ * baseBigtableInstanceAdminClient.deleteMaterializedView(name);
+ * }
+ * }
+ *
+ * @param name Required. The unique name of the materialized view to be deleted. Format:
+ * `projects/{project}/instances/{instance}/materializedViews/{materialized_view}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteMaterializedView(String name) {
+ DeleteMaterializedViewRequest request =
+ DeleteMaterializedViewRequest.newBuilder().setName(name).build();
+ deleteMaterializedView(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes a materialized view from an instance.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * DeleteMaterializedViewRequest request =
+ * DeleteMaterializedViewRequest.newBuilder()
+ * .setName(
+ * MaterializedViewName.of("[PROJECT]", "[INSTANCE]", "[MATERIALIZED_VIEW]")
+ * .toString())
+ * .setEtag("etag3123477")
+ * .build();
+ * baseBigtableInstanceAdminClient.deleteMaterializedView(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 deleteMaterializedView(DeleteMaterializedViewRequest request) {
+ deleteMaterializedViewCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes a materialized view from an instance.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient =
+ * BaseBigtableInstanceAdminClient.create()) {
+ * DeleteMaterializedViewRequest request =
+ * DeleteMaterializedViewRequest.newBuilder()
+ * .setName(
+ * MaterializedViewName.of("[PROJECT]", "[INSTANCE]", "[MATERIALIZED_VIEW]")
+ * .toString())
+ * .setEtag("etag3123477")
+ * .build();
+ * ApiFuture
+ */
+ public final UnaryCallable updateTableAsync(
* UpdateTableRequest.newBuilder()
* .setTable(Table.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
+ * .setIgnoreWarnings(true)
* .build();
* Table response = baseBigtableTableAdminClient.updateTableAsync(request).get();
* }
@@ -1004,6 +1016,7 @@ public final OperationFuture
updateTableAsync(
* UpdateTableRequest.newBuilder()
* .setTable(Table.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
+ * .setIgnoreWarnings(true)
* .build();
* OperationFuture
future =
* baseBigtableTableAdminClient.updateTableOperationCallable().futureCall(request);
@@ -1035,6 +1048,7 @@ public final OperationFuture
updateTableAsync(
* UpdateTableRequest.newBuilder()
* .setTable(Table.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
+ * .setIgnoreWarnings(true)
* .build();
* ApiFuture
restoreTableAsync(
* Create a new table by restoring from a completed backup. The returned table [long-running
* operation][google.longrunning.Operation] can be used to track the progress of the operation,
* and to cancel it. The [metadata][google.longrunning.Operation.metadata] field type is
- * [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The
+ * [RestoreTableMetadata][google.bigtable.admin.v2.RestoreTableMetadata]. The
* [response][google.longrunning.Operation.response] type is
* [Table][google.bigtable.admin.v2.Table], if successful.
*
@@ -4140,7 +4154,7 @@ public final OperationFuture
restoreTableAsync(
* Create a new table by restoring from a completed backup. The returned table [long-running
* operation][google.longrunning.Operation] can be used to track the progress of the operation,
* and to cancel it. The [metadata][google.longrunning.Operation.metadata] field type is
- * [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The
+ * [RestoreTableMetadata][google.bigtable.admin.v2.RestoreTableMetadata]. The
* [response][google.longrunning.Operation.response] type is
* [Table][google.bigtable.admin.v2.Table], if successful.
*
@@ -4197,7 +4211,7 @@ public final UnaryCallable
{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+ * BaseBigtableTableAdminClient.create()) {
+ * TableName parent = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
+ * String schemaBundleId = "schemaBundleId2039843326";
+ * SchemaBundle schemaBundle = SchemaBundle.newBuilder().build();
+ * SchemaBundle response =
+ * baseBigtableTableAdminClient
+ * .createSchemaBundleAsync(parent, schemaBundleId, schemaBundle)
+ * .get();
+ * }
+ * }
+ *
+ * @param parent Required. The parent resource where this schema bundle will be created. Values
+ * are of the form `projects/{project}/instances/{instance}/tables/{table}`.
+ * @param schemaBundleId Required. The unique ID to use for the schema bundle, which will become
+ * the final component of the schema bundle's resource name.
+ * @param schemaBundle Required. The schema bundle to create.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+ * BaseBigtableTableAdminClient.create()) {
+ * String parent = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
+ * String schemaBundleId = "schemaBundleId2039843326";
+ * SchemaBundle schemaBundle = SchemaBundle.newBuilder().build();
+ * SchemaBundle response =
+ * baseBigtableTableAdminClient
+ * .createSchemaBundleAsync(parent, schemaBundleId, schemaBundle)
+ * .get();
+ * }
+ * }
+ *
+ * @param parent Required. The parent resource where this schema bundle will be created. Values
+ * are of the form `projects/{project}/instances/{instance}/tables/{table}`.
+ * @param schemaBundleId Required. The unique ID to use for the schema bundle, which will become
+ * the final component of the schema bundle's resource name.
+ * @param schemaBundle Required. The schema bundle to create.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+ * BaseBigtableTableAdminClient.create()) {
+ * CreateSchemaBundleRequest request =
+ * CreateSchemaBundleRequest.newBuilder()
+ * .setParent(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+ * .setSchemaBundleId("schemaBundleId2039843326")
+ * .setSchemaBundle(SchemaBundle.newBuilder().build())
+ * .build();
+ * SchemaBundle response = baseBigtableTableAdminClient.createSchemaBundleAsync(request).get();
+ * }
+ * }
+ *
+ * @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 OperationFuture{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+ * BaseBigtableTableAdminClient.create()) {
+ * CreateSchemaBundleRequest request =
+ * CreateSchemaBundleRequest.newBuilder()
+ * .setParent(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+ * .setSchemaBundleId("schemaBundleId2039843326")
+ * .setSchemaBundle(SchemaBundle.newBuilder().build())
+ * .build();
+ * OperationFuture
+ */
+ public final OperationCallable<
+ CreateSchemaBundleRequest, SchemaBundle, CreateSchemaBundleMetadata>
+ createSchemaBundleOperationCallable() {
+ return stub.createSchemaBundleOperationCallable();
}
- @Override
- public void shutdownNow() {
- stub.shutdownNow();
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a new schema bundle in the specified table.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+ * BaseBigtableTableAdminClient.create()) {
+ * CreateSchemaBundleRequest request =
+ * CreateSchemaBundleRequest.newBuilder()
+ * .setParent(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+ * .setSchemaBundleId("schemaBundleId2039843326")
+ * .setSchemaBundle(SchemaBundle.newBuilder().build())
+ * .build();
+ * ApiFuture
+ */
+ public final UnaryCallable{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+ * BaseBigtableTableAdminClient.create()) {
+ * SchemaBundle schemaBundle = SchemaBundle.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * SchemaBundle response =
+ * baseBigtableTableAdminClient.updateSchemaBundleAsync(schemaBundle, updateMask).get();
+ * }
+ * }
+ *
+ * @param schemaBundle Required. The schema bundle to update.
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+ * BaseBigtableTableAdminClient.create()) {
+ * UpdateSchemaBundleRequest request =
+ * UpdateSchemaBundleRequest.newBuilder()
+ * .setSchemaBundle(SchemaBundle.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .setIgnoreWarnings(true)
+ * .build();
+ * SchemaBundle response = baseBigtableTableAdminClient.updateSchemaBundleAsync(request).get();
+ * }
+ * }
+ *
+ * @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 OperationFuture{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+ * BaseBigtableTableAdminClient.create()) {
+ * UpdateSchemaBundleRequest request =
+ * UpdateSchemaBundleRequest.newBuilder()
+ * .setSchemaBundle(SchemaBundle.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .setIgnoreWarnings(true)
+ * .build();
+ * OperationFuture
+ */
+ public final OperationCallable<
+ UpdateSchemaBundleRequest, SchemaBundle, UpdateSchemaBundleMetadata>
+ updateSchemaBundleOperationCallable() {
+ return stub.updateSchemaBundleOperationCallable();
+ }
- @Override
- protected ListTablesPage createPage(
- PageContext{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+ * BaseBigtableTableAdminClient.create()) {
+ * UpdateSchemaBundleRequest request =
+ * UpdateSchemaBundleRequest.newBuilder()
+ * .setSchemaBundle(SchemaBundle.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .setIgnoreWarnings(true)
+ * .build();
+ * ApiFuture
+ */
+ public final UnaryCallable{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+ * BaseBigtableTableAdminClient.create()) {
+ * SchemaBundleName name =
+ * SchemaBundleName.of("[PROJECT]", "[INSTANCE]", "[TABLE]", "[SCHEMA_BUNDLE]");
+ * SchemaBundle response = baseBigtableTableAdminClient.getSchemaBundle(name);
+ * }
+ * }
+ *
+ * @param name Required. The unique name of the schema bundle to retrieve. Values are of the form
+ * `projects/{project}/instances/{instance}/tables/{table}/schemaBundles/{schema_bundle}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final SchemaBundle getSchemaBundle(SchemaBundleName name) {
+ GetSchemaBundleRequest request =
+ GetSchemaBundleRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return getSchemaBundle(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets metadata information about the specified schema bundle.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+ * BaseBigtableTableAdminClient.create()) {
+ * String name =
+ * SchemaBundleName.of("[PROJECT]", "[INSTANCE]", "[TABLE]", "[SCHEMA_BUNDLE]").toString();
+ * SchemaBundle response = baseBigtableTableAdminClient.getSchemaBundle(name);
+ * }
+ * }
+ *
+ * @param name Required. The unique name of the schema bundle to retrieve. Values are of the form
+ * `projects/{project}/instances/{instance}/tables/{table}/schemaBundles/{schema_bundle}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final SchemaBundle getSchemaBundle(String name) {
+ GetSchemaBundleRequest request = GetSchemaBundleRequest.newBuilder().setName(name).build();
+ return getSchemaBundle(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets metadata information about the specified schema bundle.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+ * BaseBigtableTableAdminClient.create()) {
+ * GetSchemaBundleRequest request =
+ * GetSchemaBundleRequest.newBuilder()
+ * .setName(
+ * SchemaBundleName.of("[PROJECT]", "[INSTANCE]", "[TABLE]", "[SCHEMA_BUNDLE]")
+ * .toString())
+ * .build();
+ * SchemaBundle response = baseBigtableTableAdminClient.getSchemaBundle(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 SchemaBundle getSchemaBundle(GetSchemaBundleRequest request) {
+ return getSchemaBundleCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets metadata information about the specified schema bundle.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+ * BaseBigtableTableAdminClient.create()) {
+ * GetSchemaBundleRequest request =
+ * GetSchemaBundleRequest.newBuilder()
+ * .setName(
+ * SchemaBundleName.of("[PROJECT]", "[INSTANCE]", "[TABLE]", "[SCHEMA_BUNDLE]")
+ * .toString())
+ * .build();
+ * ApiFuture
+ */
+ public final UnaryCallable{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+ * BaseBigtableTableAdminClient.create()) {
+ * TableName parent = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
+ * for (SchemaBundle element :
+ * baseBigtableTableAdminClient.listSchemaBundles(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. The parent, which owns this collection of schema bundles. Values are of
+ * the form `projects/{project}/instances/{instance}/tables/{table}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListSchemaBundlesPagedResponse listSchemaBundles(TableName parent) {
+ ListSchemaBundlesRequest request =
+ ListSchemaBundlesRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .build();
+ return listSchemaBundles(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists all schema bundles associated with the specified table.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+ * BaseBigtableTableAdminClient.create()) {
+ * String parent = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString();
+ * for (SchemaBundle element :
+ * baseBigtableTableAdminClient.listSchemaBundles(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. The parent, which owns this collection of schema bundles. Values are of
+ * the form `projects/{project}/instances/{instance}/tables/{table}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListSchemaBundlesPagedResponse listSchemaBundles(String parent) {
+ ListSchemaBundlesRequest request =
+ ListSchemaBundlesRequest.newBuilder().setParent(parent).build();
+ return listSchemaBundles(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists all schema bundles associated with the specified table.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+ * BaseBigtableTableAdminClient.create()) {
+ * ListSchemaBundlesRequest request =
+ * ListSchemaBundlesRequest.newBuilder()
+ * .setParent(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * for (SchemaBundle element :
+ * baseBigtableTableAdminClient.listSchemaBundles(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 ListSchemaBundlesPagedResponse listSchemaBundles(ListSchemaBundlesRequest request) {
+ return listSchemaBundlesPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists all schema bundles associated with the specified table.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+ * BaseBigtableTableAdminClient.create()) {
+ * ListSchemaBundlesRequest request =
+ * ListSchemaBundlesRequest.newBuilder()
+ * .setParent(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * ApiFuture
+ */
+ public final UnaryCallable{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+ * BaseBigtableTableAdminClient.create()) {
+ * ListSchemaBundlesRequest request =
+ * ListSchemaBundlesRequest.newBuilder()
+ * .setParent(TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * while (true) {
+ * ListSchemaBundlesResponse response =
+ * baseBigtableTableAdminClient.listSchemaBundlesCallable().call(request);
+ * for (SchemaBundle element : response.getSchemaBundlesList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable{@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+ * BaseBigtableTableAdminClient.create()) {
+ * SchemaBundleName name =
+ * SchemaBundleName.of("[PROJECT]", "[INSTANCE]", "[TABLE]", "[SCHEMA_BUNDLE]");
+ * baseBigtableTableAdminClient.deleteSchemaBundle(name);
+ * }
+ * }
+ *
+ * @param name Required. The unique name of the schema bundle to delete. Values are of the form
+ * `projects/{project}/instances/{instance}/tables/{table}/schemaBundles/{schema_bundle}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteSchemaBundle(SchemaBundleName name) {
+ DeleteSchemaBundleRequest request =
+ DeleteSchemaBundleRequest.newBuilder()
+ .setName(name == null ? null : name.toString())
+ .build();
+ deleteSchemaBundle(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes a schema bundle in the specified table.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+ * BaseBigtableTableAdminClient.create()) {
+ * String name =
+ * SchemaBundleName.of("[PROJECT]", "[INSTANCE]", "[TABLE]", "[SCHEMA_BUNDLE]").toString();
+ * baseBigtableTableAdminClient.deleteSchemaBundle(name);
+ * }
+ * }
+ *
+ * @param name Required. The unique name of the schema bundle to delete. Values are of the form
+ * `projects/{project}/instances/{instance}/tables/{table}/schemaBundles/{schema_bundle}`
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final void deleteSchemaBundle(String name) {
+ DeleteSchemaBundleRequest request =
+ DeleteSchemaBundleRequest.newBuilder().setName(name).build();
+ deleteSchemaBundle(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes a schema bundle in the specified table.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+ * BaseBigtableTableAdminClient.create()) {
+ * DeleteSchemaBundleRequest request =
+ * DeleteSchemaBundleRequest.newBuilder()
+ * .setName(
+ * SchemaBundleName.of("[PROJECT]", "[INSTANCE]", "[TABLE]", "[SCHEMA_BUNDLE]")
+ * .toString())
+ * .setEtag("etag3123477")
+ * .build();
+ * baseBigtableTableAdminClient.deleteSchemaBundle(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 deleteSchemaBundle(DeleteSchemaBundleRequest request) {
+ deleteSchemaBundleCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes a schema bundle in the specified table.
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BaseBigtableTableAdminClient baseBigtableTableAdminClient =
+ * BaseBigtableTableAdminClient.create()) {
+ * DeleteSchemaBundleRequest request =
+ * DeleteSchemaBundleRequest.newBuilder()
+ * .setName(
+ * SchemaBundleName.of("[PROJECT]", "[INSTANCE]", "[TABLE]", "[SCHEMA_BUNDLE]")
+ * .toString())
+ * .setEtag("etag3123477")
+ * .build();
+ * ApiFuture
+ */
+ public final UnaryCallable{@code
+ * MaterializedView materializedView = client.createMaterializedView(
+ * CreateMaterializedViewRequest.of("my-instance", "my-new-materialized-view")
+ * .setQuery(query)
+ * );
+ * }
+ *
+ * @see CreateMaterializedViewRequest
+ */
+ @SuppressWarnings("WeakerAccess")
+ public MaterializedView createMaterializedView(CreateMaterializedViewRequest request) {
+ return ApiExceptions.callAndTranslateApiException(createMaterializedViewAsync(request));
+ }
+
+ /**
+ * Asynchronously creates a new materialized view.
+ *
+ * {@code
+ * ApiFuture
+ *
+ * @see CreateMaterializedViewRequest
+ */
+ @SuppressWarnings("WeakerAccess")
+ public ApiFuture{@code
+ * MaterializedView materializedView = client.getMaterializedView("my-instance", "my-materialized-view");
+ * }
+ *
+ * @see MaterializedView
+ */
+ public MaterializedView getMaterializedView(String instanceId, String materializedViewId) {
+ return ApiExceptions.callAndTranslateApiException(
+ getMaterializedViewAsync(instanceId, materializedViewId));
+ }
+
+ /**
+ * Asynchronously gets the materialized view by ID.
+ *
+ * {@code
+ * ApiFuture
+ *
+ * @see MaterializedView
+ */
+ @SuppressWarnings("WeakerAccess")
+ public ApiFuture{@code
+ * List
+ *
+ * @see MaterializedView
+ */
+ @SuppressWarnings("WeakerAccess")
+ public List{@code
+ * ApiFuture
+ *
+ * @see MaterializedView
+ */
+ @SuppressWarnings("WeakerAccess")
+ public ApiFuture> materializedViewsFuture = client.listMaterializedViewsAsync("my-instance");
+ *
+ * List
> listMaterializedViewsAsync(String instanceId) {
+ String instanceName = NameUtil.formatInstanceName(projectId, instanceId);
+
+ ListMaterializedViewsRequest request =
+ ListMaterializedViewsRequest.newBuilder().setParent(instanceName).build();
+
+ // TODO(igorbernstein2): try to upstream pagination spooling or figure out a way to expose the
+ // paginated responses while maintaining the wrapper facade.
+
+ // Fetches the first page.
+ ApiFuture
> allProtos =
+ ApiFutures.transformAsync(
+ firstPageFuture,
+ new ApiAsyncFunction<
+ ListMaterializedViewsPage, List
> apply(
+ ListMaterializedViewsPage page) {
+ // Add all entries from the page
+ responseAccumulator.addAll(Lists.newArrayList(page.getValues()));
+
+ // If this is the last page, just return the accumulated responses.
+ if (!page.hasNextPage()) {
+ return ApiFutures.immediateFuture(responseAccumulator);
+ }
+
+ // Otherwise fetch the next page.
+ return ApiFutures.transformAsync(
+ page.getNextPageAsync(), this, MoreExecutors.directExecutor());
+ }
+ },
+ MoreExecutors.directExecutor());
+
+ // Wraps all of the accumulated protos.
+ return ApiFutures.transform(
+ allProtos,
+ new ApiFunction<
+ List
{@code
+ * MaterializedView existingMaterializedView = client.getMaterializedView("my-instance", "my-materialized-view");
+ *
+ * MaterializedView updatedMaterializedView = client.updateMaterializedView(
+ * UpdateMaterializedViewRequest.of(existingMaterializedView)
+ * .setDeletionProtection(false)
+ * );
+ * }
+ *
+ * @see UpdateMaterializedViewRequest
+ */
+ @SuppressWarnings("WeakerAccess")
+ public MaterializedView updateMaterializedView(UpdateMaterializedViewRequest request) {
+ return ApiExceptions.callAndTranslateApiException(updateMaterializedViewAsync(request));
+ }
+
+ /**
+ * Asynchronously updates an existing materialized view.
+ *
+ * {@code
+ * ApiFuture
+ *
+ * @see UpdateMaterializedViewRequest
+ */
+ @SuppressWarnings("WeakerAccess")
+ public ApiFuture{@code
+ * client.deleteMaterializedView("my-instance", "my-materialized-view");
+ * }
+ */
+ @SuppressWarnings("WeakerAccess")
+ public void deleteMaterializedView(String instanceId, String materializedViewId) {
+ ApiExceptions.callAndTranslateApiException(
+ deleteMaterializedViewAsync(instanceId, materializedViewId));
+ }
+
+ /**
+ * Asynchronously deletes the specified materialized view.
+ *
+ * {@code
+ * ApiFuture
+ */
+ @SuppressWarnings("WeakerAccess")
+ public ApiFuture{@code
+ * LogicalView logicalView = client.createLogicalView(
+ * CreateLogicalViewRequest.of("my-instance", "my-new-logical-view")
+ * .setQuery(query)
+ * );
+ * }
+ *
+ * @see CreateLogicalViewRequest
+ */
+ @SuppressWarnings("WeakerAccess")
+ public LogicalView createLogicalView(CreateLogicalViewRequest request) {
+ return ApiExceptions.callAndTranslateApiException(createLogicalViewAsync(request));
+ }
+
+ /**
+ * Asynchronously creates a new logical view.
+ *
+ * {@code
+ * ApiFuture
+ *
+ * @see CreateLogicalViewRequest
+ */
+ @SuppressWarnings("WeakerAccess")
+ public ApiFuture{@code
+ * LogicalView logicalView = client.getLogicalView("my-instance", "my-logical-view");
+ * }
+ *
+ * @see LogicalView
+ */
+ public LogicalView getLogicalView(String instanceId, String logicalViewId) {
+ return ApiExceptions.callAndTranslateApiException(
+ getLogicalViewAsync(instanceId, logicalViewId));
+ }
+
+ /**
+ * Asynchronously gets the logical view by ID.
+ *
+ * {@code
+ * ApiFuture
+ *
+ * @see LogicalView
+ */
+ @SuppressWarnings("WeakerAccess")
+ public ApiFuture{@code
+ * List
+ *
+ * @see LogicalView
+ */
+ @SuppressWarnings("WeakerAccess")
+ public List{@code
+ * ApiFuture
+ *
+ * @see LogicalView
+ */
+ @SuppressWarnings("WeakerAccess")
+ public ApiFuture> logicalViewsFuture = client.listLogicalViewsAsync("my-instance");
+ *
+ * List
> listLogicalViewsAsync(String instanceId) {
+ String instanceName = NameUtil.formatInstanceName(projectId, instanceId);
+
+ ListLogicalViewsRequest request =
+ ListLogicalViewsRequest.newBuilder().setParent(instanceName).build();
+
+ // TODO(igorbernstein2): try to upstream pagination spooling or figure out a way to expose the
+ // paginated responses while maintaining the wrapper facade.
+
+ // Fetches the first page.
+ ApiFuture
> allProtos =
+ ApiFutures.transformAsync(
+ firstPageFuture,
+ new ApiAsyncFunction<
+ ListLogicalViewsPage, List
> apply(
+ ListLogicalViewsPage page) {
+ // Add all entries from the page
+ responseAccumulator.addAll(Lists.newArrayList(page.getValues()));
+
+ // If this is the last page, just return the accumulated responses.
+ if (!page.hasNextPage()) {
+ return ApiFutures.immediateFuture(responseAccumulator);
+ }
+
+ // Otherwise fetch the next page.
+ return ApiFutures.transformAsync(
+ page.getNextPageAsync(), this, MoreExecutors.directExecutor());
+ }
+ },
+ MoreExecutors.directExecutor());
+
+ // Wraps all of the accumulated protos.
+ return ApiFutures.transform(
+ allProtos,
+ new ApiFunction
, List
{@code
+ * LogicalView existingLogicalView = client.getLogicalView("my-instance", "my-logical-view");
+ *
+ * LogicalView updatedLogicalView = client.updateLogicalView(
+ * UpdateLogicalViewRequest.of(existingLogicalView)
+ * .setQuery(query)
+ * );
+ * }
+ *
+ * @see UpdateLogicalViewRequest
+ */
+ @SuppressWarnings("WeakerAccess")
+ public LogicalView updateLogicalView(UpdateLogicalViewRequest request) {
+ return ApiExceptions.callAndTranslateApiException(updateLogicalViewAsync(request));
+ }
+
+ /**
+ * Asynchronously updates an existing logical view.
+ *
+ * {@code
+ * ApiFuture
+ *
+ * @see UpdateLogicalViewRequest
+ */
+ @SuppressWarnings("WeakerAccess")
+ public ApiFuture{@code
+ * client.deleteLogicalView("my-instance", "my-logical-view");
+ * }
+ */
+ @SuppressWarnings("WeakerAccess")
+ public void deleteLogicalView(String instanceId, String logicalViewId) {
+ ApiExceptions.callAndTranslateApiException(deleteLogicalViewAsync(instanceId, logicalViewId));
+ }
+
+ /**
+ * Asynchronously deletes the specified logical view.
+ *
+ * {@code
+ * ApiFuture
+ */
+ @SuppressWarnings("WeakerAccess")
+ public ApiFuture{@code
+ * CreateSchemaBundleRequest request = CreateSchemaBundleRequest.of("my-table", "my-new-schema-bundle")
+ * .setDeletionProtection(true)
+ * .setSchemaBundleType(
+ * SubsetView.create()
+ * .addRowPrefix("row#")
+ * .addFamilySubsets(
+ * "my-family", FamilySubsets.create().addQualifier("column")));
+ *
+ * SchemaBundle response = client.createSchemaBundle(request);
+ * }
+ *
+ * @see CreateSchemaBundleRequest for available options.
+ */
+ public SchemaBundle createSchemaBundle(CreateSchemaBundleRequest request) {
+ return ApiExceptions.callAndTranslateApiException(createSchemaBundleAsync(request));
+ }
+
+ /**
+ * Asynchronously creates a new schema bundle with the specified configuration.
+ *
+ * {@code
+ * CreateSchemaBundleRequest request = CreateSchemaBundleRequest.of("my-table", "my-new-schema-bundle")
+ * .setDeletionProtection(true)
+ * .setSchemaBundleType(
+ * SubsetView.create()
+ * .addRowPrefix("row#")
+ * .addFamilySubsets(
+ * "my-family", FamilySubsets.create().addQualifier("column")));
+ *
+ * ApiFuture
+ *
+ * @see CreateSchemaBundleRequest for available options.
+ */
+ public ApiFuture{@code
+ * SchemaBundle existingSchemaBundle = client.getSchemaBundle("my-table", "my-schema-bundle");
+ *
+ * UpdateSchemaBundleRequest request = UpdateSchemaBundleRequest.of(existingSchemaBundle).setDeletionProtection(true);
+ *
+ * SchemaBundle response = client.updateSchemaBundle(request);
+ * }
+ *
+ * @see UpdateSchemaBundleRequest for available options.
+ */
+ public SchemaBundle updateSchemaBundle(UpdateSchemaBundleRequest request) {
+ return ApiExceptions.callAndTranslateApiException(updateSchemaBundleAsync(request));
+ }
+
+ /**
+ * Asynchronously updates an existing schema bundle with the specified configuration.
+ *
+ * {@code
+ * SchemaBundle existingSchemaBundle = client.getSchemaBundle("my-table", "my-schema-bundle");
+ *
+ * UpdateSchemaBundleRequest request = UpdateSchemaBundleRequest.of(existingSchemaBundle).setDeletionProtection(true);
+ *
+ * ApiFuture
+ *
+ * @see UpdateSchemaBundleRequest for available options.
+ */
+ public ApiFuture{@code
+ * SchemaBundle schemaBundle = client.getSchemaBundle("my-table", "my-schema-bundle");
+ * }
+ */
+ public SchemaBundle getSchemaBundle(String tableId, String schemaBundleId) {
+ return ApiExceptions.callAndTranslateApiException(
+ getSchemaBundleAsync(tableId, schemaBundleId));
+ }
+
+ /**
+ * Asynchronously gets an schema bundle with the specified schema bundle ID in the specified
+ * table.
+ *
+ * {@code
+ * ApiFuture
+ */
+ public ApiFuture{@code
+ * List
+ */
+ public List{@code
+ * ApiFuture
+ */
+ public ApiFuture> future = client.listSchemaBundlesAsync("my-table");
+ *
+ * ApiFutures.addCallback(
+ * future,
+ * new ApiFutureCallback
>() {
+ * public void onSuccess(List
> listSchemaBundlesAsync(String tableId) {
+ ListSchemaBundlesRequest request =
+ ListSchemaBundlesRequest.newBuilder()
+ .setParent(NameUtil.formatTableName(projectId, instanceId, tableId))
+ .build();
+
+ // TODO(igorbernstein2): try to upstream pagination spooling or figure out a way
+ // to expose the
+ // paginated responses while maintaining the wrapper facade.
+
+ // Fetches the first page.
+ ApiFuture
> allProtos =
+ ApiFutures.transformAsync(
+ firstPageFuture,
+ new ApiAsyncFunction<
+ ListSchemaBundlesPage, List
> apply(
+ ListSchemaBundlesPage page) {
+ // Add all entries from the page
+ responseAccumulator.addAll(Lists.newArrayList(page.getValues()));
+
+ // If this is the last page, just return the accumulated responses.
+ if (!page.hasNextPage()) {
+ return ApiFutures.immediateFuture(responseAccumulator);
+ }
+
+ // Otherwise fetch the next page.
+ return ApiFutures.transformAsync(
+ page.getNextPageAsync(), this, MoreExecutors.directExecutor());
+ }
+ },
+ MoreExecutors.directExecutor());
+
+ // Wraps all of the accumulated protos.
+ return ApiFutures.transform(
+ allProtos,
+ new ApiFunction
, List
{@code
+ * client.deleteSchemaBundle("my-table", "my-schema-bundle");
+ * }
+ */
+ public void deleteSchemaBundle(String tableId, String schemaBundleId) {
+ ApiExceptions.callAndTranslateApiException(deleteSchemaBundleAsync(tableId, schemaBundleId));
+ }
+
+ /**
+ * Asynchronously deletes an schema bundle with the specified schema bundle ID in the specified
+ * table. Note that the deletion is prohibited if the schema bundle has deletion_protection field
+ * set to true.
+ *
+ * {@code
+ * ApiFuture
+ */
+ public ApiFuture{@code
+ * LogicalView existingLogicalView = ...;
+ * CreateLogicalViewRequest logicalViewRequest = CreateLogicalViewRequest.of("my-instance", "my-new-logical-view")
+ * .setQuery("...").setDeletionProtection(true);
+ * }
+ *
+ * @see LogicalView for more details
+ */
+public final class CreateLogicalViewRequest {
+ private final String instanceId;
+ private final com.google.bigtable.admin.v2.CreateLogicalViewRequest.Builder proto;
+
+ /** Builds a new request to create a new logical view in the specified instance. */
+ public static CreateLogicalViewRequest of(String instanceId, String logicalViewId) {
+ return new CreateLogicalViewRequest(instanceId, logicalViewId);
+ }
+
+ private CreateLogicalViewRequest(String instanceId, String logicalViewId) {
+ this.instanceId = instanceId;
+ this.proto = com.google.bigtable.admin.v2.CreateLogicalViewRequest.newBuilder();
+
+ proto.setLogicalViewId(logicalViewId);
+ }
+
+ /** Sets the query of the LogicalView. */
+ @SuppressWarnings("WeakerAccess")
+ public CreateLogicalViewRequest setQuery(@Nonnull String query) {
+ proto.getLogicalViewBuilder().setQuery(query);
+ return this;
+ }
+
+ /** Configures if the logical view is deletion protected. */
+ @SuppressWarnings("WeakerAccess")
+ public CreateLogicalViewRequest setDeletionProtection(boolean value) {
+ proto.getLogicalViewBuilder().setDeletionProtection(value);
+ return this;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ CreateLogicalViewRequest that = (CreateLogicalViewRequest) o;
+ return Objects.equal(proto.build(), that.proto.build())
+ && Objects.equal(instanceId, that.instanceId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(proto.build(), instanceId);
+ }
+
+ /**
+ * Creates the request protobuf. This method is considered an internal implementation detail and
+ * not meant to be used by applications.
+ */
+ @InternalApi
+ public com.google.bigtable.admin.v2.CreateLogicalViewRequest toProto(String projectId) {
+ String name = NameUtil.formatInstanceName(projectId, instanceId);
+
+ return proto.setParent(name).build();
+ }
+}
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/CreateMaterializedViewRequest.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/CreateMaterializedViewRequest.java
new file mode 100644
index 0000000000..983a0a48e1
--- /dev/null
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/CreateMaterializedViewRequest.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2018 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.bigtable.admin.v2.models;
+
+import com.google.api.core.InternalApi;
+import com.google.cloud.bigtable.admin.v2.internal.NameUtil;
+import com.google.common.base.Objects;
+import javax.annotation.Nonnull;
+
+/**
+ * Parameters for creating a new Cloud Bigtable materialized view.
+ *
+ * {@code
+ * MaterializedView existingMaterializedView = ...;
+ * CreateMaterializedViewRequest materializedViewRequest = CreateMaterializedViewRequest.of("my-instance", "my-new-materialized-view")
+ * .setQuery("...");
+ * }
+ *
+ * @see MaterializedView for more details
+ */
+public final class CreateMaterializedViewRequest {
+ private final String instanceId;
+ private final com.google.bigtable.admin.v2.CreateMaterializedViewRequest.Builder proto;
+
+ /** Builds a new request to create a new materialized view in the specified instance. */
+ public static CreateMaterializedViewRequest of(String instanceId, String materializedViewId) {
+ return new CreateMaterializedViewRequest(instanceId, materializedViewId);
+ }
+
+ private CreateMaterializedViewRequest(String instanceId, String materializedViewId) {
+ this.instanceId = instanceId;
+ this.proto = com.google.bigtable.admin.v2.CreateMaterializedViewRequest.newBuilder();
+
+ proto.setMaterializedViewId(materializedViewId);
+ }
+
+ /** Configures if the materialized view is deletion protected. */
+ @SuppressWarnings("WeakerAccess")
+ public CreateMaterializedViewRequest setDeletionProtection(boolean value) {
+ proto.getMaterializedViewBuilder().setDeletionProtection(value);
+ return this;
+ }
+
+ /** Sets the query of the MaterializedView. */
+ @SuppressWarnings("WeakerAccess")
+ public CreateMaterializedViewRequest setQuery(@Nonnull String query) {
+ proto.getMaterializedViewBuilder().setQuery(query);
+ return this;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ CreateMaterializedViewRequest that = (CreateMaterializedViewRequest) o;
+ return Objects.equal(proto.build(), that.proto.build())
+ && Objects.equal(instanceId, that.instanceId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(proto.build(), instanceId);
+ }
+
+ /**
+ * Creates the request protobuf. This method is considered an internal implementation detail and
+ * not meant to be used by applications.
+ */
+ @InternalApi
+ public com.google.bigtable.admin.v2.CreateMaterializedViewRequest toProto(String projectId) {
+ String name = NameUtil.formatInstanceName(projectId, instanceId);
+
+ return proto.setParent(name).build();
+ }
+}
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/CreateSchemaBundleRequest.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/CreateSchemaBundleRequest.java
new file mode 100644
index 0000000000..ea966d81c4
--- /dev/null
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/CreateSchemaBundleRequest.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2024 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.bigtable.admin.v2.models;
+
+import com.google.api.core.InternalApi;
+import com.google.bigtable.admin.v2.ProtoSchema;
+import com.google.cloud.bigtable.admin.v2.internal.NameUtil;
+import com.google.common.base.Objects;
+import com.google.common.base.Preconditions;
+import com.google.protobuf.ByteString;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import javax.annotation.Nonnull;
+
+/**
+ * Parameters for creating a new Cloud Bigtable {@link SchemaBundle}, which represents subsets of a
+ * particular table.
+ *
+ * {@code
+ * CreateSchemaBundleRequest request =
+ * CreateSchemaBundleRequest.of("my-table", "my-new-schema-bundle")
+ * .setProtoSchemaFile("proto_file.pb");
+ * }
+ *
+ * @see SchemaBundle for more details.
+ */
+public final class CreateSchemaBundleRequest {
+ private final String tableId;
+ private final com.google.bigtable.admin.v2.CreateSchemaBundleRequest.Builder requestBuilder =
+ com.google.bigtable.admin.v2.CreateSchemaBundleRequest.newBuilder();
+
+ public static CreateSchemaBundleRequest of(
+ @Nonnull String tableId, @Nonnull String schemaBundleId) {
+ return new CreateSchemaBundleRequest(tableId, schemaBundleId);
+ }
+
+ private CreateSchemaBundleRequest(@Nonnull String tableId, @Nonnull String schemaBundleId) {
+ Preconditions.checkNotNull(tableId, "tableId must be set");
+ Preconditions.checkNotNull(schemaBundleId, "schemaBundleId must be set");
+
+ this.tableId = tableId;
+ requestBuilder.setSchemaBundleId(schemaBundleId);
+ }
+
+ /** Sets the proto schema for this schema bundle. */
+ public CreateSchemaBundleRequest setProtoSchemaFile(@Nonnull String protoSchemaFile)
+ throws IOException {
+ Preconditions.checkNotNull(protoSchemaFile, "protoSchemaFile must be set");
+ byte[] content = Files.readAllBytes(Paths.get(protoSchemaFile));
+ return setProtoSchema(ByteString.copyFrom(content));
+ }
+
+ /** Sets the proto schema for this schema bundle. */
+ public CreateSchemaBundleRequest setProtoSchema(@Nonnull ByteString protoSchema)
+ throws IOException {
+ Preconditions.checkNotNull(protoSchema, "protoSchema must be set");
+ requestBuilder.setSchemaBundle(
+ com.google.bigtable.admin.v2.SchemaBundle.newBuilder()
+ .setProtoSchema(ProtoSchema.newBuilder().setProtoDescriptors(protoSchema)));
+ return this;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ CreateSchemaBundleRequest that = (CreateSchemaBundleRequest) o;
+ return Objects.equal(requestBuilder.build(), that.requestBuilder.build())
+ && Objects.equal(tableId, that.tableId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(requestBuilder.build(), tableId);
+ }
+
+ /**
+ * Creates the request protobuf. This method is considered an internal implementation detail and
+ * not meant to be used by applications.
+ */
+ @InternalApi
+ public com.google.bigtable.admin.v2.CreateSchemaBundleRequest toProto(
+ @Nonnull String projectId, @Nonnull String instanceId) {
+ return requestBuilder
+ .setParent(NameUtil.formatTableName(projectId, instanceId, tableId))
+ .build();
+ }
+}
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/CreateTableRequest.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/CreateTableRequest.java
index 0fbffcb190..88e6b99c22 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/CreateTableRequest.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/CreateTableRequest.java
@@ -100,14 +100,14 @@ public CreateTableRequest addFamily(
return this;
}
- /** Adds split at the specified key to the configuration */
+ /** Adds split at the specified key to the configuration. */
public CreateTableRequest addSplit(ByteString key) {
Preconditions.checkNotNull(key);
requestBuilder.addInitialSplitsBuilder().setKey(key);
return this;
}
- /** Add change stream retention period between 1 day and 7 days */
+ /** Add change stream retention period between 1 day and 7 days. */
public CreateTableRequest addChangeStreamRetention(Duration retention) {
Preconditions.checkNotNull(retention);
requestBuilder
@@ -123,6 +123,32 @@ public CreateTableRequest addChangeStreamRetention(Duration retention) {
return this;
}
+ /** Configures if the table is deletion protected. */
+ public CreateTableRequest setDeletionProtection(boolean deletionProtection) {
+ requestBuilder.getTableBuilder().setDeletionProtection(deletionProtection);
+ return this;
+ }
+
+ /** Set an automated backup policy for the table. */
+ public CreateTableRequest setAutomatedBackup(Duration retentionPeriod, Duration frequency) {
+ com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy policy =
+ com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy.newBuilder()
+ .setRetentionPeriod(
+ com.google.protobuf.Duration.newBuilder()
+ .setSeconds(retentionPeriod.getSeconds())
+ .setNanos(retentionPeriod.getNano())
+ .build())
+ .setFrequency(
+ com.google.protobuf.Duration.newBuilder()
+ .setSeconds(frequency.getSeconds())
+ .setNanos(frequency.getNano())
+ .build())
+ .build();
+
+ requestBuilder.getTableBuilder().setAutomatedBackupPolicy(policy);
+ return this;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) {
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/LogicalView.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/LogicalView.java
new file mode 100644
index 0000000000..48100c81de
--- /dev/null
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/LogicalView.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2024 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.bigtable.admin.v2.models;
+
+import com.google.api.core.InternalApi;
+import com.google.bigtable.admin.v2.LogicalViewName;
+import com.google.common.base.Objects;
+import com.google.common.base.Preconditions;
+import com.google.common.base.Verify;
+import javax.annotation.Nonnull;
+
+/**
+ * A class that wraps the {@link com.google.bigtable.admin.v2.LogicalView} protocol buffer object.
+ *
+ * {@code
+ * LogicalView existingLogicalView = client.getLogicalView("my-table", "my-logical-view");
+ * UpdateLogicalViewRequest request =
+ * UpdateLogicalViewRequest.of(existingLogicalView).setQuery(query);
+ * }
+ *
+ * @see LogicalView for more details.
+ */
+public final class UpdateLogicalViewRequest {
+ private final com.google.bigtable.admin.v2.UpdateLogicalViewRequest.Builder requestBuilder;
+ private final String instanceId;
+ private final String logicalViewId;
+
+ /** Builds a new update request using an existing logical view. */
+ public static UpdateLogicalViewRequest of(@Nonnull LogicalView logicalView) {
+ return new UpdateLogicalViewRequest(
+ logicalView.getId(),
+ logicalView.getInstanceId(),
+ com.google.bigtable.admin.v2.UpdateLogicalViewRequest.newBuilder()
+ .setLogicalView(logicalView.toProto()));
+ }
+
+ /** Builds a new update logical view request. */
+ public static UpdateLogicalViewRequest of(
+ @Nonnull String instanceId, @Nonnull String logicalViewId) {
+ return new UpdateLogicalViewRequest(
+ logicalViewId,
+ instanceId,
+ com.google.bigtable.admin.v2.UpdateLogicalViewRequest.newBuilder());
+ }
+
+ private UpdateLogicalViewRequest(
+ @Nonnull String logicalViewId,
+ @Nonnull String instanceId,
+ @Nonnull com.google.bigtable.admin.v2.UpdateLogicalViewRequest.Builder requestBuilder) {
+ Preconditions.checkNotNull(instanceId, "instanceId must be set");
+ Preconditions.checkNotNull(logicalViewId, "logicalViewId must be set");
+ Preconditions.checkNotNull(requestBuilder, "proto builder must be set");
+
+ this.instanceId = instanceId;
+ this.logicalViewId = logicalViewId;
+ this.requestBuilder = requestBuilder;
+ }
+
+ /** Changes the query of an existing logical view. */
+ public UpdateLogicalViewRequest setQuery(String query) {
+ requestBuilder.getLogicalViewBuilder().setQuery(query);
+ updateFieldMask(com.google.bigtable.admin.v2.LogicalView.QUERY_FIELD_NUMBER);
+ return this;
+ }
+
+ /** Changes the deletion protection of an existing logical view. */
+ public UpdateLogicalViewRequest setDeletionProtection(boolean deletionProtection) {
+ requestBuilder.getLogicalViewBuilder().setDeletionProtection(deletionProtection);
+ updateFieldMask(com.google.bigtable.admin.v2.LogicalView.DELETION_PROTECTION_FIELD_NUMBER);
+ return this;
+ }
+
+ private void updateFieldMask(int fieldNumber) {
+ FieldMask newMask =
+ FieldMaskUtil.fromFieldNumbers(com.google.bigtable.admin.v2.LogicalView.class, fieldNumber);
+ requestBuilder.setUpdateMask(FieldMaskUtil.union(requestBuilder.getUpdateMask(), newMask));
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ UpdateLogicalViewRequest that = (UpdateLogicalViewRequest) o;
+ return Objects.equal(requestBuilder.build(), that.requestBuilder.build())
+ && Objects.equal(logicalViewId, that.logicalViewId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(requestBuilder.build(), logicalViewId);
+ }
+
+ /**
+ * Creates the request protobuf. This method is considered an internal implementation detail and
+ * not meant to be used by applications.
+ */
+ @InternalApi
+ public com.google.bigtable.admin.v2.UpdateLogicalViewRequest toProto(@Nonnull String projectId) {
+ requestBuilder
+ .getLogicalViewBuilder()
+ .setName(NameUtil.formatLogicalViewName(projectId, instanceId, logicalViewId));
+ return requestBuilder.build();
+ }
+}
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/UpdateMaterializedViewRequest.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/UpdateMaterializedViewRequest.java
new file mode 100644
index 0000000000..57823da81f
--- /dev/null
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/UpdateMaterializedViewRequest.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2024 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.bigtable.admin.v2.models;
+
+import com.google.api.core.InternalApi;
+import com.google.cloud.bigtable.admin.v2.internal.NameUtil;
+import com.google.common.base.Objects;
+import com.google.common.base.Preconditions;
+import com.google.protobuf.FieldMask;
+import com.google.protobuf.util.FieldMaskUtil;
+import javax.annotation.Nonnull;
+
+/**
+ * Parameters for updating an existing Cloud Bigtable {@link MaterializedView}.
+ *
+ * {@code
+ * MaterializedView existingMaterializedView = client.getMaterializedView("my-table", "my-materialized-view");
+ * UpdateMaterializedViewRequest request =
+ * UpdateMaterializedViewRequest.of(existingMaterializedView).setDeletionProtection(true);
+ * }
+ *
+ * @see MaterializedView for more details.
+ */
+public final class UpdateMaterializedViewRequest {
+ private final com.google.bigtable.admin.v2.UpdateMaterializedViewRequest.Builder requestBuilder;
+ private final String instanceId;
+ private final String materializedViewId;
+
+ /** Builds a new update request using an existing materialized view. */
+ public static UpdateMaterializedViewRequest of(@Nonnull MaterializedView materializedView) {
+ return new UpdateMaterializedViewRequest(
+ materializedView.getId(),
+ materializedView.getInstanceId(),
+ com.google.bigtable.admin.v2.UpdateMaterializedViewRequest.newBuilder()
+ .setMaterializedView(materializedView.toProto()));
+ }
+
+ /** Builds a new update materialized view request. */
+ public static UpdateMaterializedViewRequest of(
+ @Nonnull String instanceId, @Nonnull String materializedViewId) {
+ return new UpdateMaterializedViewRequest(
+ materializedViewId,
+ instanceId,
+ com.google.bigtable.admin.v2.UpdateMaterializedViewRequest.newBuilder());
+ }
+
+ private UpdateMaterializedViewRequest(
+ @Nonnull String materializedViewId,
+ @Nonnull String instanceId,
+ @Nonnull com.google.bigtable.admin.v2.UpdateMaterializedViewRequest.Builder requestBuilder) {
+ Preconditions.checkNotNull(instanceId, "instanceId must be set");
+ Preconditions.checkNotNull(materializedViewId, "materializedViewId must be set");
+ Preconditions.checkNotNull(requestBuilder, "proto builder must be set");
+
+ this.instanceId = instanceId;
+ this.materializedViewId = materializedViewId;
+ this.requestBuilder = requestBuilder;
+ }
+
+ /** Changes the deletion protection of an existing materialized view. */
+ public UpdateMaterializedViewRequest setDeletionProtection(boolean deletionProtection) {
+ requestBuilder.getMaterializedViewBuilder().setDeletionProtection(deletionProtection);
+ updateFieldMask(com.google.bigtable.admin.v2.MaterializedView.DELETION_PROTECTION_FIELD_NUMBER);
+ return this;
+ }
+
+ private void updateFieldMask(int fieldNumber) {
+ FieldMask newMask =
+ FieldMaskUtil.fromFieldNumbers(
+ com.google.bigtable.admin.v2.MaterializedView.class, fieldNumber);
+ requestBuilder.setUpdateMask(FieldMaskUtil.union(requestBuilder.getUpdateMask(), newMask));
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ UpdateMaterializedViewRequest that = (UpdateMaterializedViewRequest) o;
+ return Objects.equal(requestBuilder.build(), that.requestBuilder.build())
+ && Objects.equal(materializedViewId, that.materializedViewId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(requestBuilder.build(), materializedViewId);
+ }
+
+ /**
+ * Creates the request protobuf. This method is considered an internal implementation detail and
+ * not meant to be used by applications.
+ */
+ @InternalApi
+ public com.google.bigtable.admin.v2.UpdateMaterializedViewRequest toProto(
+ @Nonnull String projectId) {
+ requestBuilder
+ .getMaterializedViewBuilder()
+ .setName(NameUtil.formatMaterializedViewName(projectId, instanceId, materializedViewId));
+ return requestBuilder.build();
+ }
+}
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/UpdateSchemaBundleRequest.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/UpdateSchemaBundleRequest.java
new file mode 100644
index 0000000000..904c4d0097
--- /dev/null
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/UpdateSchemaBundleRequest.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright 2024 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.bigtable.admin.v2.models;
+
+import com.google.api.core.InternalApi;
+import com.google.bigtable.admin.v2.ProtoSchema;
+import com.google.cloud.bigtable.admin.v2.internal.NameUtil;
+import com.google.common.base.Objects;
+import com.google.common.base.Preconditions;
+import com.google.protobuf.ByteString;
+import com.google.protobuf.FieldMask;
+import com.google.protobuf.util.FieldMaskUtil;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import javax.annotation.Nonnull;
+
+/**
+ * Parameters for updating an existing Cloud Bigtable {@link SchemaBundle}.
+ *
+ * {@code
+ * SchemaBundle existingSchemaBundle = client.getSchemaBundle("my-table", "my-schema-bundle");
+ * UpdateSchemaBundleRequest request =
+ * UpdateSchemaBundleRequest.of(existingSchemaBundle).setProtoSchemaFile("file.pb");
+ * }
+ *
+ * @see SchemaBundle for more details.
+ */
+public final class UpdateSchemaBundleRequest {
+ private final com.google.bigtable.admin.v2.UpdateSchemaBundleRequest.Builder requestBuilder;
+ private final String tableId;
+ private final String schemaBundleId;
+
+ /** Builds a new update request using an existing schema bundle. */
+ public static UpdateSchemaBundleRequest of(@Nonnull SchemaBundle schemaBundle) {
+ return new UpdateSchemaBundleRequest(
+ schemaBundle.getTableId(),
+ schemaBundle.getId(),
+ com.google.bigtable.admin.v2.UpdateSchemaBundleRequest.newBuilder()
+ .setSchemaBundle(schemaBundle.toProto()));
+ }
+
+ /** Builds a new update schema bundle request. */
+ public static UpdateSchemaBundleRequest of(
+ @Nonnull String tableId, @Nonnull String schemaBundleId) {
+ return new UpdateSchemaBundleRequest(
+ tableId,
+ schemaBundleId,
+ com.google.bigtable.admin.v2.UpdateSchemaBundleRequest.newBuilder());
+ }
+
+ private UpdateSchemaBundleRequest(
+ @Nonnull String tableId,
+ @Nonnull String schemaBundleId,
+ @Nonnull com.google.bigtable.admin.v2.UpdateSchemaBundleRequest.Builder requestBuilder) {
+ Preconditions.checkNotNull(tableId, "tableId must be set");
+ Preconditions.checkNotNull(schemaBundleId, "schemaBundleId must be set");
+ Preconditions.checkNotNull(requestBuilder, "proto builder must be set");
+
+ this.tableId = tableId;
+ this.schemaBundleId = schemaBundleId;
+ this.requestBuilder = requestBuilder;
+ }
+
+ /** Sets the proto schema for this schema bundle. */
+ public UpdateSchemaBundleRequest setProtoSchemaFile(@Nonnull String protoSchemaFile)
+ throws IOException {
+ Preconditions.checkNotNull(protoSchemaFile, "protoSchemaFile must be set");
+ byte[] content = Files.readAllBytes(Paths.get(protoSchemaFile));
+ return setProtoSchema(ByteString.copyFrom(content));
+ }
+
+ /** Sets the proto schema for this schema bundle. */
+ public UpdateSchemaBundleRequest setProtoSchema(@Nonnull ByteString protoSchema)
+ throws IOException {
+ Preconditions.checkNotNull(protoSchema, "protoSchema must be set");
+ requestBuilder.setSchemaBundle(
+ com.google.bigtable.admin.v2.SchemaBundle.newBuilder()
+ .setProtoSchema(ProtoSchema.newBuilder().setProtoDescriptors(protoSchema)));
+ updateFieldMask(com.google.bigtable.admin.v2.SchemaBundle.PROTO_SCHEMA_FIELD_NUMBER);
+ return this;
+ }
+
+ /**
+ * Configures if safety warnings should be disabled. If set, then non backwards compatible changes
+ * are allowed.
+ */
+ @SuppressWarnings("WeakerAccess")
+ public UpdateSchemaBundleRequest setIgnoreWarnings(boolean value) {
+ requestBuilder.setIgnoreWarnings(value);
+ return this;
+ }
+
+ private void updateFieldMask(int fieldNumber) {
+ FieldMask newMask =
+ FieldMaskUtil.fromFieldNumbers(
+ com.google.bigtable.admin.v2.SchemaBundle.class, fieldNumber);
+ requestBuilder.setUpdateMask(FieldMaskUtil.union(requestBuilder.getUpdateMask(), newMask));
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ UpdateSchemaBundleRequest that = (UpdateSchemaBundleRequest) o;
+ return Objects.equal(requestBuilder.build(), that.requestBuilder.build())
+ && Objects.equal(tableId, that.tableId)
+ && Objects.equal(schemaBundleId, that.schemaBundleId);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(requestBuilder.build(), tableId, schemaBundleId);
+ }
+
+ /**
+ * Creates the request protobuf. This method is considered an internal implementation detail and
+ * not meant to be used by applications.
+ */
+ @InternalApi
+ public com.google.bigtable.admin.v2.UpdateSchemaBundleRequest toProto(
+ @Nonnull String projectId, @Nonnull String instanceId) {
+ requestBuilder
+ .getSchemaBundleBuilder()
+ .setName(NameUtil.formatSchemaBundleName(projectId, instanceId, tableId, schemaBundleId));
+ return requestBuilder.build();
+ }
+}
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/UpdateTableRequest.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/UpdateTableRequest.java
index 034736aa56..4d65d14e16 100644
--- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/UpdateTableRequest.java
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/UpdateTableRequest.java
@@ -39,6 +39,10 @@ public class UpdateTableRequest {
private final com.google.bigtable.admin.v2.UpdateTableRequest.Builder requestBuilder =
com.google.bigtable.admin.v2.UpdateTableRequest.newBuilder();
+ private final com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy.Builder
+ automatedPolicyBuilder =
+ com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy.newBuilder();
+
public static UpdateTableRequest of(String tableId) {
return new UpdateTableRequest(tableId);
}
@@ -69,11 +73,78 @@ public UpdateTableRequest addChangeStreamRetention(Duration retention) {
return this;
}
- /** Disable change stream for table */
+ /** Disable change stream for table. */
public UpdateTableRequest disableChangeStreamRetention() {
return addChangeStreamRetention(Duration.ZERO);
}
+ /** Changes the deletion protection of an existing table. */
+ public UpdateTableRequest setDeletionProtection(boolean deletionProtection) {
+ requestBuilder.getTableBuilder().setDeletionProtection(deletionProtection);
+ requestBuilder.getUpdateMaskBuilder().addPaths("deletion_protection");
+ return this;
+ }
+
+ /** Disables table automated backup policy. */
+ public UpdateTableRequest disableAutomatedBackup() {
+ requestBuilder.getTableBuilder().setAutomatedBackupPolicy(automatedPolicyBuilder.build());
+ requestBuilder.getUpdateMaskBuilder().addPaths("automated_backup_policy");
+ return this;
+ }
+
+ /** Set an automated backup policy for the table. */
+ public UpdateTableRequest setAutomatedBackup(Duration retentionPeriod, Duration frequency) {
+ com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy policy =
+ com.google.bigtable.admin.v2.Table.AutomatedBackupPolicy.newBuilder()
+ .setRetentionPeriod(
+ com.google.protobuf.Duration.newBuilder()
+ .setSeconds(retentionPeriod.getSeconds())
+ .setNanos(retentionPeriod.getNano())
+ .build())
+ .setFrequency(
+ com.google.protobuf.Duration.newBuilder()
+ .setSeconds(frequency.getSeconds())
+ .setNanos(frequency.getNano())
+ .build())
+ .build();
+
+ requestBuilder.getTableBuilder().setAutomatedBackupPolicy(policy);
+ requestBuilder.getUpdateMaskBuilder().addPaths("automated_backup_policy");
+ return this;
+ }
+
+ /** Updates table automated backup policy retention period. */
+ public UpdateTableRequest setAutomatedBackupRetentionPeriod(Duration retention) {
+ requestBuilder
+ .getTableBuilder()
+ .setAutomatedBackupPolicy(
+ automatedPolicyBuilder
+ .setRetentionPeriod(
+ com.google.protobuf.Duration.newBuilder()
+ .setSeconds(retention.getSeconds())
+ .setNanos(retention.getNano())
+ .build())
+ .build());
+ requestBuilder.getUpdateMaskBuilder().addPaths("automated_backup_policy.retention_period");
+ return this;
+ }
+
+ /** Updates table automated backup policy frequency. */
+ public UpdateTableRequest setAutomatedBackupFrequency(Duration frequency) {
+ requestBuilder
+ .getTableBuilder()
+ .setAutomatedBackupPolicy(
+ automatedPolicyBuilder
+ .setFrequency(
+ com.google.protobuf.Duration.newBuilder()
+ .setSeconds(frequency.getSeconds())
+ .setNanos(frequency.getNano())
+ .build())
+ .build());
+ requestBuilder.getUpdateMaskBuilder().addPaths("automated_backup_policy.frequency");
+ return this;
+ }
+
@InternalApi
public com.google.bigtable.admin.v2.UpdateTableRequest toProto(
String projectId, String instanceId) {
diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/AwaitConsistencyCallable.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/AwaitConsistencyCallable.java
new file mode 100644
index 0000000000..7cdcb66599
--- /dev/null
+++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/stub/AwaitConsistencyCallable.java
@@ -0,0 +1,195 @@
+/*
+ * Copyright 2024 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.bigtable.admin.v2.stub;
+
+import com.google.api.core.ApiAsyncFunction;
+import com.google.api.core.ApiFunction;
+import com.google.api.core.ApiFuture;
+import com.google.api.core.ApiFutures;
+import com.google.api.gax.retrying.ExponentialPollAlgorithm;
+import com.google.api.gax.retrying.NonCancellableFuture;
+import com.google.api.gax.retrying.ResultRetryAlgorithm;
+import com.google.api.gax.retrying.RetryAlgorithm;
+import com.google.api.gax.retrying.RetrySettings;
+import com.google.api.gax.retrying.RetryingExecutor;
+import com.google.api.gax.retrying.RetryingFuture;
+import com.google.api.gax.retrying.ScheduledRetryingExecutor;
+import com.google.api.gax.retrying.TimedAttemptSettings;
+import com.google.api.gax.rpc.ApiCallContext;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.bigtable.admin.v2.CheckConsistencyRequest;
+import com.google.bigtable.admin.v2.CheckConsistencyResponse;
+import com.google.bigtable.admin.v2.GenerateConsistencyTokenRequest;
+import com.google.bigtable.admin.v2.GenerateConsistencyTokenResponse;
+import com.google.cloud.bigtable.admin.v2.models.ConsistencyRequest;
+import com.google.cloud.bigtable.data.v2.internal.TableAdminRequestContext;
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.util.concurrent.MoreExecutors;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CancellationException;
+
+/**
+ * Callable that waits until either replication or Data Boost has caught up to the point it was
+ * called.
+ *
+ *