Search in sources :

Example 1 with CreateTransferConfigRequest

use of com.google.cloud.bigquery.datatransfer.v1.CreateTransferConfigRequest in project java-bigquerydatatransfer by googleapis.

the class CreatePlayTransfer method createPlayTransfer.

public static void createPlayTransfer(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("play transfer created successfully :" + config.getName());
    } catch (ApiException ex) {
        System.out.print("play transfer was not created." + ex.toString());
    }
}
Also used : DataTransferServiceClient(com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient) ProjectName(com.google.cloud.bigquery.datatransfer.v1.ProjectName) TransferConfig(com.google.cloud.bigquery.datatransfer.v1.TransferConfig) CreateTransferConfigRequest(com.google.cloud.bigquery.datatransfer.v1.CreateTransferConfigRequest) ApiException(com.google.api.gax.rpc.ApiException)

Example 2 with CreateTransferConfigRequest

use of com.google.cloud.bigquery.datatransfer.v1.CreateTransferConfigRequest in project java-bigquerydatatransfer by googleapis.

the class CreateTeradataTransfer method createTeradataTransfer.

public static void createTeradataTransfer(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 teradata transfer created successfully :" + config.getName());
    } catch (ApiException ex) {
        System.out.print("Cloud teradata transfer was not created." + ex.toString());
    }
}
Also used : DataTransferServiceClient(com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient) ProjectName(com.google.cloud.bigquery.datatransfer.v1.ProjectName) TransferConfig(com.google.cloud.bigquery.datatransfer.v1.TransferConfig) CreateTransferConfigRequest(com.google.cloud.bigquery.datatransfer.v1.CreateTransferConfigRequest) ApiException(com.google.api.gax.rpc.ApiException)

Example 3 with CreateTransferConfigRequest

use of com.google.cloud.bigquery.datatransfer.v1.CreateTransferConfigRequest in project java-bigquerydatatransfer by googleapis.

the class CreateYoutubeChannelTransfer method createYoutubeChannelTransfer.

public static void createYoutubeChannelTransfer(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("Youtube channel transfer created successfully :" + config.getName());
    } catch (ApiException ex) {
        System.out.print("Youtube channel transfer was not created." + ex.toString());
    }
}
Also used : DataTransferServiceClient(com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient) ProjectName(com.google.cloud.bigquery.datatransfer.v1.ProjectName) TransferConfig(com.google.cloud.bigquery.datatransfer.v1.TransferConfig) CreateTransferConfigRequest(com.google.cloud.bigquery.datatransfer.v1.CreateTransferConfigRequest) ApiException(com.google.api.gax.rpc.ApiException)

Example 4 with CreateTransferConfigRequest

use of com.google.cloud.bigquery.datatransfer.v1.CreateTransferConfigRequest in project java-bigquerydatatransfer by googleapis.

the class CreateYoutubeContentOwnerTransfer method createYoutubeContentOwnerTransfer.

public static void createYoutubeContentOwnerTransfer(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("Youtube content owner channel transfer created successfully :" + config.getName());
    } catch (ApiException ex) {
        System.out.print("Youtube content owner channel transfer was not created." + ex.toString());
    }
}
Also used : DataTransferServiceClient(com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient) ProjectName(com.google.cloud.bigquery.datatransfer.v1.ProjectName) TransferConfig(com.google.cloud.bigquery.datatransfer.v1.TransferConfig) CreateTransferConfigRequest(com.google.cloud.bigquery.datatransfer.v1.CreateTransferConfigRequest) ApiException(com.google.api.gax.rpc.ApiException)

Example 5 with CreateTransferConfigRequest

use of com.google.cloud.bigquery.datatransfer.v1.CreateTransferConfigRequest in project java-bigquerydatatransfer by googleapis.

the class CreateAdManagerTransfer method createAdManagerTransfer.

public static void createAdManagerTransfer(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("Ad manager transfer created successfully :" + config.getName());
    } catch (ApiException ex) {
        System.out.print("Ad manager transfer was not created." + ex.toString());
    }
}
Also used : DataTransferServiceClient(com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient) ProjectName(com.google.cloud.bigquery.datatransfer.v1.ProjectName) TransferConfig(com.google.cloud.bigquery.datatransfer.v1.TransferConfig) CreateTransferConfigRequest(com.google.cloud.bigquery.datatransfer.v1.CreateTransferConfigRequest) ApiException(com.google.api.gax.rpc.ApiException)

Aggregations

CreateTransferConfigRequest (com.google.cloud.bigquery.datatransfer.v1.CreateTransferConfigRequest)16 DataTransferServiceClient (com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient)16 ProjectName (com.google.cloud.bigquery.datatransfer.v1.ProjectName)16 TransferConfig (com.google.cloud.bigquery.datatransfer.v1.TransferConfig)16 ApiException (com.google.api.gax.rpc.ApiException)14 Value (com.google.protobuf.Value)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 PrintStream (java.io.PrintStream)2 HashMap (java.util.HashMap)2 Before (org.junit.Before)2