Search in sources :

Example 1 with UpdateTransferConfigRequest

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

the class ReEnableTransferConfig method reEnableTransferConfig.

public static void reEnableTransferConfig(TransferConfig transferConfig, FieldMask updateMask) throws IOException {
    try (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
        UpdateTransferConfigRequest request = UpdateTransferConfigRequest.newBuilder().setTransferConfig(transferConfig).setUpdateMask(updateMask).build();
        TransferConfig updateConfig = dataTransferServiceClient.updateTransferConfig(request);
        System.out.println("Transfer config reenable successfully :" + updateConfig.getDisplayName());
    } catch (ApiException ex) {
        System.out.print("Transfer config was not reenable." + ex.toString());
    }
}
Also used : DataTransferServiceClient(com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient) UpdateTransferConfigRequest(com.google.cloud.bigquery.datatransfer.v1.UpdateTransferConfigRequest) TransferConfig(com.google.cloud.bigquery.datatransfer.v1.TransferConfig) ApiException(com.google.api.gax.rpc.ApiException)

Example 2 with UpdateTransferConfigRequest

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

the class UpdateTransferConfig method updateTransferConfig.

public static void updateTransferConfig(TransferConfig transferConfig, FieldMask updateMask) throws IOException {
    try (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
        UpdateTransferConfigRequest request = UpdateTransferConfigRequest.newBuilder().setTransferConfig(transferConfig).setUpdateMask(updateMask).build();
        TransferConfig updateConfig = dataTransferServiceClient.updateTransferConfig(request);
        System.out.println("Transfer config updated successfully :" + updateConfig.getDisplayName());
    } catch (ApiException ex) {
        System.out.print("Transfer config was not updated." + ex.toString());
    }
}
Also used : DataTransferServiceClient(com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient) UpdateTransferConfigRequest(com.google.cloud.bigquery.datatransfer.v1.UpdateTransferConfigRequest) TransferConfig(com.google.cloud.bigquery.datatransfer.v1.TransferConfig) ApiException(com.google.api.gax.rpc.ApiException)

Example 3 with UpdateTransferConfigRequest

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

the class UpdateCredentials method updateCredentials.

public static void updateCredentials(TransferConfig transferConfig, String serviceAccount, FieldMask updateMask) throws IOException {
    try (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
        UpdateTransferConfigRequest request = UpdateTransferConfigRequest.newBuilder().setTransferConfig(transferConfig).setUpdateMask(updateMask).setServiceAccountName(serviceAccount).build();
        dataTransferServiceClient.updateTransferConfig(request);
        System.out.println("Credentials updated successfully");
    } catch (ApiException ex) {
        System.out.print("Credentials was not updated." + ex.toString());
    }
}
Also used : DataTransferServiceClient(com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient) UpdateTransferConfigRequest(com.google.cloud.bigquery.datatransfer.v1.UpdateTransferConfigRequest) ApiException(com.google.api.gax.rpc.ApiException)

Example 4 with UpdateTransferConfigRequest

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

the class DisableTransferConfig method disableTransferConfig.

public static void disableTransferConfig(TransferConfig transferConfig, FieldMask updateMask) throws IOException {
    try (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) {
        UpdateTransferConfigRequest request = UpdateTransferConfigRequest.newBuilder().setTransferConfig(transferConfig).setUpdateMask(updateMask).build();
        TransferConfig updateConfig = dataTransferServiceClient.updateTransferConfig(request);
        System.out.println("Transfer config disabled successfully :" + updateConfig.getDisplayName());
    } catch (ApiException ex) {
        System.out.print("Transfer config was not disabled." + ex.toString());
    }
}
Also used : DataTransferServiceClient(com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient) UpdateTransferConfigRequest(com.google.cloud.bigquery.datatransfer.v1.UpdateTransferConfigRequest) TransferConfig(com.google.cloud.bigquery.datatransfer.v1.TransferConfig) ApiException(com.google.api.gax.rpc.ApiException)

Aggregations

ApiException (com.google.api.gax.rpc.ApiException)4 DataTransferServiceClient (com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClient)4 UpdateTransferConfigRequest (com.google.cloud.bigquery.datatransfer.v1.UpdateTransferConfigRequest)4 TransferConfig (com.google.cloud.bigquery.datatransfer.v1.TransferConfig)3