Search in sources :

Example 46 with ProjectName

use of com.google.logging.v2.ProjectName 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 47 with ProjectName

use of com.google.logging.v2.ProjectName 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 48 with ProjectName

use of com.google.logging.v2.ProjectName in project java-bigquerydatatransfer by googleapis.

the class ListTransferConfigs method listTransferConfigs.

public static void listTransferConfigs(String projectId) throws IOException {
    try (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
        ProjectName parent = ProjectName.of(projectId);
        ListTransferConfigsRequest request = ListTransferConfigsRequest.newBuilder().setParent(parent.toString()).build();
        dataTransferServiceClient.listTransferConfigs(request).iterateAll().forEach(config -> System.out.print("Success! Config ID :" + config.getName() + "\n"));
    } catch (ApiException ex) {
        System.out.println("Config list not found due to error." + ex.toString());
    }
}
Also used : ListTransferConfigsRequest(com.google.cloud.bigquery.datatransfer.v1.ListTransferConfigsRequest) DataTransferServiceClient(com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient) ProjectName(com.google.cloud.bigquery.datatransfer.v1.ProjectName) ApiException(com.google.api.gax.rpc.ApiException)

Example 49 with ProjectName

use of com.google.logging.v2.ProjectName 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)

Example 50 with ProjectName

use of com.google.logging.v2.ProjectName in project java-bigquerydatatransfer by googleapis.

the class CreateAmazonS3Transfer method createAmazonS3Transfer.

public static void createAmazonS3Transfer(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("Amazon s3 transfer created successfully :" + config.getName());
    } catch (ApiException ex) {
        System.out.print("Amazon s3 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

Test (org.junit.Test)146 StatusRuntimeException (io.grpc.StatusRuntimeException)73 ProjectName (com.google.monitoring.v3.ProjectName)62 AbstractMessage (com.google.protobuf.AbstractMessage)60 InvalidArgumentException (com.google.api.gax.rpc.InvalidArgumentException)58 ProjectName (com.google.pubsub.v1.ProjectName)30 ArrayList (java.util.ArrayList)29 ProjectName (com.google.privacy.dlp.v2.ProjectName)22 ByteString (com.google.protobuf.ByteString)18 DataTransferServiceClient (com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient)17 ProjectName (com.google.cloud.bigquery.datatransfer.v1.ProjectName)17 IOException (java.io.IOException)17 CreateTransferConfigRequest (com.google.cloud.bigquery.datatransfer.v1.CreateTransferConfigRequest)16 TransferConfig (com.google.cloud.bigquery.datatransfer.v1.TransferConfig)16 ProjectName (com.google.cloud.secretmanager.v1.ProjectName)16 ProjectName (com.google.containeranalysis.v1beta1.ProjectName)16 ApiException (com.google.api.gax.rpc.ApiException)15 MetricServiceClient (com.google.cloud.monitoring.v3.MetricServiceClient)15 TimeSeries (com.google.monitoring.v3.TimeSeries)15 ProjectName (com.google.logging.v2.ProjectName)14