use of com.google.cloud.bigquery.datatransfer.v1.CreateTransferConfigRequest 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());
}
}
Aggregations