2121import com .google .api .core .ApiFutures ;
2222import com .google .api .gax .rpc .ApiExceptions ;
2323import com .google .api .gax .rpc .NotFoundException ;
24- import com .google .api .resourcenames .ResourceName ;
2524import com .google .bigtable .admin .v2 .DeleteAppProfileRequest ;
2625import com .google .bigtable .admin .v2 .GetAppProfileRequest ;
2726import com .google .bigtable .admin .v2 .ListAppProfilesRequest ;
@@ -107,17 +106,6 @@ public static BigtableInstanceAdminClient create(@Nonnull String projectId) thro
107106 return create (BigtableInstanceAdminSettings .newBuilder ().setProjectId (projectId ).build ());
108107 }
109108
110- /**
111- * Constructs an instance of BigtableInstanceAdminClient with the given project ID.
112- *
113- * @deprecated Please use {@link #create(String)}.
114- */
115- @ Deprecated
116- public static BigtableInstanceAdminClient create (
117- @ Nonnull com .google .bigtable .admin .v2 .ProjectName projectName ) throws IOException {
118- return create (projectName .getProject ());
119- }
120-
121109 /** Constructs an instance of BigtableInstanceAdminClient with the given settings. */
122110 public static BigtableInstanceAdminClient create (@ Nonnull BigtableInstanceAdminSettings settings )
123111 throws IOException {
@@ -130,18 +118,6 @@ public static BigtableInstanceAdminClient create(
130118 return new BigtableInstanceAdminClient (projectId , stub );
131119 }
132120
133- /**
134- * Constructs an instance of BigtableInstanceAdminClient with the given project name and stub.
135- *
136- * @deprecated Please use {@link #create(String, BigtableInstanceAdminStub)}.
137- */
138- @ Deprecated
139- public static BigtableInstanceAdminClient create (
140- @ Nonnull com .google .bigtable .admin .v2 .ProjectName projectName ,
141- @ Nonnull BigtableInstanceAdminStub stub ) {
142- return create (projectName .getProject (), stub );
143- }
144-
145121 private BigtableInstanceAdminClient (
146122 @ Nonnull String projectId , @ Nonnull BigtableInstanceAdminStub stub ) {
147123 this .projectId = projectId ;
@@ -153,17 +129,6 @@ public String getProjectId() {
153129 return projectId ;
154130 }
155131
156- /**
157- * Gets the project name this client is associated with.
158- *
159- * @deprecated Please use {@link #getProjectId()}.
160- */
161- @ Deprecated
162- @ SuppressWarnings ("WeakerAccess" )
163- public com .google .bigtable .admin .v2 .ProjectName getProjectName () {
164- return com .google .bigtable .admin .v2 .ProjectName .of (projectId );
165- }
166-
167132 /** Closes the client and frees all resources associated with it (like thread pools). */
168133 @ Override
169134 public void close () {
@@ -275,7 +240,6 @@ public Instance apply(com.google.bigtable.admin.v2.Instance proto) {
275240 * Instance instance = client.getInstance("my-instance");
276241 * }</pre>
277242 */
278- @ SuppressWarnings ("WeakerAccess" )
279243 public Instance getInstance (String id ) {
280244 return ApiExceptions .callAndTranslateApiException (getInstanceAsync (id ));
281245 }
@@ -770,9 +734,7 @@ public ApiFuture<Void> deleteClusterAsync(String instanceId, String clusterId) {
770734 String name = NameUtil .formatClusterName (projectId , instanceId , clusterId );
771735
772736 com .google .bigtable .admin .v2 .DeleteClusterRequest request =
773- com .google .bigtable .admin .v2 .DeleteClusterRequest .newBuilder ()
774- .setName (name .toString ())
775- .build ();
737+ com .google .bigtable .admin .v2 .DeleteClusterRequest .newBuilder ().setName (name ).build ();
776738
777739 return ApiFutures .transform (
778740 stub .deleteClusterCallable ().futureCall (request ),
@@ -844,7 +806,6 @@ public AppProfile apply(com.google.bigtable.admin.v2.AppProfile proto) {
844806 *
845807 * @see AppProfile
846808 */
847- @ SuppressWarnings ("WeakerAccess" )
848809 public AppProfile getAppProfile (String instanceId , String appProfileId ) {
849810 return ApiExceptions .callAndTranslateApiException (getAppProfileAsync (instanceId , appProfileId ));
850811 }
@@ -866,8 +827,7 @@ public AppProfile getAppProfile(String instanceId, String appProfileId) {
866827 public ApiFuture <AppProfile > getAppProfileAsync (String instanceId , String appProfileId ) {
867828 String name = NameUtil .formatAppProfileName (projectId , instanceId , appProfileId );
868829
869- GetAppProfileRequest request =
870- GetAppProfileRequest .newBuilder ().setName (name .toString ()).build ();
830+ GetAppProfileRequest request = GetAppProfileRequest .newBuilder ().setName (name ).build ();
871831
872832 return ApiFutures .transform (
873833 stub .getAppProfileCallable ().futureCall (request ),
@@ -1235,13 +1195,10 @@ public Policy apply(com.google.iam.v1.Policy proto) {
12351195 * @see <a href="https://cloud.google.com/bigtable/docs/access-control#permissions">Cloud Bigtable
12361196 * permissions</a>
12371197 */
1238- @ SuppressWarnings ({"WeakerAccess" , "deprecation" })
1198+ @ SuppressWarnings ({"WeakerAccess" })
12391199 public List <String > testIamPermission (String instanceId , String ... permissions ) {
1240- // TODO(igorbernstein2): Stop using typesafe names
1241- com .google .bigtable .admin .v2 .InstanceName instanceName =
1242- com .google .bigtable .admin .v2 .InstanceName .of (projectId , instanceId );
1243-
1244- return testIamPermission (instanceName , permissions );
1200+ return ApiExceptions .callAndTranslateApiException (
1201+ testIamPermissionAsync (instanceId , permissions ));
12451202 }
12461203
12471204 /**
@@ -1271,77 +1228,11 @@ public List<String> testIamPermission(String instanceId, String... permissions)
12711228 * @see <a href="https://cloud.google.com/bigtable/docs/access-control#permissions">Cloud Bigtable
12721229 * permissions</a>
12731230 */
1274- @ SuppressWarnings ({"WeakerAccess" , "deprecation" })
1231+ @ SuppressWarnings ({"WeakerAccess" })
12751232 public ApiFuture <List <String >> testIamPermissionAsync (String instanceId , String ... permissions ) {
1276- // TODO(igorbernstein2): Stop using typesafe names
1277- return testIamPermissionAsync (
1278- com .google .bigtable .admin .v2 .InstanceName .of (projectId , instanceId ), permissions );
1279- }
1280-
1281- /**
1282- * Tests whether the caller has the given permissions for the specified absolute resource name
1283- * (note that the current project of the client is ignored).
1284- *
1285- * <p>Returns a subset of the specified permissions that the caller has.
1286- *
1287- * <p>Sample code:
1288- *
1289- * <pre>{@code
1290- * List<String> grantedPermissions = client.testIamPermission(
1291- * TableName.of("my-project", "my-instance", "my-table"),
1292- * "bigtable.tables.readRows", "bigtable.tables.mutateRows");
1293- *
1294- * System.out.println("Has read access: " + grantedPermissions.contains("bigtable.tables.readRows"));
1295- * System.out.println("Has write access: " + grantedPermissions.contains("bigtable.tables.mutateRows"));
1296- * }</pre>
1297- *
1298- * @see <a href="https://cloud.google.com/bigtable/docs/access-control#permissions">Cloud Bigtable
1299- * permissions</a>
1300- * @deprecated Please use {@link #testIamPermission(String, String...)}.
1301- */
1302- @ Deprecated
1303- @ SuppressWarnings ("WeakerAccess" )
1304- public List <String > testIamPermission (ResourceName resourceName , String ... permissions ) {
1305- return ApiExceptions .callAndTranslateApiException (
1306- testIamPermissionAsync (resourceName , permissions ));
1307- }
1308-
1309- /**
1310- * Asynchronously tests whether the caller has the given permissions for the specified absolute
1311- * resource name (note that the current project of the client is ignored). Returns a subset of the
1312- * specified permissions that the caller has.
1313- *
1314- * <p>Sample code:
1315- *
1316- * <pre>{@code
1317- * ApiFuture<List<String>> grantedPermissionsFuture = client.testIamPermissionAsync(
1318- * TableName.of("my-project", "my-instance", "my-table"),
1319- * "bigtable.tables.readRows", "bigtable.tables.mutateRows");
1320- *
1321- * ApiFutures.addCallback(grantedPermissionsFuture,
1322- * new ApiFutureCallback<List<String>>() {
1323- * public void onSuccess(List<String> grantedPermissions) {
1324- * System.out.println("Has read access: " + grantedPermissions.contains("bigtable.tables.readRows"));
1325- * System.out.println("Has write access: " + grantedPermissions.contains("bigtable.tables.mutateRows"));
1326- * }
1327- *
1328- * public void onFailure(Throwable t) {
1329- * t.printStackTrace();
1330- * }
1331- * },
1332- * MoreExecutors.directExecutor());
1333- * }</pre>
1334- *
1335- * @see <a href="https://cloud.google.com/bigtable/docs/access-control#permissions">Cloud Bigtable
1336- * permissions</a>
1337- * @deprecated Please use {@link #testIamPermissionAsync(String, String...)}
1338- */
1339- @ SuppressWarnings ("WeakerAccess" )
1340- public ApiFuture <List <String >> testIamPermissionAsync (
1341- ResourceName resourceName , String ... permissions ) {
13421233 TestIamPermissionsRequest request =
13431234 TestIamPermissionsRequest .newBuilder ()
1344- .setResource (resourceName . toString ( ))
1235+ .setResource (NameUtil . formatInstanceName ( projectId , instanceId ))
13451236 .addAllPermissions (Arrays .asList (permissions ))
13461237 .build ();
13471238
0 commit comments