diff --git a/google-cloud-clients/google-cloud-bigtable/README.md b/google-cloud-clients/google-cloud-bigtable/README.md index 616956fff593..6e91df70c569 100644 --- a/google-cloud-clients/google-cloud-bigtable/README.md +++ b/google-cloud-clients/google-cloud-bigtable/README.md @@ -72,7 +72,6 @@ at the top of your file: ```java import com.google.cloud.bigtable.data.v2.BigtableDataClient; -import com.google.cloud.bigtable.data.v2.models.InstanceName; import com.google.cloud.bigtable.data.v2.models.Query; import com.google.cloud.bigtable.data.v2.models.Row; diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminSettings.java b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminSettings.java index e92ff7333289..2c84d6583fd1 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminSettings.java +++ b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminSettings.java @@ -15,7 +15,6 @@ */ package com.google.cloud.bigtable.admin.v2; -import com.google.bigtable.admin.v2.ProjectName; import com.google.cloud.bigtable.admin.v2.stub.BigtableInstanceAdminStubSettings; import com.google.common.base.Preconditions; import com.google.common.base.Verify; @@ -61,17 +60,6 @@ public String getProjectId() { return projectId; } - /** - * Gets the name of the project whose instances the client will manager. - * - * @deprecated Please use {@link #getProjectId()}. - */ - @Deprecated - @Nonnull - public com.google.bigtable.admin.v2.ProjectName getProjectName() { - return ProjectName.of(projectId); - } - /** Gets the underlying RPC settings. */ @Nonnull public BigtableInstanceAdminStubSettings getStubSettings() { @@ -115,30 +103,6 @@ public String getProjectId() { return projectId; } - /** - * Sets the name of instance whose tables the client will manage. - * - * @deprecated Please use {@link #setProjectId(String)}. - */ - @Deprecated - public Builder setProjectName(@Nonnull com.google.bigtable.admin.v2.ProjectName projectName) { - return setProjectId(projectName.getProject()); - } - - /** - * Gets the name of the project whose instances the client will manage. - * - * @deprecated Please use {@link #getProjectId()}. - */ - @Deprecated - @Nullable - public ProjectName getProjectName() { - if (projectId != null) { - return ProjectName.of(projectId); - } - return null; - } - /** * Returns the builder for the settings used for all RPCs. * diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminSettings.java b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminSettings.java index f613bf3f7369..a821d3948020 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminSettings.java +++ b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableTableAdminSettings.java @@ -19,7 +19,6 @@ import com.google.common.base.Preconditions; import com.google.common.base.Verify; import java.io.IOException; -import javax.annotation.Nonnull; import javax.annotation.Nullable; /** @@ -65,17 +64,6 @@ public String getInstanceId() { return instanceId; } - /** - * Gets the name of instance whose tables the client will manage. - * - * @deprecated Please use {@link #getProjectId()} and {@link #getInstanceId()}. - */ - @Deprecated - @Nonnull - public com.google.bigtable.admin.v2.InstanceName getInstanceName() { - return com.google.bigtable.admin.v2.InstanceName.of(projectId, instanceId); - } - /** Gets the underlying RPC settings. */ public BigtableTableAdminStubSettings getStubSettings() { return stubSettings; @@ -133,34 +121,6 @@ public String getInstanceId() { return instanceId; } - /** - * Sets the name of instance whose tables the client will manage. - * - * @deprecated Please use {@link #setProjectId(String)} and {@link #setInstanceId(String)}. - */ - @Deprecated - public Builder setInstanceName( - @Nonnull com.google.bigtable.admin.v2.InstanceName instanceName) { - Preconditions.checkNotNull(instanceName); - this.projectId = instanceName.getProject(); - this.instanceId = instanceName.getInstance(); - return this; - } - - /** - * Gets the name of instance whose tables the client will manage. - * - * @deprecated Please use {@link #getProjectId()} and {@link #getInstanceId()}. - */ - @Deprecated - @Nullable - public com.google.bigtable.admin.v2.InstanceName getInstanceName() { - if (projectId != null && instanceId != null) { - return com.google.bigtable.admin.v2.InstanceName.of(projectId, instanceId); - } - return null; - } - /** * Returns the builder for the settings used for all RPCs. * diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java index aa1084b6ff1a..e6a047f3429f 100644 --- a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java +++ b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java @@ -126,22 +126,6 @@ public static BigtableDataClient create(String projectId, String instanceId) thr return create(settings); } - /** - * Constructs an instance of BigtableDataClient with default settings. - * - * @param instanceName The instance to connect to. - * @return A new client. - * @throws IOException If any. - * @deprecated Please use {@link #create(String, String)}. - */ - @Deprecated - public static BigtableDataClient create( - com.google.cloud.bigtable.data.v2.models.InstanceName instanceName) throws IOException { - BigtableDataSettings settings = - BigtableDataSettings.newBuilder().setInstanceName(instanceName).build(); - return create(settings); - } - /** * Constructs an instance of BigtableDataClient, using the given settings. The channels are * created based on the settings passed in, or defaults for any settings that are not set. @@ -260,8 +244,7 @@ public Row readRow(String tableId, String rowKey, @Nullable Filter filter) { *
Sample code: * *
{@code
- * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
- * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+ * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
* String tableId = "[TABLE]";
*
* // Build the filter expression
@@ -400,8 +383,7 @@ public ApiFuture readRowAsync(String tableId, String rowKey, @Nullable Filt
* Sample code:
*
*
{@code
- * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
- * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+ * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
* String tableId = "[TABLE]";
*
* // Build the filter expression
@@ -442,8 +424,7 @@ public ApiFuture readRowAsync(String tableId, ByteString rowKey, @Nullable
* Sample code:
*
*
{@code
- * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
- * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+ * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
* String tableId = "[TABLE]";
*
* Query query = Query.create(tableId)
@@ -495,8 +476,7 @@ public UnaryCallable readRowCallable() {
* Sample code:
*
*
{@code
- * InstanceName instanceName = InstanceName.of("[PROJECT]", "[INSTANCE]");
- * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create(instanceName)) {
+ * try (BigtableDataClient bigtableDataClient = BigtableDataClient.create("[PROJECT]", "[INSTANCE]")) {
* String tableId = "[TABLE]";
*
* Query query = Query.create(tableId)
diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataSettings.java b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataSettings.java
index cf7fd5255c8d..5e88a877e92b 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataSettings.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataSettings.java
@@ -67,16 +67,6 @@ public static Builder newBuilder() {
return new Builder();
}
- /**
- * Returns the target instance.
- *
- * @deprecated Please use {@link #getProjectId()} and {@link #getInstanceId()}.
- */
- @Deprecated()
- public com.google.cloud.bigtable.data.v2.models.InstanceName getInstanceName() {
- return getTypedStubSettings().getInstanceName();
- }
-
/** Returns the target project id. */
public String getProjectId() {
return getTypedStubSettings().getProjectId();
@@ -159,30 +149,6 @@ private Builder(BigtableDataSettings settings) {
}
//
- /**
- * Sets the target instance. This setting is required. All RPCs will be made in the context of
- * this setting.
- *
- * @deprecated Please use {@link #setProjectId(String)} and {@link #setInstanceId(String)}.
- */
- @Deprecated
- public Builder setInstanceName(
- @Nonnull com.google.cloud.bigtable.data.v2.models.InstanceName instanceName) {
- getTypedStubSettings().setInstanceName(instanceName);
- return this;
- }
-
- /**
- * Gets the {@link com.google.cloud.bigtable.data.v2.models.InstanceName} that was previously
- * set on this Builder.
- *
- * @deprecated Please use {@link #getProjectId()} and {@link #getInstanceId()}.
- */
- @Deprecated
- public com.google.cloud.bigtable.data.v2.models.InstanceName getInstanceName() {
- return getTypedStubSettings().getInstanceName();
- }
-
/**
* Sets the target project. This setting is required. All RPCs will be made in the context of
* this setting.
diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/RequestContext.java b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/RequestContext.java
index ad1a2d27e1c4..fc015186aa63 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/RequestContext.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/RequestContext.java
@@ -38,31 +38,12 @@ public static RequestContext create(String projectId, String instanceId, String
return new AutoValue_RequestContext(projectId, instanceId, appProfileId);
}
- /** @deprecated Please use {@link #create(String, String, String)}. */
- @Deprecated
- public static RequestContext create(
- com.google.cloud.bigtable.data.v2.models.InstanceName instanceName, String appProfileId) {
- return new AutoValue_RequestContext(
- instanceName.getProject(), instanceName.getInstance(), appProfileId);
- }
-
/** The project id that the client is configured to target. */
public abstract String getProjectId();
/** The instance id that the client is configured to target. */
public abstract String getInstanceId();
- /**
- * The instance that the client is configured to target.
- *
- * @deprecated Please use {@link #getProjectId()} and {@link #getInstanceId()}.
- */
- @Deprecated
- public com.google.cloud.bigtable.data.v2.models.InstanceName getInstanceName() {
- return com.google.cloud.bigtable.data.v2.models.InstanceName.of(
- getProjectId(), getInstanceId());
- }
-
/** The App Profile to use when processing the current request */
public abstract String getAppProfileId();
}
diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/InstanceName.java b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/InstanceName.java
deleted file mode 100644
index fc63cdaf68e9..000000000000
--- a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/InstanceName.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * 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.data.v2.models;
-
-import com.google.api.pathtemplate.PathTemplate;
-import com.google.api.resourcenames.ResourceName;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableMap;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-// Copied from com.google.bigtable.admin.v2
-
-/** @deprecated Please use project id and instance id strings instead. */
-@Deprecated
-public class InstanceName implements ResourceName {
- private static final PathTemplate PATH_TEMPLATE =
- PathTemplate.createWithoutUrlEncoding("projects/{project}/instances/{instance}");
-
- private volatile Map fieldValuesMap;
-
- private final String project;
- private final String instance;
-
- public String getProject() {
- return project;
- }
-
- public String getInstance() {
- return instance;
- }
-
- public static Builder newBuilder() {
- return new Builder();
- }
-
- public Builder toBuilder() {
- return new Builder(this);
- }
-
- private InstanceName(Builder builder) {
- project = Preconditions.checkNotNull(builder.getProject());
- instance = Preconditions.checkNotNull(builder.getInstance());
- }
-
- public static InstanceName of(String project, String instance) {
- return newBuilder().setProject(project).setInstance(instance).build();
- }
-
- public static String format(String project, String instance) {
- return newBuilder().setProject(project).setInstance(instance).build().toString();
- }
-
- public static InstanceName parse(String formattedString) {
- if (formattedString.isEmpty()) {
- return null;
- }
- Map matchMap =
- PATH_TEMPLATE.validatedMatch(
- formattedString, "InstanceName.parse: formattedString not in valid format");
- return of(matchMap.get("project"), matchMap.get("instance"));
- }
-
- public static List parseList(List formattedStrings) {
- List list = new ArrayList<>(formattedStrings.size());
- for (String formattedString : formattedStrings) {
- list.add(parse(formattedString));
- }
- return list;
- }
-
- public static List toStringList(List values) {
- List list = new ArrayList(values.size());
- for (InstanceName value : values) {
- if (value == null) {
- list.add("");
- } else {
- list.add(value.toString());
- }
- }
- return list;
- }
-
- public static boolean isParsableFrom(String formattedString) {
- return PATH_TEMPLATE.matches(formattedString);
- }
-
- public Map getFieldValuesMap() {
- if (fieldValuesMap == null) {
- synchronized (this) {
- if (fieldValuesMap == null) {
- ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder();
- fieldMapBuilder.put("project", project);
- fieldMapBuilder.put("instance", instance);
- fieldValuesMap = fieldMapBuilder.build();
- }
- }
- }
- return fieldValuesMap;
- }
-
- public String getFieldValue(String fieldName) {
- return getFieldValuesMap().get(fieldName);
- }
-
- @Override
- public String toString() {
- return PATH_TEMPLATE.instantiate("project", project, "instance", instance);
- }
-
- /** Builder for InstanceName. */
- public static class Builder {
-
- private String project;
- private String instance;
-
- public String getProject() {
- return project;
- }
-
- public String getInstance() {
- return instance;
- }
-
- public Builder setProject(String project) {
- this.project = project;
- return this;
- }
-
- public Builder setInstance(String instance) {
- this.instance = instance;
- return this;
- }
-
- private Builder() {}
-
- private Builder(InstanceName instanceName) {
- project = instanceName.project;
- instance = instanceName.instance;
- }
-
- public InstanceName build() {
- return new InstanceName(this);
- }
- }
-
- @Override
- public boolean equals(Object o) {
- if (o == this) {
- return true;
- }
- if (o instanceof InstanceName) {
- InstanceName that = (InstanceName) o;
- return (this.project.equals(that.project)) && (this.instance.equals(that.instance));
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- int h = 1;
- h *= 1000003;
- h ^= project.hashCode();
- h *= 1000003;
- h ^= instance.hashCode();
- return h;
- }
-}
diff --git a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java
index ca44142a91eb..568eb9545629 100644
--- a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java
+++ b/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/EnhancedBigtableStubSettings.java
@@ -151,16 +151,6 @@ public static Builder newBuilder() {
return new Builder();
}
- /**
- * Returns the target instance.
- *
- * @deprecated Please use {@link #getProjectId()} and {@link #getInstanceId()}
- */
- @Deprecated
- public com.google.cloud.bigtable.data.v2.models.InstanceName getInstanceName() {
- return com.google.cloud.bigtable.data.v2.models.InstanceName.of(projectId, instanceId);
- }
-
/** Returns the project id of the target instance. */
public String getProjectId() {
return projectId;
@@ -350,35 +340,6 @@ private static void copyRetrySettings(
//
//
- /**
- * Sets the target instance. This setting is required. All RPCs will be made in the context of
- * this setting.
- *
- * @deprecated Please use {@link #setProjectId(String)} and {@link #setInstanceId(String)}.
- */
- @Deprecated
- public Builder setInstanceName(
- @Nonnull com.google.cloud.bigtable.data.v2.models.InstanceName instanceName) {
- Preconditions.checkNotNull(instanceName);
- this.projectId = instanceName.getProject();
- this.instanceId = instanceName.getInstance();
- return this;
- }
-
- /**
- * Gets the {@link com.google.cloud.bigtable.data.v2.models.InstanceName} that was previously
- * set on this Builder.
- *
- * @deprecated Please use {@link #getProjectId()} and {@link #getInstanceId()}.
- */
- @Deprecated
- public com.google.cloud.bigtable.data.v2.models.InstanceName getInstanceName() {
- if (projectId != null && instanceId != null) {
- return com.google.cloud.bigtable.data.v2.models.InstanceName.of(projectId, instanceId);
- }
- return null;
- }
-
/**
* Sets the project id of that target instance. This setting is required. All RPCs will be made
* in the context of this setting.
diff --git a/google-cloud-testing/google-cloud-bigtable-emulator/README.md b/google-cloud-testing/google-cloud-bigtable-emulator/README.md
index be4378ef4829..b0e358ea8ae2 100644
--- a/google-cloud-testing/google-cloud-bigtable-emulator/README.md
+++ b/google-cloud-testing/google-cloud-bigtable-emulator/README.md
@@ -111,7 +111,8 @@ public class ExampleTest {
public void setUp() throws IOException {
// Initialize the clients to connect to the emulator
BigtableTableAdminSettings.Builder tableAdminSettings = BigtableTableAdminSettings.newBuilder()
- .setInstanceName(com.google.bigtable.admin.v2.InstanceName.of("fake-project", "fake-instance"));
+ .setProjectId("fake-project")
+ .setInstanceId("fake-instance");
tableAdminSettings.stubSettings()
.setCredentialsProvider(NoCredentialsProvider.create())
.setTransportChannelProvider(
@@ -122,7 +123,8 @@ public class ExampleTest {
tableAdminClient = BigtableTableAdminClient.create(tableAdminSettings.build());
BigtableDataSettings.Builder dataSettings = BigtableDataSettings.newBuilder()
- .setInstanceName(com.google.cloud.bigtable.data.v2.models.InstanceName.of("fake-project", "fake-instance"))
+ .setProjectId("fake-project")
+ .setInstanceId("fake-instance")
.setCredentialsProvider(NoCredentialsProvider.create())
.setTransportChannelProvider(
FixedTransportChannelProvider.create(