TransferJob

class TransferJob : KotlinCustomResource

Creates a new Transfer Job in Google Cloud Storage Transfer. To get more information about Google Cloud Storage Transfer, see:

Example Usage

Example creating a nightly Transfer Job from an AWS S3 Bucket to a GCS bucket.

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.storage.StorageFunctions;
import com.pulumi.gcp.storage.inputs.GetTransferProjectServiceAccountArgs;
import com.pulumi.gcp.storage.Bucket;
import com.pulumi.gcp.storage.BucketArgs;
import com.pulumi.gcp.storage.BucketIAMMember;
import com.pulumi.gcp.storage.BucketIAMMemberArgs;
import com.pulumi.gcp.pubsub.Topic;
import com.pulumi.gcp.pubsub.TopicIAMMember;
import com.pulumi.gcp.pubsub.TopicIAMMemberArgs;
import com.pulumi.gcp.storage.TransferJob;
import com.pulumi.gcp.storage.TransferJobArgs;
import com.pulumi.gcp.storage.inputs.TransferJobTransferSpecArgs;
import com.pulumi.gcp.storage.inputs.TransferJobTransferSpecObjectConditionsArgs;
import com.pulumi.gcp.storage.inputs.TransferJobTransferSpecTransferOptionsArgs;
import com.pulumi.gcp.storage.inputs.TransferJobTransferSpecAwsS3DataSourceArgs;
import com.pulumi.gcp.storage.inputs.TransferJobTransferSpecAwsS3DataSourceAwsAccessKeyArgs;
import com.pulumi.gcp.storage.inputs.TransferJobTransferSpecGcsDataSinkArgs;
import com.pulumi.gcp.storage.inputs.TransferJobScheduleArgs;
import com.pulumi.gcp.storage.inputs.TransferJobScheduleScheduleStartDateArgs;
import com.pulumi.gcp.storage.inputs.TransferJobScheduleScheduleEndDateArgs;
import com.pulumi.gcp.storage.inputs.TransferJobScheduleStartTimeOfDayArgs;
import com.pulumi.gcp.storage.inputs.TransferJobNotificationConfigArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var default = StorageFunctions.getTransferProjectServiceAccount(GetTransferProjectServiceAccountArgs.builder()
.project(var_.project())
.build());
var s3_backup_bucketBucket = new Bucket("s3-backup-bucketBucket", BucketArgs.builder()
.storageClass("NEARLINE")
.project(var_.project())
.location("US")
.build());
var s3_backup_bucketBucketIAMMember = new BucketIAMMember("s3-backup-bucketBucketIAMMember", BucketIAMMemberArgs.builder()
.bucket(s3_backup_bucketBucket.name())
.role("roles/storage.admin")
.member(String.format("serviceAccount:%s", default_.email()))
.build(), CustomResourceOptions.builder()
.dependsOn(s3_backup_bucketBucket)
.build());
var topic = new Topic("topic");
var notificationConfig = new TopicIAMMember("notificationConfig", TopicIAMMemberArgs.builder()
.topic(topic.id())
.role("roles/pubsub.publisher")
.member(String.format("serviceAccount:%s", default_.email()))
.build());
var s3_bucket_nightly_backup = new TransferJob("s3-bucket-nightly-backup", TransferJobArgs.builder()
.description("Nightly backup of S3 bucket")
.project(var_.project())
.transferSpec(TransferJobTransferSpecArgs.builder()
.objectConditions(TransferJobTransferSpecObjectConditionsArgs.builder()
.maxTimeElapsedSinceLastModification("600s")
.excludePrefixes("requests.gz")
.build())
.transferOptions(TransferJobTransferSpecTransferOptionsArgs.builder()
.deleteObjectsUniqueInSink(false)
.build())
.awsS3DataSource(TransferJobTransferSpecAwsS3DataSourceArgs.builder()
.bucketName(var_.aws_s3_bucket())
.awsAccessKey(TransferJobTransferSpecAwsS3DataSourceAwsAccessKeyArgs.builder()
.accessKeyId(var_.aws_access_key())
.secretAccessKey(var_.aws_secret_key())
.build())
.build())
.gcsDataSink(TransferJobTransferSpecGcsDataSinkArgs.builder()
.bucketName(s3_backup_bucketBucket.name())
.path("foo/bar/")
.build())
.build())
.schedule(TransferJobScheduleArgs.builder()
.scheduleStartDate(TransferJobScheduleScheduleStartDateArgs.builder()
.year(2018)
.month(10)
.day(1)
.build())
.scheduleEndDate(TransferJobScheduleScheduleEndDateArgs.builder()
.year(2019)
.month(1)
.day(15)
.build())
.startTimeOfDay(TransferJobScheduleStartTimeOfDayArgs.builder()
.hours(23)
.minutes(30)
.seconds(0)
.nanos(0)
.build())
.repeatInterval("604800s")
.build())
.notificationConfig(TransferJobNotificationConfigArgs.builder()
.pubsubTopic(topic.id())
.eventTypes(
"TRANSFER_OPERATION_SUCCESS",
"TRANSFER_OPERATION_FAILED")
.payloadFormat("JSON")
.build())
.build(), CustomResourceOptions.builder()
.dependsOn(
s3_backup_bucketBucketIAMMember,
notificationConfig)
.build());
}
}

Import

Storage buckets can be imported using the Transfer Job's project and name without the transferJob/ prefix, e.g.

$ pulumi import gcp:storage/transferJob:TransferJob nightly-backup-transfer-job my-project-1asd32/8422144862922355674

Properties

Link copied to clipboard
val creationTime: Output<String>

When the Transfer Job was created.

Link copied to clipboard
val deletionTime: Output<String>

When the Transfer Job was deleted.

Link copied to clipboard
val description: Output<String>

Unique description to identify the Transfer Job.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

When the Transfer Job was last modified.

Link copied to clipboard
val name: Output<String>

The name of the Transfer Job.

Link copied to clipboard

Notification configuration. This is not supported for transfers involving PosixFilesystem. Structure documented below.

Link copied to clipboard
val project: Output<String>

The project in which the resource belongs. If it is not provided, the provider project is used.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Schedule specification defining when the Transfer Job should be scheduled to start, end and what time to run. Structure documented below.

Link copied to clipboard
val status: Output<String>?

Status of the job. Default: ENABLED. NOTE: The effect of the new job status takes place during a subsequent job run. For example, if you change the job status from ENABLED to DISABLED, and an operation spawned by the transfer is running, the status change would not affect the current operation.

Link copied to clipboard

Transfer specification. Structure documented below.

Link copied to clipboard
val urn: Output<String>