Skip to content

Commit 353dcf0

Browse files
---
yaml --- r: 14303 b: refs/heads/autosynth-video-intelligence c: b7c1878 h: refs/heads/master i: 14301: ee2c19d 14299: b2c5cdf 14295: 548643a 14287: 29728f6 14271: 081ce67
1 parent 3a2bf66 commit 353dcf0

46 files changed

Lines changed: 563 additions & 374 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ refs/heads/autosynth-container: f6384095f50b31bfc8208542a49181e158d3681c
117117
refs/heads/autosynth-dataproc: bc74a8841bc1693d7945d991d15979df550b1fd1
118118
refs/heads/autosynth-monitoring: e67db7395a868e5f6ecc3476eb4a91c47abd4234
119119
refs/heads/autosynth-pubsub: fd363d13793a853214eb8193c922b28c54e7a6b3
120-
refs/heads/autosynth-video-intelligence: 7978818978e5fc2321281869425774330d63616f
120+
refs/heads/autosynth-video-intelligence: b7c18780765dfb4f676701071e46d27574712f71
121121
refs/heads/autosynth-vision: d758c43ba2ef4f4f7ad07b722617cb39fe3f29db
122122
refs/heads/spanner: 54a5e197bfe0a004e13c190427f46c3413ab572d
123123
refs/tags/v0.68.0: 9cc799fcf68c82ab431d425fefa58ef615ce8e5b

branches/autosynth-video-intelligence/.kokoro/continuous/bigtable-it.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ env_vars: {
88

99
env_vars: {
1010
key: "INTEGRATION_TEST_ARGS"
11-
value: "google-cloud-clients/google-cloud-bigtable -Dbigtable.env=prod -Dbigtable.table=projects/gcloud-devel/instances/google-cloud-bigtable/tables/integration-tests"
11+
value: "google-cloud-clients/google-cloud-bigtable -Dbigtable.env=prod -Dbigtable.project=gcloud-devel -Dbigtable.instance=google-cloud-bigtable -Dbigtable.table=integration-tests"
1212
}
1313

1414
env_vars: {

branches/autosynth-video-intelligence/.kokoro/nightly/bigtable-it.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ env_vars: {
88

99
env_vars: {
1010
key: "INTEGRATION_TEST_ARGS"
11-
value: "google-cloud-clients/google-cloud-bigtable -Dbigtable.env=prod -Dbigtable.table=projects/gcloud-devel/instances/google-cloud-bigtable/tables/integration-tests"
11+
value: "google-cloud-clients/google-cloud-bigtable -Dbigtable.env=prod -Dbigtable.project=gcloud-devel -Dbigtable.instance=google-cloud-bigtable -Dbigtable.table=integration-tests"
1212
}
1313

1414
env_vars: {

branches/autosynth-video-intelligence/.kokoro/presubmit/bigtable-it.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ env_vars: {
88

99
env_vars: {
1010
key: "INTEGRATION_TEST_ARGS"
11-
value: "google-cloud-clients/google-cloud-bigtable -Dbigtable.env=prod -Dbigtable.table=projects/gcloud-devel/instances/google-cloud-bigtable/tables/integration-tests"
11+
value: "google-cloud-clients/google-cloud-bigtable -Dbigtable.env=prod -Dbigtable.project=gcloud-devel -Dbigtable.instance=google-cloud-bigtable -Dbigtable.table=integration-tests"
1212
}
1313

1414
env_vars: {

branches/autosynth-video-intelligence/TESTING.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ To use the `prod` environment:
6161
```shell
6262
mvn verify -am -pl google-cloud-bigtable \
6363
-Dbigtable.env=prod \
64-
-Dbigtable.table=projects/my-project/instances/my-instance/tables/my-table
64+
-Dbigtable.project=my-project
65+
-Dbigtable.instance=my-instance
66+
-Dbigtable.table=my-table
6567
```
6668

6769
### Testing code that uses Bigtable Admin

branches/autosynth-video-intelligence/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataClient.java

Lines changed: 51 additions & 60 deletions
Large diffs are not rendered by default.

branches/autosynth-video-intelligence/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/BigtableDataSettings.java

Lines changed: 61 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import com.google.api.gax.rpc.ServerStreamingCallSettings;
2121
import com.google.api.gax.rpc.UnaryCallSettings;
2222
import com.google.cloud.bigtable.data.v2.models.ConditionalRowMutation;
23-
import com.google.cloud.bigtable.data.v2.models.InstanceName;
2423
import com.google.cloud.bigtable.data.v2.models.KeyOffset;
2524
import com.google.cloud.bigtable.data.v2.models.Query;
2625
import com.google.cloud.bigtable.data.v2.models.ReadModifyWriteRow;
@@ -49,7 +48,8 @@
4948
*
5049
* <pre>{@code
5150
* BigtableDataSettings.Builder settingsBuilder = BigtableDataSettings.newBuilder()
52-
* .setInstanceName(InstanceName.of("my-project", "my-instance-id"))
51+
* .setProjectId("my-project")
52+
* .setInstanceId("my-instance-id")
5353
* .setAppProfileId("default");
5454
*
5555
* settingsBuilder.readRowsSettings().setRetryableCodes(Code.DEADLINE_EXCEEDED, Code.UNAVAILABLE);
@@ -67,12 +67,27 @@ public static Builder newBuilder() {
6767
return new Builder();
6868
}
6969

70-
/** Returns the target instance */
71-
public InstanceName getInstanceName() {
70+
/**
71+
* Returns the target instance.
72+
*
73+
* @deprecated Please use {@link #getProjectId()} and {@link #getInstanceId()}.
74+
*/
75+
@Deprecated()
76+
public com.google.cloud.bigtable.data.v2.models.InstanceName getInstanceName() {
7277
return getTypedStubSettings().getInstanceName();
7378
}
7479

75-
/** Returns the configured AppProfile to use */
80+
/** Returns the target project id. */
81+
public String getProjectId() {
82+
return getTypedStubSettings().getProjectId();
83+
}
84+
85+
/** Returns the target instance id. */
86+
public String getInstanceId() {
87+
return getTypedStubSettings().getInstanceId();
88+
}
89+
90+
/** Returns the configured AppProfile id to use. */
7691
public String getAppProfileId() {
7792
return getTypedStubSettings().getAppProfileId();
7893
}
@@ -142,17 +157,55 @@ private Builder(BigtableDataSettings settings) {
142157
/**
143158
* Sets the target instance. This setting is required. All RPCs will be made in the context of
144159
* this setting.
160+
*
161+
* @deprecated Please use {@link #setProjectId(String)} and {@link #setInstanceId(String)}.
145162
*/
146-
public Builder setInstanceName(@Nonnull InstanceName instanceName) {
163+
@Deprecated
164+
public Builder setInstanceName(
165+
@Nonnull com.google.cloud.bigtable.data.v2.models.InstanceName instanceName) {
147166
getTypedStubSettings().setInstanceName(instanceName);
148167
return this;
149168
}
150169

151-
/** Gets the {@link InstanceName} that was previously set on this Builder. */
152-
public InstanceName getInstanceName() {
170+
/**
171+
* Gets the {@link com.google.cloud.bigtable.data.v2.models.InstanceName} that was previously
172+
* set on this Builder.
173+
*
174+
* @deprecated Please use {@link #getProjectId()} and {@link #getInstanceId()}.
175+
*/
176+
@Deprecated
177+
public com.google.cloud.bigtable.data.v2.models.InstanceName getInstanceName() {
153178
return getTypedStubSettings().getInstanceName();
154179
}
155180

181+
/**
182+
* Sets the target project. This setting is required. All RPCs will be made in the context of
183+
* this setting.
184+
*/
185+
public Builder setProjectId(@Nonnull String projectId) {
186+
getTypedStubSettings().setProjectId(projectId);
187+
return this;
188+
}
189+
190+
/** Gets the project id that was previously set on this Builder. */
191+
public String getProjectId() {
192+
return getTypedStubSettings().getProjectId();
193+
}
194+
195+
/**
196+
* Sets the target instance. This setting is required. All RPCs will be made in the context of
197+
* this setting.
198+
*/
199+
public Builder setInstanceId(@Nonnull String instanceId) {
200+
getTypedStubSettings().setInstanceId(instanceId);
201+
return this;
202+
}
203+
204+
/** Gets the instance id that was previously set on this Builder. */
205+
public String getInstanceId() {
206+
return getTypedStubSettings().getInstanceId();
207+
}
208+
156209
/**
157210
* Sets the AppProfile to use. An application profile (sometimes also shortened to "app
158211
* profile") is a group of configuration parameters for an individual use case. A client will
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright 2018 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package com.google.cloud.bigtable.data.v2.internal;
17+
18+
import com.google.api.core.InternalApi;
19+
import javax.annotation.Nonnull;
20+
21+
/**
22+
* Internal helper to compose full resource names.
23+
*
24+
* <p>This class is considered an internal implementation detail and not meant to be used by
25+
* applications.
26+
*/
27+
@InternalApi
28+
public class NameUtil {
29+
public static String formatInstanceName(@Nonnull String projectId, @Nonnull String instanceId) {
30+
return "projects/" + projectId + "/instances/" + instanceId;
31+
}
32+
33+
public static String formatTableName(
34+
@Nonnull String projectId, @Nonnull String instanceId, @Nonnull String tableId) {
35+
return formatInstanceName(projectId, instanceId) + "/tables/" + tableId;
36+
}
37+
}

branches/autosynth-video-intelligence/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/internal/RequestContext.java

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
import com.google.api.core.InternalApi;
1919
import com.google.auto.value.AutoValue;
20-
import com.google.cloud.bigtable.data.v2.models.InstanceName;
2120

2221
/**
2322
* Contains information necessary to construct Bigtable protobuf requests from user facing models.
@@ -32,12 +31,36 @@
3231
@InternalApi
3332
@AutoValue
3433
public abstract class RequestContext {
35-
public static RequestContext create(InstanceName instanceName, String appProfileId) {
36-
return new AutoValue_RequestContext(instanceName, appProfileId);
34+
35+
/** Creates a new instance of the {@link RequestContext}. */
36+
public static RequestContext create(String projectId, String instanceId, String appProfileId) {
37+
return new AutoValue_RequestContext(projectId, instanceId, appProfileId);
38+
}
39+
40+
/** @deprecated Please use {@link #create(String, String, String)}. */
41+
@Deprecated
42+
public static RequestContext create(
43+
com.google.cloud.bigtable.data.v2.models.InstanceName instanceName, String appProfileId) {
44+
return new AutoValue_RequestContext(
45+
instanceName.getProject(), instanceName.getInstance(), appProfileId);
3746
}
3847

39-
/** The instance that the client is configured to target */
40-
public abstract InstanceName getInstanceName();
48+
/** The project id that the client is configured to target. */
49+
public abstract String getProjectId();
50+
51+
/** The instance id that the client is configured to target. */
52+
public abstract String getInstanceId();
53+
54+
/**
55+
* The instance that the client is configured to target.
56+
*
57+
* @deprecated Please use {@link #getProjectId()} and {@link #getInstanceId()}.
58+
*/
59+
@Deprecated
60+
public com.google.cloud.bigtable.data.v2.models.InstanceName getInstanceName() {
61+
return com.google.cloud.bigtable.data.v2.models.InstanceName.of(
62+
getProjectId(), getInstanceId());
63+
}
4164

4265
/** The App Profile to use when processing the current request */
4366
public abstract String getAppProfileId();

branches/autosynth-video-intelligence/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/BulkMutation.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import com.google.api.core.InternalApi;
1919
import com.google.bigtable.v2.MutateRowsRequest;
20-
import com.google.bigtable.v2.TableName;
20+
import com.google.cloud.bigtable.data.v2.internal.NameUtil;
2121
import com.google.cloud.bigtable.data.v2.internal.RequestContext;
2222
import com.google.common.base.Preconditions;
2323
import com.google.protobuf.ByteString;
@@ -91,14 +91,12 @@ public BulkMutation add(@Nonnull ByteString rowKey, @Nonnull Mutation mutation)
9191

9292
@InternalApi
9393
public MutateRowsRequest toProto(RequestContext requestContext) {
94-
TableName tableName =
95-
TableName.of(
96-
requestContext.getInstanceName().getProject(),
97-
requestContext.getInstanceName().getInstance(),
98-
tableId);
94+
String tableName =
95+
NameUtil.formatTableName(
96+
requestContext.getProjectId(), requestContext.getInstanceId(), tableId);
9997

10098
return builder
101-
.setTableName(tableName.toString())
99+
.setTableName(tableName)
102100
.setAppProfileId(requestContext.getAppProfileId())
103101
.build();
104102
}

0 commit comments

Comments
 (0)