Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bigtable: Remove deprecated typesafe names #4505

Merged
merged 1 commit into from
Feb 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion google-cloud-clients/google-cloud-bigtable/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -260,8 +244,7 @@ public Row readRow(String tableId, String rowKey, @Nullable Filter filter) {
* <p>Sample code:
*
* <pre>{@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
Expand Down Expand Up @@ -400,8 +383,7 @@ public ApiFuture<Row> readRowAsync(String tableId, String rowKey, @Nullable Filt
* <p>Sample code:
*
* <pre>{@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
Expand Down Expand Up @@ -442,8 +424,7 @@ public ApiFuture<Row> readRowAsync(String tableId, ByteString rowKey, @Nullable
* <p>Sample code:
*
* <pre>{@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)
Expand Down Expand Up @@ -495,8 +476,7 @@ public UnaryCallable<Query, Row> readRowCallable() {
* <p>Sample code:
*
* <pre>{@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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -159,30 +149,6 @@ private Builder(BigtableDataSettings settings) {
}

// <editor-fold desc="Public API">
/**
* 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Loading