use of com.google.bigtable.admin.v2.ProjectName in project java-bigquerydatatransfer by googleapis.
the class CreateScheduledQuery method createScheduledQuery.
public static void createScheduledQuery(String projectId, TransferConfig transferConfig) throws IOException {
try (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
ProjectName parent = ProjectName.of(projectId);
CreateTransferConfigRequest request = CreateTransferConfigRequest.newBuilder().setParent(parent.toString()).setTransferConfig(transferConfig).build();
TransferConfig config = dataTransferServiceClient.createTransferConfig(request);
System.out.println("\nScheduled query created successfully :" + config.getName());
} catch (ApiException ex) {
System.out.print("\nScheduled query was not created." + ex.toString());
}
}
use of com.google.bigtable.admin.v2.ProjectName in project java-bigquerydatatransfer by googleapis.
the class CopyDataset method copyDataset.
public static void copyDataset(String projectId, TransferConfig transferConfig) throws IOException {
try (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
ProjectName parent = ProjectName.of(projectId);
CreateTransferConfigRequest request = CreateTransferConfigRequest.newBuilder().setParent(parent.toString()).setTransferConfig(transferConfig).build();
TransferConfig config = dataTransferServiceClient.createTransferConfig(request);
System.out.println("Copy dataset created successfully :" + config.getName());
} catch (ApiException ex) {
System.out.print("Copy dataset was not created." + ex.toString());
}
}
use of com.google.bigtable.admin.v2.ProjectName in project java-bigquerydatatransfer by googleapis.
the class CreateCampaignmanagerTransfer method createCampaignmanagerTransfer.
public static void createCampaignmanagerTransfer(String projectId, TransferConfig transferConfig) throws IOException {
try (DataTransferServiceClient client = DataTransferServiceClient.create()) {
ProjectName parent = ProjectName.of(projectId);
CreateTransferConfigRequest request = CreateTransferConfigRequest.newBuilder().setParent(parent.toString()).setTransferConfig(transferConfig).build();
TransferConfig config = client.createTransferConfig(request);
System.out.println("Campaignmanager transfer created successfully :" + config.getName());
} catch (ApiException ex) {
System.out.print("Campaignmanager transfer was not created." + ex.toString());
}
}
use of com.google.bigtable.admin.v2.ProjectName in project java-bigquerydatatransfer by googleapis.
the class CreateRedshiftTransfer method createRedshiftTransfer.
public static void createRedshiftTransfer(String projectId, TransferConfig transferConfig) throws IOException {
try (DataTransferServiceClient client = DataTransferServiceClient.create()) {
ProjectName parent = ProjectName.of(projectId);
CreateTransferConfigRequest request = CreateTransferConfigRequest.newBuilder().setParent(parent.toString()).setTransferConfig(transferConfig).build();
TransferConfig config = client.createTransferConfig(request);
System.out.println("Cloud redshift transfer created successfully :" + config.getName());
} catch (ApiException ex) {
System.out.print("Cloud redshift transfer was not created." + ex.toString());
}
}
use of com.google.bigtable.admin.v2.ProjectName in project java-bigtable by googleapis.
the class BaseBigtableInstanceAdminClientTest method createInstanceExceptionTest.
@Test
public void createInstanceExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockBigtableInstanceAdmin.addException(exception);
try {
ProjectName parent = ProjectName.of("[PROJECT]");
String instanceId = "instanceId902024336";
Instance instance = Instance.newBuilder().build();
Map<String, Cluster> clusters = new HashMap<>();
client.createInstanceAsync(parent, instanceId, instance, clusters).get();
Assert.fail("No exception raised");
} catch (ExecutionException e) {
Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass());
InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause());
Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode());
}
}
Aggregations