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

com.pulumi.googlenative.cloudtasks.v2beta3.kotlin.Queue.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.cloudtasks.v2beta3.kotlin

import com.pulumi.core.Output
import com.pulumi.googlenative.cloudtasks.v2beta3.kotlin.outputs.AppEngineHttpQueueResponse
import com.pulumi.googlenative.cloudtasks.v2beta3.kotlin.outputs.HttpTargetResponse
import com.pulumi.googlenative.cloudtasks.v2beta3.kotlin.outputs.QueueStatsResponse
import com.pulumi.googlenative.cloudtasks.v2beta3.kotlin.outputs.RateLimitsResponse
import com.pulumi.googlenative.cloudtasks.v2beta3.kotlin.outputs.RetryConfigResponse
import com.pulumi.googlenative.cloudtasks.v2beta3.kotlin.outputs.StackdriverLoggingConfigResponse
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.String
import kotlin.Suppress
import kotlin.Unit
import com.pulumi.googlenative.cloudtasks.v2beta3.kotlin.outputs.AppEngineHttpQueueResponse.Companion.toKotlin as appEngineHttpQueueResponseToKotlin
import com.pulumi.googlenative.cloudtasks.v2beta3.kotlin.outputs.HttpTargetResponse.Companion.toKotlin as httpTargetResponseToKotlin
import com.pulumi.googlenative.cloudtasks.v2beta3.kotlin.outputs.QueueStatsResponse.Companion.toKotlin as queueStatsResponseToKotlin
import com.pulumi.googlenative.cloudtasks.v2beta3.kotlin.outputs.RateLimitsResponse.Companion.toKotlin as rateLimitsResponseToKotlin
import com.pulumi.googlenative.cloudtasks.v2beta3.kotlin.outputs.RetryConfigResponse.Companion.toKotlin as retryConfigResponseToKotlin
import com.pulumi.googlenative.cloudtasks.v2beta3.kotlin.outputs.StackdriverLoggingConfigResponse.Companion.toKotlin as stackdriverLoggingConfigResponseToKotlin

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

    public var args: QueueArgs = QueueArgs()

    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 QueueArgsBuilder.() -> Unit) {
        val builder = QueueArgsBuilder()
        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(): Queue {
        val builtJavaResource =
            com.pulumi.googlenative.cloudtasks.v2beta3.Queue(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return Queue(builtJavaResource)
    }
}

/**
 * Creates a queue. Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not. WARNING: Using this method may have unintended side effects if you are using an App Engine `queue.yaml` or `queue.xml` file to manage your queues. Read [Overview of Queue Management and queue.yaml](https://cloud.google.com/tasks/docs/queue-yaml) before using this method.
 */
public class Queue internal constructor(
    override val javaResource: com.pulumi.googlenative.cloudtasks.v2beta3.Queue,
) : KotlinCustomResource(javaResource, QueueMapper) {
    /**
     * AppEngineHttpQueue settings apply only to App Engine tasks in this queue. Http tasks are not affected by this proto.
     */
    public val appEngineHttpQueue: Output
        get() = javaResource.appEngineHttpQueue().applyValue({ args0 ->
            args0.let({ args0 ->
                appEngineHttpQueueResponseToKotlin(args0)
            })
        })

    /**
     * Modifies HTTP target for HTTP tasks.
     */
    public val httpTarget: Output
        get() = javaResource.httpTarget().applyValue({ args0 ->
            args0.let({ args0 ->
                httpTargetResponseToKotlin(args0)
            })
        })

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

    /**
     * Caller-specified and required in CreateQueue, after which it becomes output only. The queue name. The queue name must have the following format: `projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID` * `PROJECT_ID` can contain letters ([A-Za-z]), numbers ([0-9]), hyphens (-), colons (:), or periods (.). For more information, see [Identifying projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects) * `LOCATION_ID` is the canonical ID for the queue's location. The list of available locations can be obtained by calling ListLocations. For more information, see https://cloud.google.com/about/locations/. * `QUEUE_ID` can contain letters ([A-Za-z]), numbers ([0-9]), or hyphens (-). The maximum length is 100 characters.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

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

    /**
     * The last time this queue was purged. All tasks that were created before this time were purged. A queue can be purged using PurgeQueue, the [App Engine Task Queue SDK, or the Cloud Console](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/deleting-tasks-and-queues#purging_all_tasks_from_a_queue). Purge time will be truncated to the nearest microsecond. Purge time will be unset if the queue has never been purged.
     */
    public val purgeTime: Output
        get() = javaResource.purgeTime().applyValue({ args0 -> args0 })

    /**
     * Rate limits for task dispatches. rate_limits and retry_config are related because they both control task attempts. However they control task attempts in different ways: * rate_limits controls the total rate of dispatches from a queue (i.e. all traffic dispatched from the queue, regardless of whether the dispatch is from a first attempt or a retry). * retry_config controls what happens to particular a task after its first attempt fails. That is, retry_config controls task retries (the second attempt, third attempt, etc). The queue's actual dispatch rate is the result of: * Number of tasks in the queue * User-specified throttling: rate_limits, retry_config, and the queue's state. * System throttling due to `429` (Too Many Requests) or `503` (Service Unavailable) responses from the worker, high error rates, or to smooth sudden large traffic spikes.
     */
    public val rateLimits: Output
        get() = javaResource.rateLimits().applyValue({ args0 ->
            args0.let({ args0 ->
                rateLimitsResponseToKotlin(args0)
            })
        })

    /**
     * Settings that determine the retry behavior. * For tasks created using Cloud Tasks: the queue-level retry settings apply to all tasks in the queue that were created using Cloud Tasks. Retry settings cannot be set on individual tasks. * For tasks created using the App Engine SDK: the queue-level retry settings apply to all tasks in the queue which do not have retry settings explicitly set on the task and were created by the App Engine SDK. See [App Engine documentation](https://cloud.google.com/appengine/docs/standard/python/taskqueue/push/retrying-tasks).
     */
    public val retryConfig: Output
        get() = javaResource.retryConfig().applyValue({ args0 ->
            args0.let({ args0 ->
                retryConfigResponseToKotlin(args0)
            })
        })

    /**
     * Configuration options for writing logs to [Stackdriver Logging](https://cloud.google.com/logging/docs/). If this field is unset, then no logs are written.
     */
    public val stackdriverLoggingConfig: Output
        get() = javaResource.stackdriverLoggingConfig().applyValue({ args0 ->
            args0.let({ args0 ->
                stackdriverLoggingConfigResponseToKotlin(args0)
            })
        })

    /**
     * The state of the queue. `state` can only be changed by called PauseQueue, ResumeQueue, or uploading [queue.yaml/xml](https://cloud.google.com/appengine/docs/python/config/queueref). UpdateQueue cannot be used to change `state`.
     */
    public val state: Output
        get() = javaResource.state().applyValue({ args0 -> args0 })

    /**
     * The realtime, informational statistics for a queue. In order to receive the statistics the caller should include this field in the FieldMask.
     */
    public val stats: Output
        get() = javaResource.stats().applyValue({ args0 ->
            args0.let({ args0 ->
                queueStatsResponseToKotlin(args0)
            })
        })

    /**
     * The maximum amount of time that a task will be retained in this queue. Queues created by Cloud Tasks have a default `task_ttl` of 31 days. After a task has lived for `task_ttl`, the task will be deleted regardless of whether it was dispatched or not. The `task_ttl` for queues created via queue.yaml/xml is equal to the maximum duration because there is a [storage quota](https://cloud.google.com/appengine/quotas#Task_Queue) for these queues. To view the maximum valid duration, see the documentation for Duration.
     */
    public val taskTtl: Output
        get() = javaResource.taskTtl().applyValue({ args0 -> args0 })

    /**
     * The task tombstone time to live (TTL). After a task is deleted or executed, the task's tombstone is retained for the length of time specified by `tombstone_ttl`. The tombstone is used by task de-duplication; another task with the same name can't be created until the tombstone has expired. For more information about task de-duplication, see the documentation for CreateTaskRequest. Queues created by Cloud Tasks have a default `tombstone_ttl` of 1 hour.
     */
    public val tombstoneTtl: Output
        get() = javaResource.tombstoneTtl().applyValue({ args0 -> args0 })

    /**
     * Immutable. The type of a queue (push or pull). `Queue.type` is an immutable property of the queue that is set at the queue creation time. When left unspecified, the default value of `PUSH` is selected.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })
}

public object QueueMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.googlenative.cloudtasks.v2beta3.Queue::class == javaResource::class

    override fun map(javaResource: Resource): Queue = Queue(
        javaResource as
            com.pulumi.googlenative.cloudtasks.v2beta3.Queue,
    )
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy