@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
324 lines (323 loc) • 15.4 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* Creates a new Transfer Job in Google Cloud Storage Transfer.
*
* To get more information about Google Cloud Storage Transfer, see:
*
* * [Overview](https://cloud.google.com/storage-transfer/docs/overview)
* * [API documentation](https://cloud.google.com/storage-transfer/docs/reference/rest/v1/transferJobs)
* * How-to Guides
* * [Configuring Access to Data Sources and Sinks](https://cloud.google.com/storage-transfer/docs/configure-access)
*
* ## Example Usage
*
* Example creating a nightly Transfer Job from an AWS S3 Bucket to a GCS bucket.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = gcp.storage.getTransferProjectServiceAccount({
* project: project,
* });
* const s3_backup_bucket = new gcp.storage.Bucket("s3-backup-bucket", {
* name: `${awsS3Bucket}-backup`,
* storageClass: "NEARLINE",
* project: project,
* location: "US",
* });
* const s3_backup_bucketBucketIAMMember = new gcp.storage.BucketIAMMember("s3-backup-bucket", {
* bucket: s3_backup_bucket.name,
* role: "roles/storage.admin",
* member: _default.then(_default => `serviceAccount:${_default.email}`),
* }, {
* dependsOn: [s3_backup_bucket],
* });
* const topic = new gcp.pubsub.Topic("topic", {name: pubsubTopicName});
* const notificationConfig = new gcp.pubsub.TopicIAMMember("notification_config", {
* topic: topic.id,
* role: "roles/pubsub.publisher",
* member: _default.then(_default => `serviceAccount:${_default.email}`),
* });
* const s3_bucket_nightly_backup = new gcp.storage.TransferJob("s3-bucket-nightly-backup", {
* description: "Nightly backup of S3 bucket",
* project: project,
* transferSpec: {
* objectConditions: {
* maxTimeElapsedSinceLastModification: "600s",
* excludePrefixes: ["requests.gz"],
* },
* transferOptions: {
* deleteObjectsUniqueInSink: false,
* },
* awsS3DataSource: {
* bucketName: awsS3Bucket,
* awsAccessKey: {
* accessKeyId: awsAccessKey,
* secretAccessKey: awsSecretKey,
* },
* },
* gcsDataSink: {
* bucketName: s3_backup_bucket.name,
* path: "foo/bar/",
* },
* },
* schedule: {
* scheduleStartDate: {
* year: 2018,
* month: 10,
* day: 1,
* },
* scheduleEndDate: {
* year: 2019,
* month: 1,
* day: 15,
* },
* startTimeOfDay: {
* hours: 23,
* minutes: 30,
* seconds: 0,
* nanos: 0,
* },
* repeatInterval: "604800s",
* },
* notificationConfig: {
* pubsubTopic: topic.id,
* eventTypes: [
* "TRANSFER_OPERATION_SUCCESS",
* "TRANSFER_OPERATION_FAILED",
* ],
* payloadFormat: "JSON",
* },
* loggingConfig: {
* logActions: [
* "COPY",
* "DELETE",
* ],
* logActionStates: [
* "SUCCEEDED",
* "FAILED",
* ],
* },
* }, {
* dependsOn: [
* s3_backup_bucketBucketIAMMember,
* notificationConfig,
* ],
* });
* ```
*
* ## Import
*
* Storage Transfer Jobs can be imported using the Transfer Job's `project` and `name` (without the `transferJob/` prefix), e.g.
*
* * `{{project_id}}/{{name}}`, where `name` is a numeric value.
*
* When using the `pulumi import` command, Storage Transfer Jobs can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:storage/transferJob:TransferJob default {{project_id}}/123456789
* ```
*/
export declare class TransferJob extends pulumi.CustomResource {
/**
* Get an existing TransferJob resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: TransferJobState, opts?: pulumi.CustomResourceOptions): TransferJob;
/**
* Returns true if the given object is an instance of TransferJob. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is TransferJob;
/**
* When the Transfer Job was created.
*/
readonly creationTime: pulumi.Output<string>;
/**
* When the Transfer Job was deleted.
*/
readonly deletionTime: pulumi.Output<string>;
/**
* Unique description to identify the Transfer Job.
*/
readonly description: pulumi.Output<string>;
/**
* Specifies the Event-driven transfer options. Event-driven transfers listen to an event stream to transfer updated files. Structure documented below Either `eventStream` or `schedule` must be set.
*/
readonly eventStream: pulumi.Output<outputs.storage.TransferJobEventStream | undefined>;
/**
* When the Transfer Job was last modified.
*/
readonly lastModificationTime: pulumi.Output<string>;
/**
* Logging configuration. Structure documented below.
*/
readonly loggingConfig: pulumi.Output<outputs.storage.TransferJobLoggingConfig | undefined>;
/**
* The name of the Transfer Job. This name must start with "transferJobs/" prefix and end with a letter or a number, and should be no more than 128 characters ( `transferJobs/^(?!OPI)[A-Za-z0-9-._~]*[A-Za-z0-9]$` ). For transfers involving PosixFilesystem, this name must start with transferJobs/OPI specifically ( `transferJobs/OPI^[A-Za-z0-9-._~]*[A-Za-z0-9]$` ). For all other transfer types, this name must not start with transferJobs/OPI. Default the provider will assign a random unique name with `transferJobs/{{name}}` format, where `name` is a numeric value.
*/
readonly name: pulumi.Output<string>;
/**
* Notification configuration. This is not supported for transfers involving PosixFilesystem. Structure documented below.
*/
readonly notificationConfig: pulumi.Output<outputs.storage.TransferJobNotificationConfig | undefined>;
/**
* The project in which the resource belongs. If it
* is not provided, the provider project is used.
*/
readonly project: pulumi.Output<string>;
/**
* Replication specification. Structure documented below. User should not configure `schedule`, `eventStream` with this argument. One of `transferSpec`, or `replicationSpec` must be specified.
*
* - - -
*/
readonly replicationSpec: pulumi.Output<outputs.storage.TransferJobReplicationSpec | undefined>;
/**
* Schedule specification defining when the Transfer Job should be scheduled to start, end and what time to run. Structure documented below. Either `schedule` or `eventStream` must be set.
*/
readonly schedule: pulumi.Output<outputs.storage.TransferJobSchedule | undefined>;
/**
* The user-managed service account to run the job. If this field is specified, the given service account is granted the necessary permissions to all applicable resources (e.g. GCS buckets) required by the job.
*/
readonly serviceAccount: pulumi.Output<string | undefined>;
/**
* 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.**
*/
readonly status: pulumi.Output<string | undefined>;
/**
* Transfer specification. Structure documented below. One of `transferSpec`, or `replicationSpec` can be specified.
*/
readonly transferSpec: pulumi.Output<outputs.storage.TransferJobTransferSpec | undefined>;
/**
* Create a TransferJob resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: TransferJobArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering TransferJob resources.
*/
export interface TransferJobState {
/**
* When the Transfer Job was created.
*/
creationTime?: pulumi.Input<string>;
/**
* When the Transfer Job was deleted.
*/
deletionTime?: pulumi.Input<string>;
/**
* Unique description to identify the Transfer Job.
*/
description?: pulumi.Input<string>;
/**
* Specifies the Event-driven transfer options. Event-driven transfers listen to an event stream to transfer updated files. Structure documented below Either `eventStream` or `schedule` must be set.
*/
eventStream?: pulumi.Input<inputs.storage.TransferJobEventStream>;
/**
* When the Transfer Job was last modified.
*/
lastModificationTime?: pulumi.Input<string>;
/**
* Logging configuration. Structure documented below.
*/
loggingConfig?: pulumi.Input<inputs.storage.TransferJobLoggingConfig>;
/**
* The name of the Transfer Job. This name must start with "transferJobs/" prefix and end with a letter or a number, and should be no more than 128 characters ( `transferJobs/^(?!OPI)[A-Za-z0-9-._~]*[A-Za-z0-9]$` ). For transfers involving PosixFilesystem, this name must start with transferJobs/OPI specifically ( `transferJobs/OPI^[A-Za-z0-9-._~]*[A-Za-z0-9]$` ). For all other transfer types, this name must not start with transferJobs/OPI. Default the provider will assign a random unique name with `transferJobs/{{name}}` format, where `name` is a numeric value.
*/
name?: pulumi.Input<string>;
/**
* Notification configuration. This is not supported for transfers involving PosixFilesystem. Structure documented below.
*/
notificationConfig?: pulumi.Input<inputs.storage.TransferJobNotificationConfig>;
/**
* The project in which the resource belongs. If it
* is not provided, the provider project is used.
*/
project?: pulumi.Input<string>;
/**
* Replication specification. Structure documented below. User should not configure `schedule`, `eventStream` with this argument. One of `transferSpec`, or `replicationSpec` must be specified.
*
* - - -
*/
replicationSpec?: pulumi.Input<inputs.storage.TransferJobReplicationSpec>;
/**
* Schedule specification defining when the Transfer Job should be scheduled to start, end and what time to run. Structure documented below. Either `schedule` or `eventStream` must be set.
*/
schedule?: pulumi.Input<inputs.storage.TransferJobSchedule>;
/**
* The user-managed service account to run the job. If this field is specified, the given service account is granted the necessary permissions to all applicable resources (e.g. GCS buckets) required by the job.
*/
serviceAccount?: pulumi.Input<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.**
*/
status?: pulumi.Input<string>;
/**
* Transfer specification. Structure documented below. One of `transferSpec`, or `replicationSpec` can be specified.
*/
transferSpec?: pulumi.Input<inputs.storage.TransferJobTransferSpec>;
}
/**
* The set of arguments for constructing a TransferJob resource.
*/
export interface TransferJobArgs {
/**
* Unique description to identify the Transfer Job.
*/
description: pulumi.Input<string>;
/**
* Specifies the Event-driven transfer options. Event-driven transfers listen to an event stream to transfer updated files. Structure documented below Either `eventStream` or `schedule` must be set.
*/
eventStream?: pulumi.Input<inputs.storage.TransferJobEventStream>;
/**
* Logging configuration. Structure documented below.
*/
loggingConfig?: pulumi.Input<inputs.storage.TransferJobLoggingConfig>;
/**
* The name of the Transfer Job. This name must start with "transferJobs/" prefix and end with a letter or a number, and should be no more than 128 characters ( `transferJobs/^(?!OPI)[A-Za-z0-9-._~]*[A-Za-z0-9]$` ). For transfers involving PosixFilesystem, this name must start with transferJobs/OPI specifically ( `transferJobs/OPI^[A-Za-z0-9-._~]*[A-Za-z0-9]$` ). For all other transfer types, this name must not start with transferJobs/OPI. Default the provider will assign a random unique name with `transferJobs/{{name}}` format, where `name` is a numeric value.
*/
name?: pulumi.Input<string>;
/**
* Notification configuration. This is not supported for transfers involving PosixFilesystem. Structure documented below.
*/
notificationConfig?: pulumi.Input<inputs.storage.TransferJobNotificationConfig>;
/**
* The project in which the resource belongs. If it
* is not provided, the provider project is used.
*/
project?: pulumi.Input<string>;
/**
* Replication specification. Structure documented below. User should not configure `schedule`, `eventStream` with this argument. One of `transferSpec`, or `replicationSpec` must be specified.
*
* - - -
*/
replicationSpec?: pulumi.Input<inputs.storage.TransferJobReplicationSpec>;
/**
* Schedule specification defining when the Transfer Job should be scheduled to start, end and what time to run. Structure documented below. Either `schedule` or `eventStream` must be set.
*/
schedule?: pulumi.Input<inputs.storage.TransferJobSchedule>;
/**
* The user-managed service account to run the job. If this field is specified, the given service account is granted the necessary permissions to all applicable resources (e.g. GCS buckets) required by the job.
*/
serviceAccount?: pulumi.Input<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.**
*/
status?: pulumi.Input<string>;
/**
* Transfer specification. Structure documented below. One of `transferSpec`, or `replicationSpec` can be specified.
*/
transferSpec?: pulumi.Input<inputs.storage.TransferJobTransferSpec>;
}