Skip to content

Commit

Permalink
feat: add CreateDatabase API
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 537397252

Source-Link: googleapis/googleapis@b4481e1

Source-Link: https://github.com/googleapis/googleapis-gen/commit/6b4b12abe9ece6382ea8d6ffd5c50e36b32905f8
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmI0YjEyYWJlOWVjZTYzODJlYThkNmZmZDVjNTBlMzZiMzI5MDVmOCJ9
  • Loading branch information
gcf-owl-bot[bot] committed Jun 2, 2023
1 parent 80e2283 commit 48ab75e
Show file tree
Hide file tree
Showing 256 changed files with 29,128 additions and 43,519 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import com.google.cloud.firestore.v1.stub.FirestoreAdminStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.firestore.admin.v1.CollectionGroupName;
import com.google.firestore.admin.v1.CreateDatabaseMetadata;
import com.google.firestore.admin.v1.CreateDatabaseRequest;
import com.google.firestore.admin.v1.CreateIndexRequest;
import com.google.firestore.admin.v1.Database;
import com.google.firestore.admin.v1.DatabaseName;
Expand Down Expand Up @@ -1642,6 +1644,176 @@ public final UnaryCallable<ImportDocumentsRequest, Operation> importDocumentsCal
return stub.importDocumentsCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Create a database.
*
* <p>Sample code:
*
* <pre>{@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 (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
* ProjectName parent = ProjectName.of("[PROJECT]");
* Database database = Database.newBuilder().build();
* String databaseId = "databaseId1688905718";
* Database response =
* firestoreAdminClient.createDatabaseAsync(parent, database, databaseId).get();
* }
* }</pre>
*
* @param parent Required. A parent name of the form `projects/{project_id}`
* @param database Required. The Database to create.
* @param databaseId Required. The ID to use for the database, which will become the final
* component of the database's resource name.
* <p>The value must be set to "(default)".
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<Database, CreateDatabaseMetadata> createDatabaseAsync(
ProjectName parent, Database database, String databaseId) {
CreateDatabaseRequest request =
CreateDatabaseRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setDatabase(database)
.setDatabaseId(databaseId)
.build();
return createDatabaseAsync(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Create a database.
*
* <p>Sample code:
*
* <pre>{@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 (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
* String parent = ProjectName.of("[PROJECT]").toString();
* Database database = Database.newBuilder().build();
* String databaseId = "databaseId1688905718";
* Database response =
* firestoreAdminClient.createDatabaseAsync(parent, database, databaseId).get();
* }
* }</pre>
*
* @param parent Required. A parent name of the form `projects/{project_id}`
* @param database Required. The Database to create.
* @param databaseId Required. The ID to use for the database, which will become the final
* component of the database's resource name.
* <p>The value must be set to "(default)".
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<Database, CreateDatabaseMetadata> createDatabaseAsync(
String parent, Database database, String databaseId) {
CreateDatabaseRequest request =
CreateDatabaseRequest.newBuilder()
.setParent(parent)
.setDatabase(database)
.setDatabaseId(databaseId)
.build();
return createDatabaseAsync(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Create a database.
*
* <p>Sample code:
*
* <pre>{@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 (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
* CreateDatabaseRequest request =
* CreateDatabaseRequest.newBuilder()
* .setParent(ProjectName.of("[PROJECT]").toString())
* .setDatabase(Database.newBuilder().build())
* .setDatabaseId("databaseId1688905718")
* .build();
* Database response = firestoreAdminClient.createDatabaseAsync(request).get();
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<Database, CreateDatabaseMetadata> createDatabaseAsync(
CreateDatabaseRequest request) {
return createDatabaseOperationCallable().futureCall(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Create a database.
*
* <p>Sample code:
*
* <pre>{@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 (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
* CreateDatabaseRequest request =
* CreateDatabaseRequest.newBuilder()
* .setParent(ProjectName.of("[PROJECT]").toString())
* .setDatabase(Database.newBuilder().build())
* .setDatabaseId("databaseId1688905718")
* .build();
* OperationFuture<Database, CreateDatabaseMetadata> future =
* firestoreAdminClient.createDatabaseOperationCallable().futureCall(request);
* // Do something.
* Database response = future.get();
* }
* }</pre>
*/
public final OperationCallable<CreateDatabaseRequest, Database, CreateDatabaseMetadata>
createDatabaseOperationCallable() {
return stub.createDatabaseOperationCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Create a database.
*
* <p>Sample code:
*
* <pre>{@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 (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
* CreateDatabaseRequest request =
* CreateDatabaseRequest.newBuilder()
* .setParent(ProjectName.of("[PROJECT]").toString())
* .setDatabase(Database.newBuilder().build())
* .setDatabaseId("databaseId1688905718")
* .build();
* ApiFuture<Operation> future =
* firestoreAdminClient.createDatabaseCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<CreateDatabaseRequest, Operation> createDatabaseCallable() {
return stub.createDatabaseCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets information about a database.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@
import com.google.api.gax.rpc.ClientSettings;
import com.google.api.gax.rpc.OperationCallSettings;
import com.google.api.gax.rpc.PagedCallSettings;
import com.google.api.gax.rpc.StubSettings;
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.cloud.firestore.v1.stub.FirestoreAdminStubSettings;
import com.google.firestore.admin.v1.CreateDatabaseMetadata;
import com.google.firestore.admin.v1.CreateDatabaseRequest;
import com.google.firestore.admin.v1.CreateIndexRequest;
import com.google.firestore.admin.v1.Database;
import com.google.firestore.admin.v1.DeleteIndexRequest;
Expand Down Expand Up @@ -175,6 +178,17 @@ public UnaryCallSettings<ImportDocumentsRequest, Operation> importDocumentsSetti
return ((FirestoreAdminStubSettings) getStubSettings()).importDocumentsOperationSettings();
}

/** Returns the object with the settings used for calls to createDatabase. */
public UnaryCallSettings<CreateDatabaseRequest, Operation> createDatabaseSettings() {
return ((FirestoreAdminStubSettings) getStubSettings()).createDatabaseSettings();
}

/** Returns the object with the settings used for calls to createDatabase. */
public OperationCallSettings<CreateDatabaseRequest, Database, CreateDatabaseMetadata>
createDatabaseOperationSettings() {
return ((FirestoreAdminStubSettings) getStubSettings()).createDatabaseOperationSettings();
}

/** Returns the object with the settings used for calls to getDatabase. */
public UnaryCallSettings<GetDatabaseRequest, Database> getDatabaseSettings() {
return ((FirestoreAdminStubSettings) getStubSettings()).getDatabaseSettings();
Expand Down Expand Up @@ -384,6 +398,17 @@ public UnaryCallSettings.Builder<ImportDocumentsRequest, Operation> importDocume
return getStubSettingsBuilder().importDocumentsOperationSettings();
}

/** Returns the builder for the settings used for calls to createDatabase. */
public UnaryCallSettings.Builder<CreateDatabaseRequest, Operation> createDatabaseSettings() {
return getStubSettingsBuilder().createDatabaseSettings();
}

/** Returns the builder for the settings used for calls to createDatabase. */
public OperationCallSettings.Builder<CreateDatabaseRequest, Database, CreateDatabaseMetadata>
createDatabaseOperationSettings() {
return getStubSettingsBuilder().createDatabaseOperationSettings();
}

/** Returns the builder for the settings used for calls to getDatabase. */
public UnaryCallSettings.Builder<GetDatabaseRequest, Database> getDatabaseSettings() {
return getStubSettingsBuilder().getDatabaseSettings();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"grpc": {
"libraryClient": "FirestoreAdminClient",
"rpcs": {
"CreateDatabase": {
"methods": ["createDatabaseAsync", "createDatabaseAsync", "createDatabaseAsync", "createDatabaseOperationCallable", "createDatabaseCallable"]
},
"CreateIndex": {
"methods": ["createIndexAsync", "createIndexAsync", "createIndexAsync", "createIndexOperationCallable", "createIndexCallable"]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.firestore.admin.v1.CreateDatabaseMetadata;
import com.google.firestore.admin.v1.CreateDatabaseRequest;
import com.google.firestore.admin.v1.CreateIndexRequest;
import com.google.firestore.admin.v1.Database;
import com.google.firestore.admin.v1.DeleteIndexRequest;
Expand Down Expand Up @@ -132,6 +134,15 @@ public UnaryCallable<ImportDocumentsRequest, Operation> importDocumentsCallable(
throw new UnsupportedOperationException("Not implemented: importDocumentsCallable()");
}

public OperationCallable<CreateDatabaseRequest, Database, CreateDatabaseMetadata>
createDatabaseOperationCallable() {
throw new UnsupportedOperationException("Not implemented: createDatabaseOperationCallable()");
}

public UnaryCallable<CreateDatabaseRequest, Operation> createDatabaseCallable() {
throw new UnsupportedOperationException("Not implemented: createDatabaseCallable()");
}

public UnaryCallable<GetDatabaseRequest, Database> getDatabaseCallable() {
throw new UnsupportedOperationException("Not implemented: getDatabaseCallable()");
}
Expand Down
Loading

0 comments on commit 48ab75e

Please sign in to comment.