Skip to content

Commit 12a3d27

Browse files
authored
fix: deprecate databaseId on datastore-v1-proto-client DatastoreOptions (#1190)
1 parent 410b939 commit 12a3d27

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

‎datastore-v1-proto-client/src/main/java/com/google/datastore/v1/client/DatastoreOptions.java‎

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@
4141
*/
4242
public class DatastoreOptions {
4343
private final String projectId;
44-
private final String databaseId;
44+
45+
@Deprecated private final String databaseId;
46+
4547
private final String projectEndpoint;
4648
private final String host;
4749
private final String localHost;
@@ -75,7 +77,9 @@ public static class Builder {
7577
"Can set at most one of project endpoint, host, and local host.";
7678

7779
private String projectId;
78-
private String databaseId;
80+
81+
@Deprecated private String databaseId;
82+
7983
private String projectEndpoint;
8084
private String host;
8185
private String localHost;
@@ -107,8 +111,19 @@ public Builder projectId(String projectId) {
107111
return this;
108112
}
109113

110-
/** Sets the database ID used to access Cloud Datastore. */
114+
/**
115+
* This field is ignored and will be removed in a future release. Please set the database id on
116+
* the request itself. For example:
117+
*
118+
* <pre>{@code
119+
* CommitRequest.newBuilder()
120+
* .setDatabaseId("my-database-id")
121+
* ....
122+
* .build();
123+
* }</pre>
124+
*/
111125
@BetaApi
126+
@Deprecated
112127
public Builder databaseId(String databaseId) {
113128
this.databaseId = databaseId;
114129
return this;
@@ -188,7 +203,19 @@ public String getProjectId() {
188203
return projectId;
189204
}
190205

206+
/**
207+
* This field is ignored and will be removed in a future release. Please set the database id on
208+
* the request itself. For example:
209+
*
210+
* <pre>{@code
211+
* CommitRequest.newBuilder()
212+
* .setDatabaseId("my-database-id")
213+
* ....
214+
* .build();
215+
* }</pre>
216+
*/
191217
@BetaApi
218+
@Deprecated
192219
public String getDatabaseId() {
193220
return databaseId;
194221
}

‎datastore-v1-proto-client/src/test/java/com/google/datastore/v1/client/DatastoreClientTest.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ public void create_LocalHost() {
216216
}
217217

218218
@Test
219+
// TODO: remove this test once deprecated `databaseId` is removed
219220
public void setDatabaseId() {
220221
DatastoreOptions options =
221222
new DatastoreOptions.Builder()

‎google-cloud-datastore/src/main/java/com/google/cloud/datastore/spi/v1/HttpDatastoreRpc.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ public HttpDatastoreRpc(DatastoreOptions options) {
5555
com.google.datastore.v1.client.DatastoreOptions.Builder clientBuilder =
5656
new com.google.datastore.v1.client.DatastoreOptions.Builder()
5757
.projectId(options.getProjectId())
58-
.databaseId(options.getDatabaseId())
5958
.initializer(getHttpRequestInitializer(options, httpTransportOptions))
6059
.transport(transport);
6160
String normalizedHost = options.getHost() != null ? options.getHost().toLowerCase() : "";

0 commit comments

Comments
 (0)