com.google.bigtable.admin.v2.ListInstancesRequest request = com.google.bigtable.admin.v2.ListInstancesRequest.newBuilder() .setParent(NameUtil.formatProjectName(projectId)) .build();
.setParent(PROJECT_NAME) .build();
@Test public void testListInstances() { // Setup com.google.bigtable.admin.v2.ListInstancesRequest expectedRequest = com.google.bigtable.admin.v2.ListInstancesRequest.newBuilder() .setParent(PROJECT_NAME) .build(); com.google.bigtable.admin.v2.ListInstancesResponse expectedResponse = com.google.bigtable.admin.v2.ListInstancesResponse.newBuilder() .addInstances( com.google.bigtable.admin.v2.Instance.newBuilder() .setName(INSTANCE_NAME + "1") .build()) .addInstances( com.google.bigtable.admin.v2.Instance.newBuilder() .setName(INSTANCE_NAME + "2") .build()) .build(); Mockito.when(mockListInstancesCallable.futureCall(expectedRequest)) .thenReturn(ApiFutures.immediateFuture(expectedResponse)); // Execute List<Instance> actualResult = adminClient.listInstances(); // Verify assertThat(actualResult) .containsExactly( Instance.fromProto(expectedResponse.getInstances(0)), Instance.fromProto(expectedResponse.getInstances(1))); }
com.google.bigtable.admin.v2.ListInstancesRequest request = com.google.bigtable.admin.v2.ListInstancesRequest.newBuilder() .setParent(NameUtil.formatProjectName(projectId)) .build();
/** * Lists information about instances in a project. * * <p>Sample code: * * <pre><code> * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) { * ProjectName parent = ProjectName.of("[PROJECT]"); * ListInstancesResponse response = baseBigtableInstanceAdminClient.listInstances(parent); * } * </code></pre> * * @param parent The unique name of the project for which a list of instances is requested. Values * are of the form `projects/<project>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListInstancesResponse listInstances(ProjectName parent) { ListInstancesRequest request = ListInstancesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .build(); return listInstances(request); }
/** * Lists information about instances in a project. * * <p>Sample code: * * <pre><code> * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) { * ProjectName parent = ProjectName.of("[PROJECT]"); * ListInstancesResponse response = baseBigtableInstanceAdminClient.listInstances(parent.toString()); * } * </code></pre> * * @param parent The unique name of the project for which a list of instances is requested. Values * are of the form `projects/<project>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListInstancesResponse listInstances(String parent) { ListInstancesRequest request = ListInstancesRequest.newBuilder().setParent(parent).build(); return listInstances(request); }
/** * Lists information about instances in a project. * * <p>Sample code: * * <pre><code> * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) { * ProjectName parent = ProjectName.of("[PROJECT]"); * ListInstancesResponse response = baseBigtableInstanceAdminClient.listInstances(parent); * } * </code></pre> * * @param parent The unique name of the project for which a list of instances is requested. Values * are of the form `projects/<project>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListInstancesResponse listInstances(ProjectName parent) { ListInstancesRequest request = ListInstancesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .build(); return listInstances(request); }
/** * Lists information about instances in a project. * * <p>Sample code: * * <pre><code> * try (BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient.create()) { * ProjectName parent = ProjectName.of("[PROJECT]"); * ListInstancesResponse response = baseBigtableInstanceAdminClient.listInstances(parent.toString()); * } * </code></pre> * * @param parent The unique name of the project for which a list of instances is requested. Values * are of the form `projects/<project>`. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListInstancesResponse listInstances(String parent) { ListInstancesRequest request = ListInstancesRequest.newBuilder().setParent(parent).build(); return listInstances(request); }