All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.googlenative.dataflow.v1b3.kotlin.Job.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

The newest version!
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.googlenative.dataflow.v1b3.kotlin

import com.pulumi.core.Output
import com.pulumi.googlenative.dataflow.v1b3.kotlin.outputs.EnvironmentResponse
import com.pulumi.googlenative.dataflow.v1b3.kotlin.outputs.ExecutionStageStateResponse
import com.pulumi.googlenative.dataflow.v1b3.kotlin.outputs.JobExecutionInfoResponse
import com.pulumi.googlenative.dataflow.v1b3.kotlin.outputs.JobMetadataResponse
import com.pulumi.googlenative.dataflow.v1b3.kotlin.outputs.PipelineDescriptionResponse
import com.pulumi.googlenative.dataflow.v1b3.kotlin.outputs.RuntimeUpdatableParamsResponse
import com.pulumi.googlenative.dataflow.v1b3.kotlin.outputs.StepResponse
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.googlenative.dataflow.v1b3.kotlin.outputs.EnvironmentResponse.Companion.toKotlin as environmentResponseToKotlin
import com.pulumi.googlenative.dataflow.v1b3.kotlin.outputs.ExecutionStageStateResponse.Companion.toKotlin as executionStageStateResponseToKotlin
import com.pulumi.googlenative.dataflow.v1b3.kotlin.outputs.JobExecutionInfoResponse.Companion.toKotlin as jobExecutionInfoResponseToKotlin
import com.pulumi.googlenative.dataflow.v1b3.kotlin.outputs.JobMetadataResponse.Companion.toKotlin as jobMetadataResponseToKotlin
import com.pulumi.googlenative.dataflow.v1b3.kotlin.outputs.PipelineDescriptionResponse.Companion.toKotlin as pipelineDescriptionResponseToKotlin
import com.pulumi.googlenative.dataflow.v1b3.kotlin.outputs.RuntimeUpdatableParamsResponse.Companion.toKotlin as runtimeUpdatableParamsResponseToKotlin
import com.pulumi.googlenative.dataflow.v1b3.kotlin.outputs.StepResponse.Companion.toKotlin as stepResponseToKotlin

/**
 * Builder for [Job].
 */
@PulumiTagMarker
public class JobResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: JobArgs = JobArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend JobArgsBuilder.() -> Unit) {
        val builder = JobArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): Job {
        val builtJavaResource = com.pulumi.googlenative.dataflow.v1b3.Job(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Job(builtJavaResource)
    }
}

/**
 * Creates a Cloud Dataflow job. To create a job, we recommend using `projects.locations.jobs.create` with a [regional endpoint] (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using `projects.jobs.create` is not recommended, as your job will always start in `us-central1`. Do not enter confidential information when you supply string values using the API.
 * Note - this resource's API doesn't support deletion. When deleted, the resource will persist
 * on Google Cloud even though it will be deleted from Pulumi state.
 */
public class Job internal constructor(
    override val javaResource: com.pulumi.googlenative.dataflow.v1b3.Job,
) : KotlinCustomResource(javaResource, JobMapper) {
    /**
     * The client's unique identifier of the job, re-used across retried attempts. If this field is set, the service will ensure its uniqueness. The request to create a job will fail if the service has knowledge of a previously submitted job with the same client's ID and job name. The caller may use this field to ensure idempotence of job creation across retried attempts to create a job. By default, the field is empty and, in that case, the service ignores it.
     */
    public val clientRequestId: Output
        get() = javaResource.clientRequestId().applyValue({ args0 -> args0 })

    /**
     * The timestamp when the job was initially created. Immutable and set by the Cloud Dataflow service.
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * If this is specified, the job's initial state is populated from the given snapshot.
     */
    public val createdFromSnapshotId: Output
        get() = javaResource.createdFromSnapshotId().applyValue({ args0 -> args0 })

    /**
     * The current state of the job. Jobs are created in the `JOB_STATE_STOPPED` state unless otherwise specified. A job in the `JOB_STATE_RUNNING` state may asynchronously enter a terminal state. After a job has reached a terminal state, no further state updates may be made. This field may be mutated by the Cloud Dataflow service; callers cannot mutate it.
     */
    public val currentState: Output
        get() = javaResource.currentState().applyValue({ args0 -> args0 })

    /**
     * The timestamp associated with the current state.
     */
    public val currentStateTime: Output
        get() = javaResource.currentStateTime().applyValue({ args0 -> args0 })

    /**
     * The environment for the job.
     */
    public val environment: Output
        get() = javaResource.environment().applyValue({ args0 ->
            args0.let({ args0 ->
                environmentResponseToKotlin(args0)
            })
        })

    /**
     * Deprecated.
     */
    @Deprecated(
        message = """
  Deprecated.
  """,
    )
    public val executionInfo: Output
        get() = javaResource.executionInfo().applyValue({ args0 ->
            args0.let({ args0 ->
                jobExecutionInfoResponseToKotlin(args0)
            })
        })

    /**
     * This field is populated by the Dataflow service to support filtering jobs by the metadata values provided here. Populated for ListJobs and all GetJob views SUMMARY and higher.
     */
    public val jobMetadata: Output
        get() = javaResource.jobMetadata().applyValue({ args0 ->
            args0.let({ args0 ->
                jobMetadataResponseToKotlin(args0)
            })
        })

    /**
     * User-defined labels for this job. The labels map can contain no more than 64 entries. Entries of the labels map are UTF8 strings that comply with the following restrictions: * Keys must conform to regexp: \p{Ll}\p{Lo}{0,62} * Values must conform to regexp: [\p{Ll}\p{Lo}\p{N}_-]{0,63} * Both keys and values are additionally constrained to be <= 128 bytes in size.
     */
    public val labels: Output>
        get() = javaResource.labels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The user-specified Cloud Dataflow job name. Only one Job with a given name can exist in a project within one region at any given time. Jobs in different regions can have the same name. If a caller attempts to create a Job with the same name as an already-existing Job, the attempt returns the existing Job. The name must match the regular expression `[a-z]([-a-z0-9]{0,1022}[a-z0-9])?`
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Preliminary field: The format of this data may change at any time. A description of the user pipeline and stages through which it is executed. Created by Cloud Dataflow service. Only retrieved with JOB_VIEW_DESCRIPTION or JOB_VIEW_ALL.
     */
    public val pipelineDescription: Output
        get() = javaResource.pipelineDescription().applyValue({ args0 ->
            args0.let({ args0 ->
                pipelineDescriptionResponseToKotlin(args0)
            })
        })

    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * Deprecated. This field is now in the Job message.
     */
    public val replaceJobId: Output
        get() = javaResource.replaceJobId().applyValue({ args0 -> args0 })

    /**
     * If another job is an update of this job (and thus, this job is in `JOB_STATE_UPDATED`), this field contains the ID of that job.
     */
    public val replacedByJobId: Output
        get() = javaResource.replacedByJobId().applyValue({ args0 -> args0 })

    /**
     * The job's requested state. `UpdateJob` may be used to switch between the `JOB_STATE_STOPPED` and `JOB_STATE_RUNNING` states, by setting requested_state. `UpdateJob` may also be used to directly set a job's requested state to `JOB_STATE_CANCELLED` or `JOB_STATE_DONE`, irrevocably terminating the job if it has not already reached a terminal state.
     */
    public val requestedState: Output
        get() = javaResource.requestedState().applyValue({ args0 -> args0 })

    /**
     * This field may ONLY be modified at runtime using the projects.jobs.update method to adjust job behavior. This field has no effect when specified at job creation.
     */
    public val runtimeUpdatableParams: Output
        get() = javaResource.runtimeUpdatableParams().applyValue({ args0 ->
            args0.let({ args0 ->
                runtimeUpdatableParamsResponseToKotlin(args0)
            })
        })

    /**
     * Reserved for future use. This field is set only in responses from the server; it is ignored if it is set in any requests.
     */
    public val satisfiesPzs: Output
        get() = javaResource.satisfiesPzs().applyValue({ args0 -> args0 })

    /**
     * This field may be mutated by the Cloud Dataflow service; callers cannot mutate it.
     */
    public val stageStates: Output>
        get() = javaResource.stageStates().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    executionStageStateResponseToKotlin(args0)
                })
            })
        })

    /**
     * The timestamp when the job was started (transitioned to JOB_STATE_PENDING). Flexible resource scheduling jobs are started with some delay after job creation, so start_time is unset before start and is updated when the job is started by the Cloud Dataflow service. For other jobs, start_time always equals to create_time and is immutable and set by the Cloud Dataflow service.
     */
    public val startTime: Output
        get() = javaResource.startTime().applyValue({ args0 -> args0 })

    /**
     * Exactly one of step or steps_location should be specified. The top-level steps that constitute the entire job. Only retrieved with JOB_VIEW_ALL.
     */
    public val steps: Output>
        get() = javaResource.steps().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    stepResponseToKotlin(args0)
                })
            })
        })

    /**
     * The Cloud Storage location where the steps are stored.
     */
    public val stepsLocation: Output
        get() = javaResource.stepsLocation().applyValue({ args0 -> args0 })

    /**
     * A set of files the system should be aware of that are used for temporary storage. These temporary files will be removed on job completion. No duplicates are allowed. No file patterns are supported. The supported files are: Google Cloud Storage: storage.googleapis.com/{bucket}/{object} bucket.storage.googleapis.com/{object}
     */
    public val tempFiles: Output>
        get() = javaResource.tempFiles().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * The map of transform name prefixes of the job to be replaced to the corresponding name prefixes of the new job.
     */
    public val transformNameMapping: Output>
        get() = javaResource.transformNameMapping().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * The type of Cloud Dataflow job.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })

    /**
     * The level of information requested in response.
     */
    public val view: Output?
        get() = javaResource.view().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

public object JobMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.googlenative.dataflow.v1b3.Job::class == javaResource::class

    override fun map(javaResource: Resource): Job = Job(
        javaResource as
            com.pulumi.googlenative.dataflow.v1b3.Job,
    )
}

/**
 * @see [Job].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [Job].
 */
public suspend fun job(name: String, block: suspend JobResourceBuilder.() -> Unit): Job {
    val builder = JobResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [Job].
 * @param name The _unique_ name of the resulting resource.
 */
public fun job(name: String): Job {
    val builder = JobResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy